var WPFormsBuilder=window.WPFormsBuilder||function(r,a,w){var h,g,f={},t=!0,m={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,h=this.settings,w(m.ready),w(a).on("load",function(){"function"==typeof w.ready.then?w.ready.then(m.load):m.load()}),w(a).on("beforeunload",function(){if(!e.formIsSaved()&&t)return wpforms_builder.are_you_sure_to_close})},load:function(){m.hideLoadingOverlay(),"1"==wpforms_builder.template_modal_display&&"fields"===wpf.getQueryString("view")&&w.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(){m.isVisitedViaBackButton()?location.reload():(g=w("#wpforms-builder"),f.$fieldOptions=w("#wpforms-field-options"),f.$sortableFieldsWrap=w(".wpforms-field-wrap"),f.$noFieldsOptions=w(".wpforms-no-fields-holder .no-fields"),f.$noFieldsPreview=w(".wpforms-no-fields-holder .no-fields-preview"),m.isBuilderInPopup()&&(w("#wpforms-embed").remove(),w("#wpforms-preview-btn").addClass("wpforms-alone")),m.loadMsWinCSS(),m.bindUIActions(),wpf.getQueryString("newform")&&m.formSave(!1),h.formID=w("#wpforms-builder-form").data("id"),h.pagebreakTop=w(".wpforms-pagebreak-top").length,h.pagebreakBottom=w(".wpforms-pagebreak-bottom").length,g.on("keypress","#wpforms-builder-form :input:not(textarea)",function(e){13===e.keyCode&&e.preventDefault()}),w(".wpforms-panel").each(function(e,t){var i,o=w(this),r=o.find(".wpforms-panel-sidebar-section.configured").first();r.length?(i=r.data("section"),r.addClass("active"),o.find(".wpforms-panel-content-section-"+i).show().addClass("active"),o.find(".wpforms-panel-content-section-default").hide()):(o.find(".wpforms-panel-content-section:first-of-type").show().addClass("active"),o.find(".wpforms-panel-sidebar-section:first-of-type").addClass("active"))}),m.loadEntryPreviewFields(),m.fieldSortable(),m.fieldChoiceSortable("select"),m.fieldChoiceSortable("radio"),m.fieldChoiceSortable("checkbox"),m.fieldChoiceSortable("payment-multiple"),m.fieldChoiceSortable("payment-checkbox"),m.fieldChoiceSortable("payment-select"),w(".wpforms-setup-templates.core .wpforms-template-inner").matchHeight({byRow:!1}),w(".wpforms-setup-templates.additional .wpforms-template-inner").matchHeight({byRow:!1}),w(".wpforms-add-fields-group").each(function(e,t){m.fieldGroupToggle(w(this),"load")}),m.registerTemplates(),m.trimFormTitle(),wpf.initTooltips(),m.loadColorPickers(),m.captchaToggle(),m.confirmationsSetup(),m.notificationToggle(),m.notificationsByStatusAlerts(),m.builderHotkeys(),w("#wpforms-setup-name").val(w("#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},m.dropdownField.init(),m.initSomeFieldOptions(),m.dismissNotice())},loadMsWinCSS:function(){var e=navigator.userAgent;e.indexOf("Windows")<0||e.indexOf("Chrome")<0&&e.indexOf("Firefox")<0||w("").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:wpforms_builder.ms_win_css_url})},isVisitedViaBackButton:function(){if(!performance)return!1;var t=!1;return performance.getEntriesByType("navigation").forEach(function(e){"back_forward"===e.type&&(t=!0)}),t},hideLoadingOverlay:function(){var e=w("#wpforms-builder-overlay");e.addClass("fade-out"),setTimeout(function(){e.hide()},250)},showLoadingOverlay:function(){var e=w("#wpforms-builder-overlay");e.removeClass("fade-out"),e.show()},initSomeFieldOptions:function(){m.toggleAllOptionGroups(g),g.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=w(this.containerOuter.element),t=e.closest(".wpforms-field").find("select");e.hasClass("is-disabled")&&e.removeClass("is-disabled"),t.is("[readonly]")&&(this.disable(),t.prop("disabled",!1)),this.passedElement.element.multiple&&this.getValue(!0).length&&w(this.input.element).addClass("wpforms-hidden")}}},init:function(){g.find("."+m.dropdownField.config.modernClass).each(function(){m.dropdownField.events.choicesInit(w(this))}),g.on("change",".wpforms-field-option-select .wpforms-field-option-row-multiple input",m.dropdownField.events.multiple),g.on("change",".wpforms-field-option-select .wpforms-field-option-row-style select, .wpforms-field-option-payment-select .wpforms-field-option-row-style select",m.dropdownField.events.applyStyle)},events:{choicesInit:function(e){var t=new Choices(e[0],m.dropdownField.config.args);m.dropdownField.helpers.setInstance(e,t),m.dropdownField.helpers.addPlaceholderChoice(e,t)},multiple:function(e){var t=w(this).closest(".wpforms-field-option-row-multiple").data().fieldId,i=m.dropdownField.helpers.getPrimarySelector(t),o=w("#wpforms-field-option-row-"+t+"-choices input.default"),r=i.find(".placeholder"),n=m.dropdownField.helpers.isDynamicChoices(t),a=e.target.checked,e=a?"checkbox":"radio";i.prop("multiple",a),o.prop("type",e),n&&i.find("option:selected").prop("selected",!1),i=o.filter(":checked"),!a&&i.length&&(o.prop("checked",!1),w(i.get(0)).prop("checked",!0)),r.length&&r.prop("selected",!a),m.dropdownField.helpers.update(t,n)},applyStyle:function(){var e=w(this),t=e.closest(".wpforms-field-option-row-style").data().fieldId;"modern"===e.val()?m.dropdownField.helpers.convertClassicToModern(t):m.dropdownField.helpers.convertModernToClassic(t)}},helpers:{convertModernToClassic:function(e){var t=m.dropdownField.helpers.getPrimarySelector(e),i=m.dropdownField.helpers.isDynamicChoices(e),t=m.dropdownField.helpers.getInstance(t);t.destroy(),m.dropdownField.helpers.updatePlaceholderChoice(t,e),i||m.fieldChoiceUpdate("select",e)},convertClassicToModern:function(e){var t=m.dropdownField.helpers.getPrimarySelector(e);m.dropdownField.helpers.isDynamicChoices(e)||m.fieldChoiceUpdate("select",e),m.dropdownField.events.choicesInit(t)},update:function(e,t){var i=m.dropdownField.helpers.getPrimarySelector(e);m.dropdownField.helpers.isModernSelect(i)?(m.dropdownField.helpers.convertModernToClassic(e),m.dropdownField.events.choicesInit(i)):t||m.fieldChoiceUpdate("select",e)},addPlaceholderChoice:function(e,t){var i=e.closest(".wpforms-field").data().fieldId,o=m.dropdownField.helpers.hasDefaults(i);if(m.dropdownField.helpers.isDynamicChoices(i)&&(o=!1),!1!==m.dropdownField.helpers.searchPlaceholderChoice(t))return!1;if(!t.config.choices.length)return!1;e=t.config.choices[0].label,i=w(t.passedElement.element).prop("multiple");return t.setChoices([{value:"",label:e,selected:!(i||o),placeholder:!0}],"value","label",!1),i&&w(t.input.element).prop("placeholder",e),!0},searchPlaceholderChoice:function(e){var o=!1;return e.config.choices.forEach(function(e,t,i){if(void 0!==e.placeholder&&!0===e.placeholder)return!(o={key:t,item:e})}),o},updatePlaceholderChoice:function(e,t){var i=w(e.passedElement.element),o=wpf.sanitizeHTML(w("#wpforms-field-option-"+t+"-placeholder").val()),t=m.dropdownField.helpers.searchPlaceholderChoice(e),e={};"object"==typeof t&&(e=w(i.find("option").get(t.key))),""!==o?!w.isEmptyObject(e)&&e.length?e.addClass("placeholder").text(o):i.prepend('"):e.length&&e.remove()},isModernSelect:function(e){e=m.dropdownField.helpers.getInstance(e);return"object"==typeof e&&(!w.isEmptyObject(e)&&e.initialised)},setInstance:function(e,t){e.data("choicesjs",t)},getInstance:function(e){return e.data("choicesjs")},isDynamicChoices:function(e){e=w("#wpforms-field-option-"+e+"-dynamic_choices");return!!e.length&&""!==e.val()},hasDefaults:function(e){return!!w("#wpforms-field-option-row-"+e+"-choices .choices-list").find("input.default:checked").length},getPrimarySelector:function(e){return w("#wpforms-field-"+e+" .primary-input")}}},numberSliderEvents:function(e){e.on("input",".wpforms-field-option-row-min_max .wpforms-input-row .wpforms-number-slider-min",m.fieldNumberSliderUpdateMin),e.on("input",".wpforms-field-option-row-min_max .wpforms-input-row .wpforms-number-slider-max",m.fieldNumberSliderUpdateMax),e.on("input",".wpforms-number-slider-default-value",_.debounce(m.changeNumberSliderDefaultValue,500)),e.on("input",".wpforms-number-slider-step",_.debounce(m.changeNumberSliderStep,500)),e.on("focusout",".wpforms-number-slider-step",m.checkNumberSliderStep),e.on("input",".wpforms-number-slider-value-display",_.debounce(m.changeNumberSliderValueDisplay,500)),e.on("input",".wpforms-number-slider-min",_.debounce(m.changeNumberSliderMin,500)),e.on("input",".wpforms-number-slider-max",_.debounce(m.changeNumberSliderMax,500))},changeNumberSliderMin:function(e){var t=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),i=parseFloat(e.target.value);isNaN(i)||m.updateNumberSliderDefaultValueAttr(t,e.target.value,"min")},changeNumberSliderMax:function(e){var t=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),i=parseFloat(e.target.value);isNaN(i)||m.updateNumberSliderDefaultValueAttr(t,e.target.value,"max").updateNumberSliderStepValueMaxAttr(t,e.target.value)},changeNumberSliderValueDisplay:function(e){var t=e.target.value,i=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),e=r.getElementById("wpforms-field-option-"+i+"-default_value");e&&m.updateNumberSliderHintStr(i,t).updateNumberSliderHint(i,e.value)},changeNumberSliderStep:function(e){var t,i,o,r=parseFloat(e.target.value);isNaN(r)||(t=parseFloat(e.target.max),i=parseFloat(e.target.min),o=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),r<=0||(t"+t+"")),this},fieldNumberSliderUpdateMin:function(e){var t=w(e.target).parents(".wpforms-field-option-row-min_max"),i=parseFloat(t.find(".wpforms-number-slider-max").val()),o=parseFloat(e.target.value);if(!isNaN(o)){if(i<=o)return e.preventDefault(),void(this.value=i);t=t.data("field-id");g.find("#wpforms-field-"+t+' input[type="range"]').attr("min",o)}},fieldNumberSliderUpdateMax:function(e){var t=w(e.target).parents(".wpforms-field-option-row-min_max"),i=parseFloat(t.find(".wpforms-number-slider-min").val()),o=parseFloat(e.target.value);if(!isNaN(o)){if(o<=i)return e.preventDefault(),void(this.value=i);t=t.data("field-id");g.find("#wpforms-field-"+t+' input[type="range"]').attr("max",o)}},updateNumberSliderStepValueMaxAttr:function(e,t){var i=r.getElementById("wpforms-field-option-"+e+"-step");return i&&(e=parseFloat(i.value),i.setAttribute("max",t),(t=parseFloat(t))'+i+""),r.find(".placeholder").prop("selected",!r.prop("multiple")))):r.prop("placeholder",i)}),g.on("input",".wpforms-field-option-row-confirmation_placeholder input",function(e){var t=w(this),i=t.val(),t=t.parent().data("field-id");w("#wpforms-field-"+t).find(".secondary-input").attr("placeholder",i)}),g.on("change",".wpforms-field-option-row-label_hide input",function(e){var t=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+t).toggleClass("label_hide")}),g.on("change",".wpforms-field-option-row-sublabel_hide input",function(e){var t=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+t).toggleClass("sublabel_hide")}),g.on("change",".wpforms-field-option-row-format select",function(e){var t=w(this),i=t.val(),t=t.parent().data("field-id");w("#wpforms-field-"+t).find(".format-selected").removeClass().addClass("format-selected format-selected-"+i),w("#wpforms-field-option-"+t).find(".format-selected").removeClass().addClass("format-selected format-selected-"+i)}),g.on("change",".wpforms-field-option-row-scheme select",function(e){var t=w(this),i=t.val(),o=t.parent().data("field-id"),t=w("#wpforms-field-"+o);t.find(".wpforms-address-scheme").addClass("wpforms-hide"),t.find(".wpforms-address-scheme-"+i).removeClass("wpforms-hide"),0==t.find(".wpforms-address-scheme-"+i+" .wpforms-country").children().length?w("#wpforms-field-option-"+o).find(".wpforms-field-option-row-country").addClass("wpforms-hidden"):w("#wpforms-field-option-"+o).find(".wpforms-field-option-row-country").removeClass("wpforms-hidden")}),g.on("input",".wpforms-field-option .format-selected input.placeholder, .wpforms-field-option-address input.placeholder",function(e){var t=w(this),i=t.val(),o=t.closest(".wpforms-field-option-row"),t=o.data("field-id"),o=o.data("subfield");w("#wpforms-field-"+t).find(".wpforms-"+o+" input").attr("placeholder",i)}),g.on("change",".wpforms-field-option-row-date .type select",function(e){var t=w(this),i=t.val(),o=w(this).closest(".wpforms-field-option-row").data("field-id"),r="datepicker"===i?"wpforms-date-type-datepicker":"wpforms-date-type-dropdown",n="datepicker"===i?"wpforms-date-type-dropdown":"wpforms-date-type-datepicker";w("#wpforms-field-"+o).find(".wpforms-date").addClass(r).removeClass(n),w("#wpforms-field-option-"+o).addClass(r).removeClass(n);n=t.closest(".wpforms-field-option-group-advanced").find(".wpforms-field-option-row-date_limit_days, .wpforms-field-option-row-date_limit_days_options, .wpforms-field-option-row-date_disable_past_dates"),t=w("#wpforms-field-option-row-"+o+"-date_limit_days_options");"dropdown"===i?((i=w("#wpforms-field-option-"+o+"-date_format")).find("option:selected").hasClass("datepicker-only")&&i.prop("selectedIndex",0).trigger("change"),n.hide()):(n.show(),w("#wpforms-field-option-"+o+"-date_limit_days").is(":checked")?t.show():t.hide())}),g.on("change",".wpforms-field-option-row-date .format select",function(e){var t=w(this).val(),i=w(this).closest(".wpforms-field-option-row").data("field-id"),i=w("#wpforms-field-"+i);"m/d/Y"===t?(i.find(".wpforms-date-dropdown .first option").text(wpforms_builder.date_select_month),i.find(".wpforms-date-dropdown .second option").text(wpforms_builder.date_select_day)):"d/m/Y"===t&&(i.find(".wpforms-date-dropdown .first option").text(wpforms_builder.date_select_day),i.find(".wpforms-date-dropdown .second option").text(wpforms_builder.date_select_month))}),g.on("change",".wpforms-field-option-row-time .format select",function(e){for(var r="g:i A"===w(this).val()?12:24,n=w(this).closest(".wpforms-field-option-row").data("field-id"),a="",t=0;t{hh}'.replace(/{hh}/g,t<10?"0"+t:t);_.forEach(["start","end"],function(e){var t=g.find("#wpforms-field-option-"+n+"-time_limit_hours_"+e+"_hour"),i=g.find("#wpforms-field-option-"+n+"-time_limit_hours_"+e+"_ampm"),o=parseInt(t.val(),10),e=i.val();o=(o=24==r?"pm"===e?o+12:o:(e=12 i.fa").css("color",t)}),w(r).on("change",".wpforms-field-option-row-disclaimer_format input",function(){var e=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+e+" .description").toggleClass("disclaimer")}),g.on("change",".wpforms-field-option-row-limit_enabled input",function(e){m.updateTextFieldsLimitControls(w(e.target).closest(".wpforms-field-option-row-limit_enabled").data().fieldId,e.target.checked)}),g.on("change",".wpforms-field-option-row-password-strength input",function(e){m.updatePasswordStrengthControls(w(e.target).parents(".wpforms-field-option-row-password-strength").data().fieldId,e.target.checked)}),g.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){m.fieldFileUploadPreviewUpdate(e.target)}),m.numberSliderEvents(g),m.fieldDynamicChoiceToggleImageChoices(),g.on("change",".wpforms-field-option-row-show_price_after_labels input",function(e){var t=w(this).closest(".wpforms-field-option-group-basic").find(".wpforms-field-option-row-choices .choices-list");m.fieldChoiceUpdate(t.data("field-type"),t.data("field-id"))}),g.on("input",".wpforms-field-option-row-preview-notice textarea",m.updatePreviewNotice).on("change",".wpforms-field-option-row-preview-notice-enable input",m.toggleEntryPreviewNotice).on("wpformsFieldAdd",m.maybeLockEntryPreviewGroupOnAdd).on("wpformsFieldMove",m.maybeLockEntryPreviewGroupOnMove).on("click",".wpforms-entry-preview-block",m.entryPreviewBlockField),m.defaultStateEntryPreviewNotice()},fieldGroupToggle:function(e,t){var i=w(e),o=i.next(".wpforms-add-fields-buttons"),r=o.parent(),n=i.find("i"),e="wpforms_field_group_"+i.data("group");if("click"===t)return r.hasClass("wpforms-closed")?wpCookies.remove(e):wpCookies.set(e,"true",2592e3),n.toggleClass("wpforms-angle-right"),void o.stop().slideToggle("",function(){r.toggleClass("wpforms-closed")});"load"===t&&(o=i.find(".wpforms-add-fields-buttons"),n=i.find(".wpforms-add-fields-heading i"),e="wpforms_field_group_"+i.find(".wpforms-add-fields-heading").data("group"),"true"===wpCookies.get(e)&&(n.toggleClass("wpforms-angle-right"),o.hide(),i.toggleClass("wpforms-closed")))},updateDescription:function(e,t){e.hasClass("nl2br")&&(t=t.replace(/\n/g,"
")),e.html(t)},defaultStateEntryPreviewNotice:function(){w(".wpforms-field-option-row-preview-notice-enable input").each(function(){w(this).trigger("change")})},updatePreviewNotice:function(){var e=w(this),t=wpf.sanitizeHTML(e.val()).trim(),e=e.parent().data("field-id"),e=w("#wpforms-field-"+e).find(".wpforms-entry-preview-notice"),t=t||wpforms_builder.entry_preview_default_notice;m.updateDescription(e,t)},toggleEntryPreviewNotice:function(){var e=w(this),t=e.closest(".wpforms-field-option").data("field-id"),i=w("#wpforms-field-"+t),o=w("#wpforms-field-option-"+t+" .wpforms-field-option-row-preview-notice"),t=i.find(".wpforms-entry-preview-notice"),i=i.find(".wpforms-alert-info");if(e.is(":checked"))return i.hide(),t.show(),void o.show();o.hide(),t.hide(),i.show()},fieldDelete:function(e){var t=w("#wpforms-field-"+e),i=t.data("field-type");"pagebreak"===i&&t.hasClass("wpforms-field-entry-preview-not-deleted")?m.youCantRemovePageBreakFieldPopup():t.hasClass("no-delete")?m.youCantRemoveFieldPopup():m.confirmFieldDeletion(e,i)},youCantRemovePageBreakFieldPopup:function(){w.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"]}}})},youCantRemoveFieldPopup:function(){w.alert({title:wpforms_builder.field_locked,content:wpforms_builder.field_locked_msg,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}})},confirmFieldDeletion:function(e,t){var i={id:e,message:wpforms_builder.delete_confirm};g.trigger("wpformsBeforeFieldDeleteAlert",[i]),w.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(){m.fieldDeleteById(e,t)}},cancel:{text:wpforms_builder.cancel}}})},fieldDeleteById:function(e,t){w("#wpforms-field-"+e).fadeOut(400,function(){g.trigger("wpformsBeforeFieldDelete",[e,t]),w(this).remove(),w("#wpforms-field-option-"+e).remove(),w(".wpforms-field, .wpforms-title-desc").removeClass("active"),m.fieldTabToggle("add-fields"),w(".wpforms-field").length<1&&(f.$fieldOptions.append(f.$noFieldsOptions.clone()),f.$sortableFieldsWrap.append(f.$noFieldsPreview.clone()),g.find(".wpforms-field-submit").hide()),g.trigger("wpformsFieldDelete",[e,t])})},loadEntryPreviewFields:function(){var e=w(".wpforms-field-wrap .wpforms-field-entry-preview");e.length&&e.each(function(){m.lockEntryPreviewFieldsPosition(w(this).data("field-id"))})},fieldEntryPreviewDelete:function(e,t,i){"entry-preview"===i&&(t=(i=w("#wpforms-field-"+t)).prevAll(".wpforms-field-pagebreak"),i=i.nextAll(".wpforms-field-pagebreak").data("field-id"),i=w("#wpforms-field-option-"+i),t.removeClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),i.find(".wpforms-entry-preview-block").removeClass("wpforms-entry-preview-block"))},maybeLockEntryPreviewGroupOnMove:function(e,t){t.item.hasClass("wpforms-field-pagebreak")&&m.maybeLockEntryPreviewGroupOnAdd(e,t.item.data("field-id"),"pagebreak")},maybeLockEntryPreviewGroupOnAdd:function(e,t,i){if("pagebreak"===i){var o=w("#wpforms-field-"+t),r=w("#wpforms-field-option-"+t+" .wpforms-field-option-row-prev_toggle"),n=r.find("input"),a=o.prevAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first(),s=w("#wpforms-field-option-"+a.data("field-id")+" .wpforms-field-option-row-prev_toggle"),l=s.find("input"),i=o.nextAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first(),t=w("#wpforms-field-option-"+i.data("field-id")+" .wpforms-field-option-row-prev_toggle");if(a.hasClass("wpforms-field-entry-preview")||i.hasClass("wpforms-field-entry-preview")){if(a.hasClass("wpforms-field-entry-preview"))return n.attr("checked","checked").trigger("change"),r.addClass("wpforms-entry-preview-block"),void t.removeClass("wpforms-entry-preview-block");o.addClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),a.removeClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),a.prevAll(".wpforms-field-entry-preview,.wpforms-field-pagebreak").first().hasClass("wpforms-field-entry-preview")&&(l.attr("checked","checked").trigger("change"),s.addClass("wpforms-entry-preview-block"))}}},entryPreviewBlockField:function(e){e.preventDefault(),w.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,t){return!("entry-preview"!==e||t&&t.passed)},addEntryPreviewField:function(e,t){var i,o,r,n=w("#wpforms-add-fields-entry-preview");n.hasClass("wpforms-entry-preview-adding")||(r=w(".wpforms-field-wrap .wpforms-field"),i=t&&t.position?t.position:r.length,o=m.isEntryPreviewFieldRequiresPageBreakBefore(r,i),r=m.isEntryPreviewFieldRequiresPageBreakAfter(r,i),n.addClass("wpforms-entry-preview-adding"),(t=t||{}).passed=!0,o||r?o?m.addPageBreakAndEntryPreviewFields(t,i):m.addEntryPreviewAndPageBreakFields(t,i):m.fieldAdd("entry-preview",t).done(function(e){m.lockEntryPreviewFieldsPosition(e.data.field.id)}))},addEntryPreviewFieldAfterPageBreak:function(e){var t=setInterval(function(){2===w(".wpforms-field-wrap .wpforms-pagebreak-bottom, .wpforms-field-wrap .wpforms-pagebreak-top").length&&(m.fieldAdd("entry-preview",e).done(function(e){m.lockEntryPreviewFieldsPosition(e.data.field.id)}),clearInterval(t))},100)},addPageBreakAndEntryPreviewFields:function(t,i){var o=3<=w(".wpforms-field-wrap .wpforms-field-pagebreak").length;m.fieldAdd("pagebreak",{position:i}).done(function(e){t.position=o?i+1:i+2,m.addEntryPreviewFieldAfterPageBreak(t);e=w("#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(c){var m=w("#wpforms-field-"+c),u=m.data("field-type");m.hasClass("no-duplicate")?w.alert({title:wpforms_builder.field_locked,content:wpforms_builder.field_locked_msg,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.close,btnClass:"btn-confirm",keys:["enter"]}}}):w.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=w("#wpforms-field-option-"+c);wpf.restoreTooltips(e);var t=m.clone(),i=e.html(),a=w("#wpforms-field-id").val(),o=w("#wpforms-field-option-"+c+"-label").length?w("#wpforms-field-option-"+c+"-label"):w("#wpforms-field-option-"+c+"-name"),r=o.length?o.val()+" "+wpforms_builder.duplicate_copy:wpforms_builder.field+" #"+c+" "+wpforms_builder.duplicate_copy,n=Number(a)+1,s=new RegExp("ID #"+c,"g"),l=new RegExp("fields\\["+c+"\\]","g"),d=new RegExp('data-field-id="'+c+'"',"g"),f=new RegExp('data-reference="'+c+'"',"g"),o=new RegExp('\\b(id|for)="wpforms-(.*?)'+c+'(.*?)"',"ig");m.after(t),m.removeClass("active"),t.addClass("active").attr({id:"wpforms-field-"+a,"data-field-id":a}),i=(i=(i=(i=(i=i.replace(s,"ID #"+a)).replace(l,"fields["+a+"]")).replace(d,'data-field-id="'+a+'"')).replace(f,'data-reference="'+a+'"')).replace(o,function(e,t,i,o,r,n){return t+'="wpforms-'+i+a+o+'"'}),e.hide().after('
'+i+"
");var p=w("#wpforms-field-option-"+a);e.find(":input").each(function(e,t){var i=w(this),o=i.attr("name");if(!o)return"continue";var r=o.replace(l,"fields["+a+"]"),o=i.attr("type");"checkbox"===o||"radio"===o?i.is(":checked")?p.find('[name="'+r+'"]').prop("checked",!0).attr("checked","checked"):p.find('[name="'+r+'"]').prop("checked",!1).attr("checked",!1):i.is("select")?i.find("option:selected").length&&(o=i.find("option:selected").val(),p.find('[name="'+r+'"]').find('[value="'+o+'"]').prop("selected",!0)):""!==i.val()?p.find('[name="'+r+'"]').val(i.val()):i.hasClass("wpforms-money-input")&&p.find('[name="'+r+'"]').val(wpf.numberFormat("0",wpforms_builder.currency_decimals,wpforms_builder.currency_decimal,wpforms_builder.currency_thousands))}),w("#wpforms-field-option-"+a).find(".wpforms-field-option-hidden-id").val(a),w("#wpforms-field-id").val(n),w("#wpforms-field-option-"+a+"-label").val(r),"html"===u&&w("#wpforms-field-option-"+a+"-name").val(r),t.find(".label-title .text").text(r),g.trigger("wpformsFieldAdd",[a,u]),wpf.initTooltips(),w.post(wpforms_builder.ajax_url,{form_id:h.formID,nonce:wpforms_builder.nonce,action:"wpforms_builder_increase_next_field_id"})}},cancel:{text:wpforms_builder.cancel}}})},addEntryPreviewAndPageBreakFields:function(e,i){m.fieldAdd("entry-preview",e).done(function(e){var t=e.data.field.id;m.fieldAdd("pagebreak",{position:i+1}).done(function(){m.lockEntryPreviewFieldsPosition(t)})})},lockEntryPreviewFieldsPosition:function(e){var t=w("#wpforms-field-"+e),i=t.prevAll(".wpforms-field-pagebreak:not(.wpforms-pagebreak-bottom)").first(),o=t.nextAll(".wpforms-field-pagebreak").first().data("field-id"),e=w("#wpforms-field-option-"+o).find(".wpforms-field-option-row-prev_toggle"),o=e.find("input");t.addClass("wpforms-field-not-draggable"),i.addClass("wpforms-field-not-draggable wpforms-field-entry-preview-not-deleted"),o.attr("checked","checked").trigger("change"),e.addClass("wpforms-entry-preview-block"),w("#wpforms-add-fields-entry-preview").removeClass("wpforms-entry-preview-adding")},isEntryPreviewFieldRequiresPageBreakBefore:function(e,t){var t=e.slice(0,t).filter(".wpforms-field-pagebreak,.wpforms-field-entry-preview"),i=!0;return t.length&&w(t.get().reverse()).each(function(){var e=w(this);return!e.hasClass("wpforms-field-entry-preview")&&(e.hasClass("wpforms-field-pagebreak")&&!e.hasClass("wpforms-field-stick")?i=!1:void 0)}),i},isEntryPreviewFieldRequiresPageBreakAfter:function(e,t){var t=e.slice(t).filter(".wpforms-field-pagebreak,.wpforms-field-entry-preview"),i=Boolean(t.length);return t.length&&t.each(function(){var e=w(this);return!e.hasClass("wpforms-field-entry-preview")&&(e.hasClass("wpforms-field-pagebreak")?i=!1:void 0)}),i},fieldAdd:function(a,s){var e=w("#wpforms-add-fields-"+a);if(!(e.hasClass("upgrade-modal")||e.hasClass("education-modal")||e.hasClass("warning-modal")))if(-1===w.inArray(a,["captcha_hcaptcha","captcha_recaptcha","captcha_none"])){if(!m.isUncheckedEntryPreviewField(a,s)){s=w.extend({},{position:"bottom",placeholder:!1,scroll:!0,defaults:!1},s);e={action:"wpforms_new_field_"+a,id:h.formID,type:a,defaults:s.defaults,nonce:wpforms_builder.nonce};return w.post(wpforms_builder.ajax_url,e,function(e){var t,i,o,r,n;e.success?(t=w(".wpforms-field").length,i=w("#wpforms-panel-fields .wpforms-panel-content-wrap"),o=w(".wpforms-field").last(),n=w(e.data.preview),r=w(e.data.options),n.css("display","none"),s.placeholder&&s.placeholder.remove(),"bottom"===s.position?o.length&&o.hasClass("wpforms-field-stick")?(w(".wpforms-field-wrap").children(":eq("+(t-1)+")").before(n),w(".wpforms-field-options").children(":eq("+(t-1)+")").before(r)):(w(".wpforms-field-wrap").append(n),w(".wpforms-field-options").append(r)):"top"===s.position?(w(".wpforms-field-wrap").prepend(n),w(".wpforms-field-options").prepend(r)):s.position===t&&o.length&&o.hasClass("wpforms-field-stick")?(w(".wpforms-field-wrap").children(":eq("+(t-1)+")").before(n),w(".wpforms-field-options").children(":eq("+(t-1)+")").before(r)):w(".wpforms-field-wrap").find(".wpforms-field").eq(s.position).length?(w(".wpforms-field-wrap").find(".wpforms-field").eq(s.position).before(n),w(".wpforms-field-options").find(".wpforms-field-option").eq(s.position).before(r)):(w(".wpforms-field-wrap").append(n),w(".wpforms-field-options").append(r)),n.fadeIn(),g.find(".no-fields, .no-fields-preview").remove(),g.find(".wpforms-field-submit").show(),s.scroll&&s.position.length&&(r=i.scrollTop(),n=n.position().top,i.animate({scrollTop:"bottom"===s.position?r .wpforms-field:not(.wpforms-field-stick):not(.no-fields-preview)",axis:"y",delay:100,opacity:.75,cursor:"move",start:function(e,t){i=t.item.index(),r=a[0].children[i]},stop:function(e,t){o=t.item.index(),n=a[0].children[o],ir.top&&o').html(i).css("width",t).attr("data-original-width",t).attr("data-field-type",e)},revert:"invalid",cancel:!1,scroll:!1,opacity:.75,containment:"document"})},fieldChoiceAdd:function(e,t){e.preventDefault();var i=w(t),o=i.parent(),r=o.find("input.default").is(":checked"),n=i.closest(".wpforms-field-option-row-choices").data("field-id"),e=o.parent().attr("data-next-id"),t=o.parent().data("field-type"),i=o.clone().insertAfter(o);i.attr("data-key",e),i.find("input.label").val("").attr("name","fields["+n+"][choices]["+e+"][label]"),i.find("input.value").val("").attr("name","fields["+n+"][choices]["+e+"][value]"),i.find("input.source").val("").attr("name","fields["+n+"][choices]["+e+"][image]"),i.find("input.default").attr("name","fields["+n+"][choices]["+e+"][default]").prop("checked",!1),i.find(".preview").empty(),i.find(".wpforms-image-upload-add").show(),i.find(".wpforms-money-input").trigger("focusout"),!0===r&&o.find("input.default").prop("checked",!0),e++,o.parent().attr("data-next-id",e),g.trigger("wpformsFieldChoiceAdd"),m.fieldChoiceUpdate(t,n)},fieldChoiceDelete:function(e,t){e.preventDefault();var i,o=w(t),r=o.parent().parent(),e=r.find("li").length,t={id:r.data("field-id"),choiceId:o.closest("li").data("key"),message:""+wpforms_builder.delete_choice_confirm+"",trigger:!1};g.trigger("wpformsBeforeFieldDeleteAlert",[t]),1===e?m.fieldChoiceDeleteAlert():(i=function(){o.parent().remove(),m.fieldChoiceUpdate(r.data("field-type"),r.data("field-id")),g.trigger("wpformsFieldChoiceDelete")},t.trigger?w.confirm({title:!1,content:t.message,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){i()}},cancel:{text:wpforms_builder.cancel}}}):i())},fieldChoiceDeleteAlert:function(){w.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(o,e){w(e=void 0!==e?e:".wpforms-field-option-"+o+" .wpforms-field-option-row-choices ul").sortable({items:"li",axis:"y",delay:100,opacity:.6,handle:".move",stop:function(e,t){var i=t.item.parent().data("field-id");m.fieldChoiceUpdate(o,i),g.trigger("wpformsFieldChoiceMove",t)},update:function(e,t){}})},fieldChoiceLabel:function(e,t){var i=void 0!==e.settings.choices[t].label&&0!==e.settings.choices[t].label.length?wpf.sanitizeHTML(e.settings.choices[t].label):wpforms_builder.choice_empty_label_tpl.replace("{number}",t);return e.settings.show_price_after_labels&&(i+=" - "+wpf.amountFormatCurrency(e.settings.choices[t].value)),i},fieldChoiceUpdate:function(n,e){var a=w("#wpforms-field-"+e+" .primary-input");if("radio"===n||"checkbox"===n||"payment-multiple"===n||"payment-checkbox"===n){var t=wpf.getField(e),i=wpf.getChoicesOrder(e),o={},r=i.slice(0,20),s=wp.template("wpforms-field-preview-checkbox-radio-payment-multiple"),l={settings:t,order:r,type:"radio"};return r.forEach(function(e){o[e]=t.choices[e]}),t.choices=o,"checkbox"!==n&&"payment-checkbox"!==n||(l.type="checkbox"),w("#wpforms-field-"+e).find("ul.primary-input").replaceWith(s(l)),void m.firstNChoicesAlert(e,i.length)}var d=m.dropdownField.helpers.isModernSelect(a),f="";"select"===(n="payment-select"===(n="payment-checkbox"===(n="payment-multiple"===n?"radio":n)?"checkbox":n)?"select":n)?(f='',a.find("option").not(".placeholder").remove()):"radio"!==n&&"checkbox"!==n&&"gdpr-checkbox"!==n||(n="gdpr-checkbox"===n?"checkbox":n,a.find("li").remove(),f='
  • {label}
  • ');var r=w("#wpforms-field-option-row-"+e+"-choices .choices-list"),s=r.find("li").slice(0,20),l=!!r.find("input.default:checked").length,p=[],c=w("#wpforms-field-option-"+e+"-show_price_after_labels").prop("checked");s.each(function(){var e,t=w(this),i=wpf.sanitizeHTML(t.find("input.label").val().trim()),o=t.find("input.value").val(),r=t.find("input.default").is(":checked"),t=t.data("key"),i=""!==i?i:wpforms_builder.choice_empty_label_tpl.replace("{number}",t);if(i+=c&&o?" - "+wpf.amountFormatCurrency(o):"",d?p.push({value:i,label:i}):(e=w(f.replace(/{label}/g,i)),a.append(e)),!0===r)switch(n){case"select":d?p[p.length-1].selected=!0:e.prop("selected","true");break;case"radio":case"checkbox":e.find("input").prop("checked","true")}}),d&&(i=a.prop("multiple")?"input.choices__input":".choices__inner .choices__placeholder",r=m.dropdownField.helpers.getInstance(a),s=w("#wpforms-field-option-"+e+"-dynamic_choices").val(),r.removeActiveItems(),r.setChoices(p,"value","label",!0),m.dropdownField.helpers.update(e,s),a.closest(".choices").find(i).toggleClass("wpforms-hidden",l))},fieldChoiceBulkAddToggle:function(e){var t=w(e),e=t.closest("label");if(t.hasClass("bulk-add-showing")){var i=e.next(".bulk-add-display");i.slideUp(400,function(){i.remove()}),t.find("span").text(wpforms_builder.bulk_add_show)}else{var o,r='
    ';for(o in r+='

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

    ",r+="",r+='',r+='",e.after(r+="
    "),e.next(".bulk-add-display").slideDown(400,function(){w(this).find("textarea").focus()}),t.find("span").text(wpforms_builder.bulk_add_hide)}t.toggleClass("bulk-add-showing")},fieldChoiceBulkAddInsert:function(e){var t,i,o,r=w(e),n=r.closest(".wpforms-field-option-row"),a=n.find("textarea"),s=n.find(".choices-list"),l=s.find("li:first-of-type").clone().wrap("
    ").parent(),d=n.data("field-id"),e=s.data("field-type"),f=Number(s.attr("data-next-id")),p=a.val().split("\n"),c="";for(i in r.prop("disabled",!0).html(r.html()+" "+h.spinner),l.find("input.value,input.label").attr("value",""),t=l.html(),p)p.hasOwnProperty(i)&&(o=wpf.sanitizeHTML(p[i]).trim().replace(/"/g,"""),c+=t.replace(/\[choices\]\[(\d+)\]/g,"[choices]["+f+"]").replace(/data-key="(\d+)"/g,'data-key="'+f+'"').replace(/value="" class="label"/g,'value="'+o+'" class="label"').replace(/class="label" type="text" value=""/g,'class="label" type="text" value="'+o+'"'),f++);s.attr("data-next-id",f).append(c),m.fieldChoiceUpdate(e,d),g.trigger("wpformsFieldChoiceAdd"),m.fieldChoiceBulkAddToggle(n.find(".toggle-bulk-add-display"))},fieldTabToggle:function(e){var t;w(".wpforms-tab a").removeClass("active"),w(".wpforms-field, .wpforms-title-desc").removeClass("active"),"add-fields"===e?(w("#add-fields a").addClass("active"),w(".wpforms-field-options").hide(),w(".wpforms-add-fields").show()):(w("#field-options a").addClass("active"),"field-options"===e?((t=w(".wpforms-field").first()).addClass("active"),e=t.data("field-id")):w("#wpforms-field-"+e).addClass("active"),w(".wpforms-field-option").hide(),w("#wpforms-field-option-"+e).show(),w(".wpforms-add-fields").hide(),w(".wpforms-field-options").show())},fieldPagebreakAdd:function(e,t,i){"pagebreak"===i&&(h.pagebreakTop?h.pagebreakBottom||(h.pagebreakBottom=!0,m.fieldAdd("pagebreak",{position:"bottom",scroll:!1,defaults:{position:"bottom"}}).done(function(e){h.pagebreakBottom=e.data.field.id;var t=w("#wpforms-field-"+e.data.field.id);w("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-bottom"),t.addClass("wpforms-field-stick wpforms-pagebreak-bottom")})):(h.pagebreakTop=!0,m.fieldAdd("pagebreak",{position:"top",scroll:!1,defaults:{position:"top",nav_align:"left"}}).done(function(e){h.pagebreakTop=e.data.field.id;var t=w("#wpforms-field-"+e.data.field.id);w("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-top"),t.addClass("wpforms-field-stick wpforms-pagebreak-top")})))},fieldPagebreakDelete:function(e,t,i){var o,r,n;"pagebreak"===i&&(w(".wpforms-field-pagebreak").not(".wpforms-pagebreak-top, .wpforms-pagebreak-bottom").length||(r=(o=(n=w(".wpforms-preview-wrap")).find(".wpforms-pagebreak-top")).data("field-id"),n=(i=n.find(".wpforms-pagebreak-bottom")).data("field-id"),o.remove(),w("#wpforms-field-option-"+r).remove(),h.pagebreakTop=!1,i.remove(),w("#wpforms-field-option-"+n).remove(),h.pagebreakBottom=!1))},fieldPageBreakInitDisplayPrevious:function(e){var t=e.data("field-id"),i=w("#wpforms-field-option-row-"+t+"-prev_toggle"),o=w("#wpforms-field-option-row-"+t+"-prev"),t=e.find(".wpforms-pagebreak-prev");0":">",p+=d[l].label+"",f.append(p)}else for(l in n="radio",a.hasClass("wpforms-field-checkbox")&&(n="checkbox"),f.empty(),d)p='
  • ":">",p+=d[l].label+"
  • ",f.append(p);s.find("ul").removeClass("wpforms-hidden"),s.find(".wpforms-alert").addClass("wpforms-hidden"),wpf.fieldOptionLoading(i,!0)}else{e.addClass("wpforms-hidden"),s.find(".toggle-bulk-add-display").addClass("wpforms-hidden");s={type:o,field_id:r,action:"wpforms_builder_dynamic_choices",nonce:wpforms_builder.nonce};w.post(wpforms_builder.ajax_url,s,function(e){e.success?i.after(e.data.markup):console.log(e),wpf.fieldOptionLoading(i,!0),wpf.initTooltips(),w("#wpforms-field-option-"+r+"-dynamic_"+o).find("option:first").prop("selected",!0),w("#wpforms-field-option-"+r+"-dynamic_"+o).trigger("change")}).fail(function(e,t,i){console.log(e.responseText)})}},fieldDynamicChoiceSource:function(e){var t=w(e),i=t.parent(),o=t.val(),r=i.data("field-id"),e=w("#wpforms-builder-form").data("id"),n=w("#wpforms-field-option-row-"+r+"-choices"),a=w("#wpforms-field-"+r),t=w("#wpforms-field-option-"+r+"-dynamic_choices option:selected").val(),s=20;wpf.fieldOptionLoading(i);e={type:t,source:o,field_id:r,form_id:e,action:"wpforms_builder_dynamic_source",nonce:wpforms_builder.nonce};w.post(wpforms_builder.ajax_url,e,function(e){return e.success?(n.find(".dynamic-name").text(e.data.source_name),n.find(".dynamic-type").text(e.data.type_name),n.find("ul").addClass("wpforms-hidden"),n.find(".wpforms-alert").removeClass("wpforms-hidden"),m.fieldDynamicChoiceSourceItems(a,e.data.items),a.hasClass("wpforms-field-select")&&(s=200),Number(e.data.total)>s&&(t=(t=(t=(t=(t=wpforms_builder.dynamic_choice_limit).replace("{source}",e.data.source_name)).replace("{type}",e.data.type_name)).replace("{limit}",s)).replace("{total}",e.data.total),w.alert({title:wpforms_builder.heads_up,content:t,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})),m.firstNChoicesAlert(r,e.data.total)):console.log(e),void wpf.fieldOptionLoading(i,!0);var t}).fail(function(e,t,i){console.log(e.responseText)})},fieldDynamicChoiceSourceItems:function(e,t){var i=e.find(".primary-input"),o=0;if(e.hasClass("wpforms-field-select"))m.dropdownField.helpers.isModernSelect(i)?m.fieldDynamicChoiceSourceForModernSelect(i,t):m.fieldDynamicChoiceSourceForClassicSelect(i,t);else{var r="radio";for(o in e.hasClass("wpforms-field-checkbox")&&(r="checkbox"),i.empty(),t)i.append('
  • '+wpf.sanitizeHTML(t[o])+"
  • ")}},fieldDynamicChoiceSourceForModernSelect:function(e,t){var i=m.dropdownField.helpers.getInstance(e),o=e.closest(".wpforms-field").data().fieldId;i.destroy(),m.dropdownField.helpers.updatePlaceholderChoice(i,o),m.fieldDynamicChoiceSourceForClassicSelect(e,t),m.dropdownField.events.choicesInit(e)},fieldDynamicChoiceSourceForClassicSelect:function(e,t){var i=0,o=t.length;for(e.find("option").not(".placeholder").remove();i'+r+"")}},fieldDynamicChoiceToggleImageChoices:function(){w("#wpforms-builder .wpforms-field-options .wpforms-field-option").each(function(e,t){var i=w(t),t=i.find(".wpforms-field-option-row-dynamic_choices select");void 0!==t.val()&&""!==t.val()?(i.find(".wpforms-field-option-row-choices_images").hide(),i.find(".wpforms-field-option-row-choices_images_style").hide()):(i.find(".wpforms-field-option-row-choices_images").show(),i.find(".wpforms-field-option-row-choices_images_style").show())})},firstNChoicesAlert:function(e,t){var i=wp.template("wpforms-choices-limit-message"),o={total:t},e=w("#wpforms-field-"+e);e.hasClass("wpforms-field-select")||(e.find(".wpforms-alert-dynamic").remove(),20",n+='
    ',i){var a,s=i[r];for(a in n+='
    ',s)n+='';n+="
    "}e.after(n+="
    "),e.next(".layout-selector-display").slideDown(),t.find("span").text(wpforms_builder.layout_selector_hide)}t.toggleClass("layout-selector-showing")},fieldLayoutSelectorLayout:function(e){e=w(e),e.closest("label");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 t=w(e),i=t.closest(".layout-selector-display"),o=i.parent(),e=o.find("label"),o=o.find("input[type=text]"),t=t.data("classes");o.val()&&(t=" "+t),o.insertAtCaret(t),i.slideUp(400,function(){i.remove()}),e.find(".toggle-layout-selector-display").removeClass("layout-selector-showing"),e.find(".toggle-layout-selector-display span").text(wpforms_builder.layout_selector_show)},bindUIActionsSettings:function(){g.on("click",".wpforms-title-desc, .wpforms-field-submit-button, .wpforms-center-form-name",function(e){e.preventDefault(),m.panelSwitch("settings"),(w(this).hasClass("wpforms-center-form-name")||w(this).hasClass("wpforms-title-desc"))&&setTimeout(function(){w("#wpforms-panel-field-settings-form_title").focus()},300)}),g.on("click",".wpforms-field-pagebreak-last button",function(e){e.preventDefault(),m.panelSwitch("settings"),w("#wpforms-panel-field-settings-pagebreak_prev").focus()}),g.on("input","#wpforms-panel-field-settings-pagebreak_prev",function(){w(".wpforms-field-pagebreak-last button").text(w(this).val())}),g.on("input","#wpforms-panel-field-settings-form_title, #wpforms-setup-name",function(){var e=w.trim(w(this).val());w(".wpforms-preview .wpforms-form-name").text(e),w(".wpforms-center-form-name.wpforms-form-name").text(e),m.trimFormTitle()}),g.on("input","#wpforms-panel-field-settings-form_desc",function(){w(".wpforms-form-desc").text(w(this).val())}),g.on("input","#wpforms-panel-field-settings-submit_text",function(){w(".wpforms-field-submit input[type=submit]").val(w(this).val())}),g.on("change","#wpforms-panel-field-settings-recaptcha",function(){m.captchaToggle()}),g.on("change",".wpforms-panel-field-confirmations-type",function(){m.confirmationFieldsToggle(w(this))}),g.on("change",".wpforms-panel-field-confirmations-message_entry_preview",m.confirmationEntryPreviewToggle),g.on("change","#wpforms-panel-field-settings-notification_enable",function(){m.notificationToggle()}),g.on("click",".wpforms-builder-settings-block-add",function(e){e.preventDefault(),wpforms_builder.pro&&m.settingsBlockAdd(w(this))}),g.on("click",".wpforms-builder-settings-block-edit",function(e){e.preventDefault();e=w(this);e.parents(".wpforms-builder-settings-block-header").find(".wpforms-builder-settings-block-name").hasClass("editing")?m.settingsBlockNameEditingHide(e):m.settingsBlockNameEditingShow(e)}),g.on("blur",".wpforms-builder-settings-block-name-edit input",function(e){w(e.relatedTarget).hasClass("wpforms-builder-settings-block-edit")||m.settingsBlockNameEditingHide(w(this))}),g.on("keypress",".wpforms-builder-settings-block-name-edit input",function(e){13===e.keyCode&&(m.settingsBlockNameEditingHide(w(this)),e.preventDefault())}),g.on("click",".wpforms-builder-settings-block-clone",function(e){e.preventDefault(),m.settingsBlockPanelClone(w(this))}),g.on("click",".wpforms-builder-settings-block-toggle",function(e){e.preventDefault(),m.settingsBlockPanelToggle(w(this))}),g.on("click",".wpforms-builder-settings-block-delete",function(e){e.preventDefault(),m.settingsBlockDelete(w(this))})},captchaToggle:function(){var e=g.find(".wpforms-field-recaptcha"),t=w("#wpforms-panel-field-settings-recaptcha"),i=(i=t.data("provider"))||"recaptcha";e.length&&(t.is(":checked")?e.show().toggleClass("is-recaptcha","recaptcha"===i):e.hide())},confirmationsSetup:function(){w(".wpforms-panel-field-confirmations-type").each(function(){m.confirmationFieldsToggle(w(this))}),w(".wpforms-panel-field-confirmations-message").each(function(){"undefined"!=typeof tinymce&&void 0!==wp.editor&&wp.editor.initialize(w(this).attr("id"),h.tinymceDefaults)}),g.on("focusout",".wpforms-panel-field-confirmations-redirect",function(e){var t=w(this),i=t.val().trim();t.val(i),wpf.isURL(i)||""===i||w.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.redirect_url_field_error,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){t.focus()}}}})})},confirmationFieldsToggle:function(e){var t,i;e.length&&(t=e.val(),(i=e.closest(".wpforms-builder-settings-block-content")).find(".wpforms-panel-field").not(e.parent()).not(".wpforms-conditionals-enable-toggle").hide(),i.find(".wpforms-panel-field-confirmations-"+t).closest(".wpforms-panel-field").show(),"message"===t&&(i.find(".wpforms-panel-field-confirmations-message_scroll").closest(".wpforms-panel-field").show(),i.find(".wpforms-panel-field-confirmations-message_entry_preview").trigger("change").closest(".wpforms-panel-field").show()))},confirmationEntryPreviewToggle:function(){var e=w(this),t=e.closest(".wpforms-builder-settings-block-content").find(".wpforms-panel-field-confirmations-message_entry_preview_style").parent();e.is(":checked")?t.show():t.hide()},notificationToggle:function(){var e=w("#wpforms-panel-field-settings-notification_enable"),t=e.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block"),e=e.is(":checked");w(".wpforms-notifications-add").toggleClass("wpforms-hidden",!e),e?t.show():t.hide()},notificationsByStatusAlerts:function(){g.on("change",".wpforms-panel-content-section-notifications .wpforms-notification-by-status-alert",function(e){var t,i,o=w(this);o.prop("checked")&&(i="",i=0===(t=w(".wpforms-radio-group-"+o.attr("data-radio-group")+":checked:not(#"+o.attr("id")+")")).length?(i=wpforms_builder.notification_by_status_enable_alert).replace(/%s/g,o.data("provider-title")):(i=(i=wpforms_builder.notification_by_status_switch_alert).replace(/%2\$s/g,t.data("provider-title"))).replace(/%1\$s/g,o.data("provider-title")),w.confirm({title:wpforms_builder.heads_up,content:i,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm"}}}))})},settingsBlockAdd:function(s){var l=Number(s.attr("data-next-id")),d=s.closest(".wpforms-panel-content-section").data("panel"),f=s.data("block-type"),e=wpforms_builder[f+"_prompt"],t='',i='

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

    ",o=w.confirm({container:g,title:!1,content:e+t+i,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e=w.trim(this.$content.find("input#settings-block-name").val()),t=this.$content.find(".error");if(""===e)return t.show(),!1;var i=s.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block").first();wpf.restoreTooltips(i);var o=i.clone(),t=i.data("block-id");o.attr("data-block-id",l),o.find(".wpforms-builder-settings-block-header span").text(e),o.find("input, textarea, select").not(".from-name input").not(".from-email input").each(function(e,t){var i=w(this);i.attr("name")&&(i.val("").attr("name",i.attr("name").replace(/\[(\d+)\]/,"["+l+"]")),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+"-",a=n+t;o.find('[id^="'+a+'"], [for^="'+a+'"]').each(function(e,t){var i=w(this),o="LABEL"===i.prop("tagName")?"for":"id",r=i.attr(o).replace(new RegExp(a,"g"),n+l);i.attr(o,r)});var r=t+"-notification-by-status";o.find('[data-radio-group="'+r+'"]').each(function(e,t){w(this).removeClass("wpforms-radio-group-"+r).addClass("wpforms-radio-group-"+l+"-notification-by-status").attr("data-radio-group",l+"-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:l})));e=o.find(".wpforms-conditional-block");e.length&&"undefined"!=typeof WPForms&&e.html(WPForms.Admin.Builder.Templates.get("wpforms-builder-conditional-logic-toggle-field")({id:l,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")}));e=o.find(".wpforms-field-map-table");e.length&&e.each(function(e,t){var i=w(t);i.find("tr:not(:first-child)").remove();var o=i.find(".key input"),t=i.find(".field select"),i=t.data("name");o.attr("value",""),t.attr("name","").attr("data-name",i.replace(/\[(\d+)\]/,"["+l+"]"))}),o=(o=o.wrap("
    ").parent().html()).replace(/\[conditionals\]\[(\d+)\]\[(\d+)\]/g,"[conditionals][0][0]"),i.before(o);i=i.prev();"confirmation"===f&&m.confirmationFieldsToggle(w(".wpforms-panel-field-confirmations-type").first()),"undefined"!=typeof tinymce&&void 0!==wp.editor&&"confirmation"===f&&wp.editor.initialize("wpforms-panel-field-confirmations-message-"+l,h.tinymceDefaults),wpf.initTooltips(),g.trigger("wpformsSettingsBlockAdded",[i]),s.attr("data-next-id",l+1)}},cancel:{text:wpforms_builder.cancel}}});g.on("keypress","#settings-block-name",function(e){13===e.keyCode&&w(o.buttons.confirm.el).trigger("click")})},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 t=e.parents(".wpforms-builder-settings-block-header"),i=t.find(".wpforms-builder-settings-block-name"),o=t.find(".wpforms-builder-settings-block-name-edit"),t=o.find("input").val().trim(),e=e.closest(".wpforms-builder-settings-block").data("block-type");t.length||(t=wpforms_builder[e+"_def_name"]),o.find("input").val(t),i.text(t),i.removeClass("editing").show(),o.removeClass("active")},settingsBlockPanelClone:function(e){var t=e.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block-add"),i=e.closest(".wpforms-builder-settings-block"),o=i.find(".wpforms-builder-settings-block-content"),r=parseInt(t.attr("data-next-id"),10),n=i.data("block-type"),e=i.find(".wpforms-builder-settings-block-name").text().trim()+wpforms_builder[n+"_clone"],o=o.is(":hidden");wpf.restoreTooltips(i);var a=i.clone(!1,!0);m.settingsBlockUpdateState(o,r,n),a.data("block-id",r),a.find(".wpforms-builder-settings-block-header span").text(e),a.find(".wpforms-builder-settings-block-header input").val(e),a.removeClass("wpforms-builder-settings-block-default"),t.attr("data-next-id",r+1),a.find("input, textarea, select").each(function(){var e=w(this);e.attr("name")&&e.attr("name",e.attr("name").replace(/\[(\d+)\]/,"["+r+"]")),e.data("name")&&e.data("name",e.data("name").replace(/\[(\d+)\]/,"["+r+"]")),e.attr("class")&&e.attr("class",e.attr("class").replace(/-(\d+)/,"-"+r)),e.attr("data-radio-group")&&e.attr("data-radio-group",e.attr("data-radio-group").replace(/(\d+)-/,r+"-"))}),a.find("*").each(function(){var e=w(this);e.attr("id")&&e.attr("id",e.attr("id").replace(/-(\d+)/,"-"+r)),e.attr("for")&&e.attr("for",e.attr("for").replace(/-(\d+)-/,"-"+r+"-")),e.data("input-name")&&e.data("input-name",e.data("input-name").replace(/\[(\d+)\]/,"["+r+"]"))}),i.find("select").each(function(){var e=w(this).attr("name"),t=w(this).attr("name").replace(/\[(\d+)\]/,"["+r+"]");a.find('select[name="'+t+'"]').val(w(this).attr("name",e).val())}),a.css("display","none").insertBefore(i).show("fast",function(){wpf.initTooltips()})},settingsBlockPanelToggle:function(e){var t=e.closest(".wpforms-builder-settings-block"),i=t.data("block-id"),o=t.data("block-type"),r=t.find(".wpforms-builder-settings-block-content"),n=r.is(":visible");r.stop().slideToggle({duration:400,start:function(){m.settingsBlockUpdateState(n,i,o)},always:function(){r.is(":visible")?e.html(''):e.html('')}})},settingsBlockDelete:function(e){var t=e.closest(".wpforms-panel-content-section"),i=e.closest(".wpforms-builder-settings-block"),o=i.data("block-type");t.find(".wpforms-builder-settings-block").length<2||w.confirm({title:!1,content:wpforms_builder[o+"_delete"],icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e=i.data("block-id"),t=i.data("block-type");w.post(wpforms_builder.ajax_url,{action:"wpforms_builder_settings_block_state_remove",nonce:wpforms_builder.nonce,block_id:e,block_type:t,form_id:h.formID}),i.remove(),g.trigger("wpformsSettingsBlockDeleted",[o,e])}},cancel:{text:wpforms_builder.cancel}}})},settingsBlockUpdateState:function(e,t,i){w.post(wpforms_builder.ajax_url,{action:"wpforms_builder_settings_block_state_save",state:e?"closed":"opened",form_id:h.formID,block_id:t,block_type:i,nonce:wpforms_builder.nonce})},bindUIActionsSaveExit:function(){g.on("click","#wpforms-embed",function(e){e.preventDefault(),w(this).hasClass("wpforms-disabled")||WPFormsFormEmbedWizard.openPopup()}),g.on("click","#wpforms-save",function(e){e.preventDefault(),m.formSave(!1)}),g.on("click","#wpforms-exit",function(e){e.preventDefault(),m.formExit()}),g.on("wpformsSaved",function(e,t){wpf.removeQueryParam("newform")})},formSave:function(t){var e=w("#wpforms-save"),i=e.find("i.fa-check"),o=e.find("i.wpforms-loading-spinner"),r=e.find("span"),n=r.text();"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave(),r.text(wpforms_builder.saving),i.addClass("wpforms-hidden"),o.removeClass("wpforms-hidden");e={action:"wpforms_save_form",data:JSON.stringify(w("#wpforms-builder-form").serializeArray()),id:h.formID,nonce:wpforms_builder.nonce};return w.post(wpforms_builder.ajax_url,e,function(e){e.success?(wpf.savedState=wpf.getFormState("#wpforms-builder-form"),wpf.initialSave=!1,g.trigger("wpformsSaved",e.data),!0===t&&m.isBuilderInPopup()?m.builderInPopupClose("saved"):!0===t&&(a.location.href=wpforms_builder.exit_url)):(wpf.debug(e),m.formSaveError(e.data))}).fail(function(e,t,i){wpf.debug(e),m.formSaveError()}).always(function(){r.text(n),o.addClass("wpforms-hidden"),i.removeClass("wpforms-hidden")})},formSaveError:function(e){wpf.empty(e)&&(e=wpforms_builder.error_save_form),w.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(){m.isBuilderInPopup()&&m.formIsSaved()?m.builderInPopupClose("saved"):m.formIsSaved()?a.location.href=wpforms_builder.exit_url:w.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(){m.formSave(!0)}},cancel:{text:wpforms_builder.exit,action:function(){t=!1,m.isBuilderInPopup()?m.builderInPopupClose("canceled"):a.location.href=wpforms_builder.exit_url}}}})},setCloseConfirmation:function(e){t=!!e},formIsSaved:function(){return wpf.savedState==wpf.getFormState("#wpforms-builder-form")},isBuilderInPopup:function(){return a.self!==a.parent&&"wpforms-builder-iframe"===a.self.frameElement.id},builderInPopupClose:function(e){var t=a.parent.jQuery("#wpforms-builder-elementor-popup");t.find("#wpforms-builder-iframe").attr("src","about:blank"),t.fadeOut(),t.trigger("wpformsBuilderInPopupClose",[e,h.formID])},bindUIActionsGeneral:function(){g.on("click",".toggle-smart-tag-display",m.smartTagToggle),g.on("click",".smart-tags-list-display a",m.smartTagInsert),g.on("click",".wpforms-panel-fields-group.unfoldable .wpforms-panel-fields-group-title",m.toggleUnfoldableGroup),g.on("input",".wpforms-field-map-table .key-source",function(){var e=w(this).val(),t=w(this).parent().parent().find(".key-destination"),i=t.data("name");e&&t.attr("name",i.replace("{source}",e.replace(/[^0-9a-zA-Z_-]/gi,"")))}),g.on("click",".wpforms-field-map-table .remove",function(e){e.preventDefault(),m.fieldMapTableDeleteRow(e,w(this))}),g.on("click",".wpforms-field-map-table .add",function(e){e.preventDefault(),m.fieldMapTableAddRow(e,w(this))}),w(r).on("wpformsFieldUpdate",m.fieldMapSelect),g.on("input",".wpforms-money-input",function(e){var t=w(this),i=t.val(),o=t[0].selectionStart,r=t[0].selectionEnd;t.val(i.replace(/[^0-9.,]/g,"")),t[0].setSelectionRange(o,r)}),g.on("focusout",".wpforms-money-input",function(e){var t=w(this),i=t.val();if(!i)return i;i=wpf.amountSanitize(i),i=wpf.amountFormat(i);t.val(i)}),g.on("change",".wpforms-panel-field-toggle",function(){var e=w(this);e.prop("disabled")||(e.prop("disabled",!0),m.toggleOptionsGroup(e))}),g.on("change","#wpforms-panel-field-stripe-enable, #wpforms-panel-field-paypal_standard-enable, #wpforms-panel-field-authorize_net-enable, #wpforms-panel-field-square-enable",function(e){var t=w(this),i=t.attr("id").replace("wpforms-panel-field-","").replace("-enable",""),o=w('.wpforms-panel-content-section-notifications [id*="-'+i+'-wrap"]');t.prop("checked")?w("#wpforms-panel-field-settings-disable_entries").prop("checked")?(w.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"]}}}),t.prop("checked",!1)):o.removeClass("wpforms-hidden"):(o.addClass("wpforms-hidden"),o.find('input[id*="-'+i+'"]').prop("checked",!1))}),g.on("change","#wpforms-panel-field-settings-disable_entries",function(e){var t=w(this);t.prop("checked")&&(w("#wpforms-panel-field-stripe-enable").prop("checked")||w("#wpforms-panel-field-paypal_standard-enable").prop("checked")||w("#wpforms-panel-field-authorize_net-enable").prop("checked")||w("#wpforms-panel-field-square-enable").prop("checked")?(w.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"]}}}),t.prop("checked",!1)):w.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"]}}}))}),g.on("click",".wpforms-image-upload-add",function(e){e.preventDefault();var t=w(this),i=t.parent(),o=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}});o.on("select",function(){var e=o.state().get("selection").first().toJSON();i.find(".source").val(e.url),i.find(".preview").empty(),i.find(".preview").prepend(''),"hide"===t.data("after-upload")&&t.hide(),g.trigger("wpformsImageUploadAdd",[t,i])}),o.open()}),g.on("click",".wpforms-image-upload-remove",function(e){e.preventDefault();e=w(this).parent().parent();e.find(".preview").empty(),e.find(".wpforms-image-upload-add").show(),e.find(".source").val(""),g.trigger("wpformsImageUploadRemove",[w(this),e])}),g.on("blur",".wpforms-notification .wpforms-panel-field-text input",function(){m.validateEmailSmartTags(w(this))}),g.on("blur",".wpforms-notification .wpforms-panel-field-textarea textarea",function(){m.validateEmailSmartTags(w(this))}),g.on("click",".wpforms-fullscreen-notice-go-back",m.exitBack),w("#wpforms-builder-license-alert .close").on("click",m.exitBack)},toggleOptionsGroup:function(e){function t(){e.prop("disabled",!1)}var i=e.attr("name"),o=e.attr("type"),r="",i=w('.wpforms-panel-field-toggle-body[data-toggle="'+i+'"]');0!==i.length?(r="checkbox"!==o&&"radio"!==o||e.prop("checked")?e.val():"0",i.each(function(){var e=w(this);e.attr("data-toggle-value").toString()===r.toString()?e.slideDown("",t):e.slideUp("",t)})):t()},toggleAllOptionGroups:function(e){(e=e||g||w("#wpforms-builder")||w("body"))&&e.find(".wpforms-panel-field-toggle").each(function(){var e=w(this);e.prop("disabled",!0),m.toggleOptionsGroup(e)})},toggleUnfoldableGroup:function(e){e.preventDefault();var t=w(e.target).closest(".wpforms-panel-fields-group"),i=t.find(".wpforms-panel-fields-group-inner"),e="wpforms_fields_group_"+t.data("group");t.hasClass("opened")?(wpCookies.remove(e),t.removeClass("opened"),i.stop().slideUp()):(wpCookies.set(e,"true",2592e3),t.addClass("opened"),i.stop().slideDown())},smartTagToggle:function(e){e.preventDefault();var t=w(this),e=t.closest(".wpforms-panel-field,.wpforms-field-option-row");e.hasClass("smart-tags-toggling")||(e.addClass("smart-tags-toggling"),t.hasClass("smart-tag-showing")?m.removeSmartTagsList(t):m.insertSmartTagsList(t))},removeSmartTagsList:function(e){var t=e.closest(".wpforms-panel-field,.wpforms-field-option-row"),i=t.find(".smart-tags-list-display");e.find("span").text(wpforms_builder.smart_tags_show),i.slideUp("",function(){i.remove(),e.removeClass("smart-tag-showing"),t.removeClass("smart-tags-toggling")})},insertSmartTagsList:function(e){var t,i=e.closest(".wpforms-panel-field,.wpforms-field-option-row"),o=e.closest("label"),r=!0;o.length||(o=i.find("label"),r=!1),t=m.getSmartTagsList(e,-1!==o.attr("for").indexOf("wpforms-field-option-")),(r?o:e).after(t),e.find("span").text(wpforms_builder.smart_tags_hide),i.find(".smart-tags-list-display").slideDown("",function(){e.addClass("smart-tag-showing"),i.removeClass("smart-tags-toggling")})},getSmartTagsList:function(e,t=!1){var i='
      ';return i+=m.getSmartTagsListFieldsElements(e),i+=m.getSmartTagsListOtherElements(e,t),i+="
    "},getSmartTagsListFieldsElements:function(e){var t,i=e.data("type"),o=m.getSmartTagsFields(e),r="";if(!["fields","all"].includes(i))return"";if(!o)return'
  • '+wpforms_builder.fields_unavailable+"
  • ";for(t in r+='
  • '+wpforms_builder.fields_available+"
  • ",wpf.orders.fields){var n=wpf.orders.fields[t];o[n]&&(r+=m.getSmartTagsListFieldsElement(o[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 t=e.label?wpf.encodeHTMLEntities(wpf.sanitizeHTML(e.label)):wpforms_builder.field+" #"+e.id;return'
  • "+t+"
  • "},getSmartTagsListOtherElements(e,t){var i,o,e=e.data("type");if("other"!==e&&"all"!==e)return"";for(o in i='
  • '+wpforms_builder.other+"
  • ",wpforms_builder.smart_tags)t&&-1"+wpforms_builder.smart_tags[o]+"");return i},smartTagInsert:function(e){e.preventDefault();var t,i=w(this),o=i.closest(".smart-tags-list-display"),r=o.closest(".wpforms-panel-field,.wpforms-field-option-row"),n=r.find(".toggle-smart-tag-display"),a=r.find("input[type=text], textarea"),e=i.data("meta"),e="field"===i.data("type")?'{field_id="'+e+'"}':"{"+e+"}";"undefined"!=typeof tinyMCE&&(t=tinyMCE.get(a.prop("id")))&&!t.hasFocus()&&t.focus(!0),t&&!t.isHidden()?t.insertContent(e):a.insertAtCaret(e),o.slideUp("",function(){o.remove()}),n.find("span").text(wpforms_builder.smart_tags_show),r.find(".toggle-smart-tag-display").removeClass("smart-tag-showing")},fieldMapTableDeleteRow:function(e,t){var i=w(t),o=i.closest("tr"),t=i.closest("table"),i=o.closest(".wpforms-builder-settings-block");"1"",{value:"",text:a})),void 0!==n&&n){if(n=n.split(" "),l&&!w.isEmptyObject(l))for(var s in wpf.orders.fields)Object.prototype.hasOwnProperty.call(wpf.orders.fields,s)&&(i=wpf.orders.fields[s],s="",l[i]&&(s=void 0!==l[i].label&&""!==l[i].label.toString().trim()?wpf.sanitizeHTML(l[i].label.toString().trim()):wpforms_builder.field+" #"+i,(0<=w.inArray(l[i].type,n)||0<=w.inArray("all-fields",n))&&o.append(w("