PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/ $#$#$#

Dir : /home/trave494/v1world.us/wp-content/plugins/wpforms-lite/assets/js/
Server: Linux ngx353.inmotionhosting.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64
IP: 209.182.202.254
Choose File :

Url:
Dir : //home/trave494/v1world.us/wp-content/plugins/wpforms-lite/assets/js/admin-builder.min.js

var WPFormsBuilder=window.WPFormsBuilder||function(r,n,w){var h,g,f={},o=!0,m={settings:{spinner:'<i class="wpforms-loading-spinner"></i>',spinnerInline:'<i class="wpforms-loading-spinner wpforms-loading-inline"></i>',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(n).on("load",function(){"function"==typeof w.ready.then?w.ready.then(m.load):m.load()}),w(n).on("beforeunload",function(){if(!e.formIsSaved()&&o)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,o){var t,i=w(this),r=i.find(".wpforms-panel-sidebar-section.configured").first();r.length?(t=r.data("section"),r.addClass("active"),i.find(".wpforms-panel-content-section-"+t).show().addClass("active"),i.find(".wpforms-panel-content-section-default").hide()):(i.find(".wpforms-panel-content-section:first-of-type").show().addClass("active"),i.find(".wpforms-panel-sidebar-section:first-of-type").addClass("active"))}),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,o){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:!0,backgroundDismiss:!0,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("<link>").appendTo("head").attr({type:"text/css",rel:"stylesheet",href:wpforms_builder.ms_win_css_url})},isVisitedViaBackButton:function(){if(!performance)return!1;var o=!1;return performance.getEntriesByType("navigation").forEach(function(e){"back_forward"===e.type&&(o=!0)}),o},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),o=e.closest(".wpforms-field").find("select");e.hasClass("is-disabled")&&e.removeClass("is-disabled"),o.is("[readonly]")&&(this.disable(),o.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 o=new Choices(e[0],m.dropdownField.config.args);m.dropdownField.helpers.setInstance(e,o),m.dropdownField.helpers.addPlaceholderChoice(e,o)},multiple:function(e){var o=w(this).closest(".wpforms-field-option-row-multiple").data().fieldId,t=m.dropdownField.helpers.getPrimarySelector(o),i=w("#wpforms-field-option-row-"+o+"-choices input.default"),r=t.find(".placeholder"),a=m.dropdownField.helpers.isDynamicChoices(o),n=e.target.checked,e=n?"checkbox":"radio";t.prop("multiple",n),i.prop("type",e),a&&t.find("option:selected").prop("selected",!1),t=i.filter(":checked"),!n&&t.length&&(i.prop("checked",!1),w(t.get(0)).prop("checked",!0)),r.length&&r.prop("selected",!n),m.dropdownField.helpers.update(o,a)},applyStyle:function(){var e=w(this),o=e.closest(".wpforms-field-option-row-style").data().fieldId;"modern"===e.val()?m.dropdownField.helpers.convertClassicToModern(o):m.dropdownField.helpers.convertModernToClassic(o)}},helpers:{convertModernToClassic:function(e){var o=m.dropdownField.helpers.getPrimarySelector(e),t=m.dropdownField.helpers.isDynamicChoices(e),o=m.dropdownField.helpers.getInstance(o);o.destroy(),m.dropdownField.helpers.updatePlaceholderChoice(o,e),t||m.fieldChoiceUpdate("select",e)},convertClassicToModern:function(e){var o=m.dropdownField.helpers.getPrimarySelector(e);m.dropdownField.helpers.isDynamicChoices(e)||m.fieldChoiceUpdate("select",e),m.dropdownField.events.choicesInit(o)},update:function(e,o){var t=m.dropdownField.helpers.getPrimarySelector(e);m.dropdownField.helpers.isModernSelect(t)?(m.dropdownField.helpers.convertModernToClassic(e),m.dropdownField.events.choicesInit(t)):o||m.fieldChoiceUpdate("select",e)},addPlaceholderChoice:function(e,o){var t=e.closest(".wpforms-field").data().fieldId,i=m.dropdownField.helpers.hasDefaults(t);if(m.dropdownField.helpers.isDynamicChoices(t)&&(i=!1),!1!==m.dropdownField.helpers.searchPlaceholderChoice(o))return!1;if(!o.config.choices.length)return!1;e=o.config.choices[0].label,t=w(o.passedElement.element).prop("multiple");return o.setChoices([{value:"",label:e,selected:!(t||i),placeholder:!0}],"value","label",!1),t&&w(o.input.element).prop("placeholder",e),!0},searchPlaceholderChoice:function(e){var i=!1;return e.config.choices.forEach(function(e,o,t){if(void 0!==e.placeholder&&!0===e.placeholder)return!(i={key:o,item:e})}),i},updatePlaceholderChoice:function(e,o){var t=w(e.passedElement.element),i=wpf.sanitizeHTML(w("#wpforms-field-option-"+o+"-placeholder").val()),o=m.dropdownField.helpers.searchPlaceholderChoice(e),e={};"object"==typeof o&&(e=w(t.find("option").get(o.key))),""!==i?!w.isEmptyObject(e)&&e.length?e.addClass("placeholder").text(i):t.prepend('<option value="" class="placeholder">'+i+"</option>"):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,o){e.data("choicesjs",o)},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 o=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),t=parseFloat(e.target.value);isNaN(t)||m.updateNumberSliderDefaultValueAttr(o,e.target.value,"min")},changeNumberSliderMax:function(e){var o=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),t=parseFloat(e.target.value);isNaN(t)||m.updateNumberSliderDefaultValueAttr(o,e.target.value,"max").updateNumberSliderStepValueMaxAttr(o,e.target.value)},changeNumberSliderValueDisplay:function(e){var o=e.target.value,t=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),e=r.getElementById("wpforms-field-option-"+t+"-default_value");e&&m.updateNumberSliderHintStr(t,o).updateNumberSliderHint(t,e.value)},changeNumberSliderStep:function(e){var o,t,i,r=parseFloat(e.target.value);isNaN(r)||(o=parseFloat(e.target.max),t=parseFloat(e.target.min),i=w(e.target).parents(".wpforms-field-option-row").data("fieldId"),r<=0||(o<r?e.target.value=o:r<t?e.target.value=t:m.updateNumberSliderAttr(i,r,"step").updateNumberSliderDefaultValueAttr(i,r,"step")))},checkNumberSliderStep:function(e){var e=parseFloat(e.target.value),o=w(this);!isNaN(e)&&0<e||w.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.error_number_slider_increment,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){o.val("").focus()}}}})},changeNumberSliderDefaultValue:function(e){var o,t,i,r=parseFloat(e.target.value);isNaN(r)||(o=parseFloat(e.target.max),t=parseFloat(e.target.min),i=w(e.target).parents(".wpforms-field-option-row-default_value").data("fieldId"),o<r?e.target.value=o:r<t?e.target.value=t:m.updateNumberSlider(i,r).updateNumberSliderHint(i,r))},updateNumberSliderDefaultValueAttr:function(e,o,t){var i=r.getElementById("wpforms-field-option-"+e+"-default_value");return i&&(e=parseFloat(i.value),i.setAttribute(t,o),o=parseFloat(o),"max"===t&&o<e&&(i.value=o,w(i).trigger("input")),"min"===t&&e<o&&(i.value=o,w(i).trigger("input"))),this},updateNumberSlider:function(e,o){e=r.getElementById("wpforms-number-slider-"+e);return e&&(e.value=o),this},updateNumberSliderAttr:function(e,o,t){e=r.getElementById("wpforms-number-slider-"+e);return e&&e.setAttribute(t,o),this},updateNumberSliderHintStr:function(e,o){e=r.getElementById("wpforms-number-slider-hint-"+e);return e&&(e.dataset.hint=o),this},updateNumberSliderHint:function(e,o){e=r.getElementById("wpforms-number-slider-hint-"+e);return e&&(e.innerHTML=wpf.sanitizeHTML(e.dataset.hint).replace("{value}","<b>"+o+"</b>")),this},fieldNumberSliderUpdateMin:function(e){var o=w(e.target).parents(".wpforms-field-option-row-min_max"),t=parseFloat(o.find(".wpforms-number-slider-max").val()),i=parseFloat(e.target.value);if(!isNaN(i)){if(t<=i)return e.preventDefault(),void(this.value=t);o=o.data("field-id");g.find("#wpforms-field-"+o+' input[type="range"]').attr("min",i)}},fieldNumberSliderUpdateMax:function(e){var o=w(e.target).parents(".wpforms-field-option-row-min_max"),t=parseFloat(o.find(".wpforms-number-slider-min").val()),i=parseFloat(e.target.value);if(!isNaN(i)){if(i<=t)return e.preventDefault(),void(this.value=t);o=o.data("field-id");g.find("#wpforms-field-"+o+' input[type="range"]').attr("max",i)}},updateNumberSliderStepValueMaxAttr:function(e,o){var t=r.getElementById("wpforms-field-option-"+e+"-step");return t&&(e=parseFloat(t.value),t.setAttribute("max",o),(o=parseFloat(o))<e&&(t.value=o,w(t).trigger("input"))),this},fieldFileUploadPreviewUpdate:function(e){var o=w(e).parents(".wpforms-field-option-file-upload"),t=o.data("field-id"),i=o.find("#wpforms-field-option-"+t+"-style").val(),r=o.find("#wpforms-field-option-row-"+t+"-max_file_number"),a=parseInt(r.find("input").val(),10),e=w("#wpforms-field-"+t),o=".wpforms-file-upload-builder-classic",t=".wpforms-file-upload-builder-modern";"classic"===i?(w(o,e).removeClass("wpforms-hide"),w(t,e).addClass("wpforms-hide"),r.addClass("wpforms-hidden")):(1<a?(e.find(".modern-title").text(wpforms_builder.file_upload.preview_title_plural),e.find(".modern-hint").text(wpforms_builder.file_upload.preview_hint.replace("{maxFileNumber}",a)).removeClass("wpforms-hide")):(e.find(".modern-title").text(wpforms_builder.file_upload.preview_title_single),e.find(".modern-hint").text(wpforms_builder.file_upload.preview_hint.replace("{maxFileNumber}",1)).addClass("wpforms-hide")),w(o,e).addClass("wpforms-hide"),w(t,e).removeClass("wpforms-hide"),r.removeClass("wpforms-hidden"))},updateTextFieldsLimitControls:function(e,o){o?w("#wpforms-field-option-row-"+e+"-limit_controls").removeClass("wpforms-hide"):w("#wpforms-field-option-row-"+e+"-limit_controls").addClass("wpforms-hide")},updatePasswordStrengthControls:function(e,o){e=w("#wpforms-field-option-row-"+e+"-password-strength-level");o?e.removeClass("wpforms-hidden"):e.addClass("wpforms-hidden")},bindUIActions:function(){m.bindUIActionsPanels(),m.bindUIActionsFields(),m.bindUIActionsSettings(),m.bindUIActionsSaveExit(),m.bindUIActionsGeneral()},bindUIActionsPanels:function(){g.on("click","#wpforms-panels-toggle button, .wpforms-panel-switch",function(e){e.preventDefault(),m.panelSwitch(w(this).data("panel"))}),g.on("click",".wpforms-panel .wpforms-panel-sidebar-section",function(e){m.panelSectionSwitch(this,e)})},panelSwitch:function(e){var o=w("#wpforms-panel-"+e),t=w(".wpforms-panel-"+e+"-button");if(!o.hasClass("active")){if(g.trigger("wpformsPanelSwitch",[e]),!wpforms_panel_switch)return!1;w("#wpforms-panels-toggle").find("button").removeClass("active"),w(".wpforms-panel").removeClass("active"),t.addClass("active"),o.addClass("active"),history.replaceState({},null,wpf.updateQueryString("view",e)),g.trigger("wpformsPanelSwitched",[e])}},panelSectionSwitch:function(e,o){o&&o.preventDefault();var t=w(e),i=t.parent().parent(),r=t.data("section"),o=i.find(".wpforms-panel-sidebar-section"),e=i.find(".wpforms-panel-sidebar-section-"+r);t.hasClass("upgrade-modal")||t.hasClass("education-modal")||e.hasClass("active")||(g.trigger("wpformsPanelSectionSwitch",r),o.removeClass("active"),e.addClass("active"),i.find(".wpforms-panel-content-section").hide(),i.find(".wpforms-panel-content-section-"+r).show())},bindUIActionsSetup:function(){console.warn('WARNING! Function "WPFormsBuilder.bindUIActionsSetup()" has been deprecated, please use the new "WPForms.Admin.Builder.Setup.events()" function instead!'),WPForms.Admin.Builder.Setup.events()},templateSelect:function(e,o){console.warn('WARNING! Function "WPFormsBuilder.templateSelect()" has been deprecated, please use the new "WPForms.Admin.Builder.Setup.selectTemplate()" function instead!'),WPForms.Admin.Builder.Setup.selectTemplate(o)},bindUIActionsFields:function(){g.on("click",".wpforms-tab a",function(e){e.preventDefault(),m.fieldTabToggle(w(this).parent().attr("id"))}),g.on("click",".wpforms-add-fields-heading",function(e){e.preventDefault(),m.fieldGroupToggle(w(this),"click")}),g.on("click",".wpforms-field",function(e){m.fieldTabToggle(w(this).data("field-id"))}),g.on("mousedown click",".wpforms-field input, .wpforms-field select, .wpforms-field textarea",function(e){e.preventDefault(),this.blur()}),g.on("click",".wpforms-field-delete",function(e){e.preventDefault(),e.stopPropagation(),m.fieldDelete(w(this).parent().data("field-id"))}),g.on("click",".wpforms-field-duplicate",function(e){e.preventDefault(),m.fieldDuplicate(w(this).parent().data("field-id"))}),g.on("click",".wpforms-add-fields-button",function(e){e.preventDefault(),m.fieldAdd(w(this).data("field-type"))}),g.on("wpformsFieldAdd",function(e,o,t){"select"!==t&&"radio"!==t&&"checkbox"!==t&&"payment-multiple"!==t&&"payment-checkbox"!==t&&"payment-select"!==t||m.fieldChoiceSortable(t,"#wpforms-field-option-row-"+o+"-choices ul")}),g.on("click",".wpforms-field-option-row-choices .add",function(e){m.fieldChoiceAdd(e,w(this))}),g.on("click",".wpforms-field-option-row-choices .remove",function(e){m.fieldChoiceDelete(e,w(this))}),g.on("mousedown",".wpforms-field-option-row-choices input[type=radio]",function(e){var o=w(this);o.is(":checked")?o.attr("data-checked","1"):o.attr("data-checked","0")}),g.on("click",".wpforms-field-option-row-choices input[type=radio]",function(e){var o=w(this),t=o.parent().parent();o.parent().parent().find("input[type=radio]").not(this).prop("checked",!1),"1"===o.attr("data-checked")&&(o.prop("checked",!1),o.attr("data-checked","0")),m.fieldChoiceUpdate(t.data("field-type"),t.data("field-id"))}),g.on("change",".wpforms-field-option-row-choices input[type=checkbox]",function(e){var o=w(this).parent().parent();m.fieldChoiceUpdate(o.data("field-type"),o.data("field-id"))}),g.on("change",".wpforms-field-option-row-show_values input",function(e){w(this).closest(".wpforms-field-option").find(".wpforms-field-option-row-choices ul").toggleClass("show-values")}),g.on("change",".wpforms-field-option-row-choices_images input",function(){var e=w(this),o=e.closest(".wpforms-field-option-row"),t=o.data("field-id"),i=w("#wpforms-field-option-"+t),r=e.is(":checked"),e=i.find(".wpforms-field-option-hidden-type").val();o.find(".wpforms-alert").toggleClass("wpforms-hidden"),i.find(".wpforms-field-option-row-choices ul").toggleClass("show-images"),i.find(".wpforms-field-option-row-choices_images_style").toggleClass("wpforms-hidden"),(r?w("#wpforms-field-option-"+t+"-input_columns").val("inline"):w("#wpforms-field-option-"+t+"-input_columns").val("")).trigger("change"),m.fieldChoiceUpdate(e,t)}),g.on("wpformsImageUploadAdd wpformsImageUploadRemove",function(e,o,t){var i=t.closest(".choices-list"),t=i.data("field-id"),i=i.data("field-type");m.fieldChoiceUpdate(i,t)}),g.on("change",".wpforms-field-option-row-choices_images_style select",function(){var e=w(this).parent().data("field-id"),o=w("#wpforms-field-option-"+e).find(".wpforms-field-option-hidden-type").val();m.fieldChoiceUpdate(o,e)}),g.on("focusout",".wpforms-field-option-row-choices input.label, .wpforms-field-option-row-choices input.value",function(e){var o=w(this).parent().parent();m.fieldChoiceUpdate(o.data("field-type"),o.data("field-id"))}),g.on("click",".toggle-bulk-add-display",function(e){e.preventDefault(),m.fieldChoiceBulkAddToggle(this)}),g.on("click",".toggle-bulk-add-presets",function(e){e.preventDefault();e=w(this).closest(".bulk-add-display").find("ul");"block"===e.css("display")?w(this).text(wpforms_builder.bulk_add_presets_show):w(this).text(wpforms_builder.bulk_add_presets_hide),e.stop().slideToggle()}),g.on("click",".bulk-add-preset-insert",function(e){e.preventDefault();var o=w(this),t=o.data("preset"),i=o.closest(".bulk-add-display"),e=i.find("ul"),o=i.find(".toggle-bulk-add-presets"),i=i.find("textarea");i.val(""),i.insertAtCaret(wpforms_preset_choices[t].choices.join("\n")),o.text(wpforms_builder.bulk_add_presets_show),e.slideUp()}),g.on("click",".bulk-add-insert",function(e){e.preventDefault(),m.fieldChoiceBulkAddInsert(this)}),g.on("click",".wpforms-field-option-group-toggle:not(.education-modal)",function(e){e.preventDefault();e=w(this).closest(".wpforms-field-option-group");e.siblings(".wpforms-field-option-group").removeClass("active"),e.addClass("active")}),g.on("change",".wpforms-field-option-address input.wpforms-subfield-hide",function(e){var o=w(this).closest(".wpforms-field-option-row"),t=o.data("field-id"),o=o.data("subfield");w("#wpforms-field-"+t).find(".wpforms-"+o).toggleClass("wpforms-hide")}),g.on("input",".wpforms-field-option-row-label input, .wpforms-field-option-row-name input",function(e){var o=w(this),t=o.val(),o=o.parent().data("field-id");w("#wpforms-field-"+o).find(".label-title .text").text(t)}),g.on("input",".wpforms-field-option-row-description textarea",function(){var e=w(this),o=wpf.sanitizeHTML(e.val()),e=e.parent().data("field-id"),e=w("#wpforms-field-"+e).find(".description");e.hasClass("nl2br")?e.html(o.replace(/\n/g,"<br>")):e.html(o)}),g.on("change",".wpforms-field-option-row-required input",function(e){var o=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+o).toggleClass("required")}),g.on("change",".wpforms-field-option-row-confirmation input",function(e){var o=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+o).find(".wpforms-confirm").toggleClass("wpforms-confirm-enabled wpforms-confirm-disabled"),w("#wpforms-field-option-"+o).toggleClass("wpforms-confirm-enabled wpforms-confirm-disabled")}),g.on("change",".wpforms-field-option-row-filter_type select",function(){var e=w(this).parent().data("field-id"),e=w("#wpforms-field-option-"+e);w(this).val()?(e.removeClass("wpforms-filter-allowlist"),e.removeClass("wpforms-filter-denylist"),e.addClass("wpforms-filter-"+w(this).val())):(e.removeClass("wpforms-filter-allowlist"),e.removeClass("wpforms-filter-denylist"))}),g.on("focusout",".wpforms-field-option-row-allowlist textarea,.wpforms-field-option-row-denylist textarea",function(){var o=w(this);w.get(wpforms_builder.ajax_url,{nonce:wpforms_builder.nonce,content:o.val(),action:"wpforms_sanitize_restricted_rules"},function(e){e.success&&o.val(e.data)})}),g.on("change",".wpforms-field-option-row-size select",function(e){var o=w(this),t=o.val(),o=o.parent().data("field-id");w("#wpforms-field-"+o).removeClass("size-small size-medium size-large").addClass("size-"+t)}),g.on("input",".wpforms-field-option-row-placeholder input",function(){var e,o=w(this),t=wpf.sanitizeHTML(o.val()),i=o.parent().data("field-id"),r=w("#wpforms-field-"+i+" .primary-input");r.is("select")?m.dropdownField.helpers.isModernSelect(r)?(o=m.dropdownField.helpers.getInstance(r),r.prop("multiple")?w(o.input.element).prop("placeholder",t):(o.setChoiceByValue(""),r.closest(".choices").find(".choices__inner .choices__placeholder").text(t),e=w("#wpforms-field-option-"+i+"-dynamic_choices").val(),m.dropdownField.helpers.update(i,e))):(e=r.find(".placeholder"),!t.length&&e.length?e.remove():(e.length?e.text(t):r.prepend('<option value="" class="placeholder">'+t+"</option>"),r.find(".placeholder").prop("selected",!r.prop("multiple")))):r.prop("placeholder",t)}),g.on("input",".wpforms-field-option-row-confirmation_placeholder input",function(e){var o=w(this),t=o.val(),o=o.parent().data("field-id");w("#wpforms-field-"+o).find(".secondary-input").attr("placeholder",t)}),g.on("change",".wpforms-field-option-row-label_hide input",function(e){var o=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+o).toggleClass("label_hide")}),g.on("change",".wpforms-field-option-row-sublabel_hide input",function(e){var o=w(this).closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+o).toggleClass("sublabel_hide")}),g.on("change",".wpforms-field-option-row-format select",function(e){var o=w(this),t=o.val(),o=o.parent().data("field-id");w("#wpforms-field-"+o).find(".format-selected").removeClass().addClass("format-selected format-selected-"+t),w("#wpforms-field-option-"+o).find(".format-selected").removeClass().addClass("format-selected format-selected-"+t)}),g.on("change",".wpforms-field-option-row-scheme select",function(e){var o=w(this),t=o.val(),i=o.parent().data("field-id"),o=w("#wpforms-field-"+i);o.find(".wpforms-address-scheme").addClass("wpforms-hide"),o.find(".wpforms-address-scheme-"+t).removeClass("wpforms-hide"),0==o.find(".wpforms-address-scheme-"+t+" .wpforms-country").children().length?w("#wpforms-field-option-"+i).find(".wpforms-field-option-row-country").addClass("wpforms-hidden"):w("#wpforms-field-option-"+i).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 o=w(this),t=o.val(),i=o.closest(".wpforms-field-option-row"),o=i.data("field-id"),i=i.data("subfield");w("#wpforms-field-"+o).find(".wpforms-"+i+" input").attr("placeholder",t)}),g.on("change",".wpforms-field-option-row-date .type select",function(e){var o=w(this),t=o.val(),i=w(this).closest(".wpforms-field-option-row").data("field-id"),r="datepicker"===t?"wpforms-date-type-datepicker":"wpforms-date-type-dropdown",a="datepicker"===t?"wpforms-date-type-dropdown":"wpforms-date-type-datepicker";w("#wpforms-field-"+i).find(".wpforms-date").addClass(r).removeClass(a),w("#wpforms-field-option-"+i).addClass(r).removeClass(a);a=o.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"),o=w("#wpforms-field-option-row-"+i+"-date_limit_days_options");"dropdown"===t?((t=w("#wpforms-field-option-"+i+"-date_format")).find("option:selected").hasClass("datepicker-only")&&t.prop("selectedIndex",0).trigger("change"),a.hide()):(a.show(),w("#wpforms-field-option-"+i+"-date_limit_days").is(":checked")?o.show():o.hide())}),g.on("change",".wpforms-field-option-row-date .format select",function(e){var o=w(this).val(),t=w(this).closest(".wpforms-field-option-row").data("field-id"),t=w("#wpforms-field-"+t);"m/d/Y"===o?(t.find(".wpforms-date-dropdown .first option").text(wpforms_builder.date_select_month),t.find(".wpforms-date-dropdown .second option").text(wpforms_builder.date_select_day)):"d/m/Y"===o&&(t.find(".wpforms-date-dropdown .first option").text(wpforms_builder.date_select_day),t.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,a=w(this).closest(".wpforms-field-option-row").data("field-id"),n="",o=0;o<r;o++)n+='<option value="{hh}">{hh}</option>'.replace(/{hh}/g,o<10?"0"+o:o);_.forEach(["start","end"],function(e){var o=g.find("#wpforms-field-option-"+a+"-time_limit_hours_"+e+"_hour"),t=g.find("#wpforms-field-option-"+a+"-time_limit_hours_"+e+"_ampm"),i=parseInt(o.val(),10),e=t.val();i=(i=24==r?"pm"===e?i+12:i:(e=12<i?"pm":"am",12<i?i-12:i))<10?"0"+i:i,o.html(n).val(i),t.toggleClass("wpforms-hidden",24==r).val(e),t.nextAll("div").toggleClass("wpforms-hidden",12==r)})}),g.on("click",".wpforms-pagebreak-button",function(e){e.preventDefault(),w(this).closest(".wpforms-field").trigger("click")}),m.fieldPageBreakInitDisplayPrevious(g.find(".wpforms-field-pagebreak.wpforms-pagebreak-normal:first")),g.on("input",".wpforms-field-option-row-next input",function(e){var o=w(this),t=o.val(),o=w("#wpforms-field-"+o.parent().data("field-id")).find(".wpforms-pagebreak-next");t?o.css("display","inline-block").text(t):o.css("display","none").empty()}).on("input",".wpforms-field-option-row-prev input",function(e){var o=w(this),t=o.val(),i=w("#wpforms-field-"+o.parent().data("field-id")),o=i.find(".wpforms-pagebreak-prev");t&&0<i.prevAll(".wpforms-field-pagebreak.wpforms-pagebreak-normal").length?o.removeClass("wpforms-hidden").text(t):o.addClass("wpforms-hidden").empty()}).on("change",".wpforms-field-option-row-prev_toggle input",function(e){var o=w(this),t=o.closest(".wpforms-field-option-group-inner").find(".wpforms-field-option-row-prev"),i=t.find("input");t.toggleClass("wpforms-hidden"),o.prop("checked")&&!i.val()?i.val(wpforms_builder.previous):i.val(""),i.trigger("input")}).on("wpformsFieldAdd",m.fieldPagebreakAdd).on("wpformsFieldDelete",m.fieldPagebreakDelete),g.on("wpformsFieldMove wpformsFieldAdd wpformsFieldDelete",function(e){g.find(".wpforms-field-pagebreak.wpforms-pagebreak-normal").each(function(e){m.fieldPageBreakInitDisplayPrevious(w(this))})}),g.on("input",".wpforms-field-option-row-title input",function(e){var o=w(this),t=o.val(),o=o.parent().data("field-id");t?w("#wpforms-field-"+o).find(".wpforms-pagebreak-title").text("("+t+")"):w("#wpforms-field-"+o).find(".wpforms-pagebreak-title").empty()}),g.on("change",".wpforms-field-option-row-nav_align select",function(e){var o=(o=w(this).val())||"center";w(".wpforms-pagebreak-buttons").removeClass("wpforms-pagebreak-buttons-center wpforms-pagebreak-buttons-left wpforms-pagebreak-buttons-right wpforms-pagebreak-buttons-split").addClass("wpforms-pagebreak-buttons-"+o)}),g.on("input",".wpforms-field-option-row-price input",function(e){var o=w(this),t=o.val(),i=o.parent().data("field-id"),o=wpf.amountSanitize(t),t=wpf.amountFormat(o),o="right"===wpforms_builder.currency_symbol_pos?t+" "+wpforms_builder.currency_symbol:wpforms_builder.currency_symbol+" "+t;w("#wpforms-field-"+i).find(".primary-input").val(t),w("#wpforms-field-"+i).find(".price").text(o)}),g.on("change",".wpforms-field-option-credit-card .payment-icons input",function(e){var o=w(this),t=o.data("card"),o=o.parent().data("field-id");w("#wpforms-field-"+o).find("img.icon-"+t).toggleClass("card_hide")}),g.on("input",".wpforms-field-option input.placeholder-update",function(e){var o=w(this),t=o.val(),i=o.data("field-id"),o=o.data("subfield");w("#wpforms-field-"+i).find(".wpforms-"+o+" input").attr("placeholder",t)}),g.on("change",".wpforms-field-option-row-input_columns select",function(){var e=w(this),o=e.val(),t="",e=e.parent().data("field-id");"2"===o?t="wpforms-list-2-columns":"3"===o?t="wpforms-list-3-columns":"inline"===o&&(t="wpforms-list-inline"),w("#wpforms-field-"+e).removeClass("wpforms-list-2-columns wpforms-list-3-columns wpforms-list-inline").addClass(t)}),g.on("change",".wpforms-field-option-row .wpforms-toggle-control input",function(e){var o=w(this),t=o.closest(".wpforms-toggle-control").find(".wpforms-toggle-control-status"),o=o.is(":checked")?"on":"off";t.html(t.data(o))}),g.on("change",".wpforms-field-option-row-dynamic_choices select",function(e){m.fieldDynamicChoiceToggle(w(this))}),g.on("change",".wpforms-field-option-row-dynamic_taxonomy select, .wpforms-field-option-row-dynamic_post_type select",function(e){m.fieldDynamicChoiceSource(w(this))}),g.on("click",".toggle-layout-selector-display",function(e){e.preventDefault(),m.fieldLayoutSelectorToggle(this)}),g.on("click",".layout-selector-display-layout",function(e){e.preventDefault(),m.fieldLayoutSelectorLayout(this)}),g.on("click",".layout-selector-display-columns span",function(e){e.preventDefault(),m.fieldLayoutSelectorInsert(this)}),w(r).on("change",".wpforms-field-option-row-scale select",function(){var e=w(this),o=e.val(),e=e.parent().data("field-id"),e=w("#wpforms-field-"+e+" .rating-icon"),t=1;e.each(function(e){t<=o?w(this).show():w(this).hide(),t++})}),w(r).on("change",".wpforms-field-option-row-icon select",function(){var e=w(this),o=e.val(),t=e.parent().data("field-id"),e="fa-star";"heart"===o?e="fa-heart":"thumb"===o?e="fa-thumbs-up":"smiley"===o&&(e="fa-smile-o"),w("#wpforms-field-"+t+" .rating-icon").removeClass("fa-star fa-heart fa-thumbs-up fa-smile-o").addClass(e)}),w(r).on("change",".wpforms-field-option-row-icon_size select",function(){var e=w(this),o=e.val(),e=e.parent().data("field-id"),e=w("#wpforms-field-"+e+" .rating-icon");fontSize="28","small"===o?fontSize="18":"large"===o&&(fontSize="38"),e.css("font-size",fontSize+"px")}),w(r).on("input",".wpforms-field-option-row-icon_color input.wpforms-color-picker",function(){var e=w(this),o=e.val(),e=e.closest(".wpforms-field-option-row").data("field-id");w("#wpforms-field-"+e+" > i.fa").css("color",o)}),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 o=w(this).closest(".wpforms-field-option-group-basic").find(".wpforms-field-option-row-choices .choices-list");m.fieldChoiceUpdate(o.data("field-type"),o.data("field-id"))})},fieldGroupToggle:function(e,o){var t=w(e),i=t.next(".wpforms-add-fields-buttons"),r=i.parent(),a=t.find("i"),e="wpforms_field_group_"+t.data("group");if("click"===o)return r.hasClass("wpforms-closed")?wpCookies.remove(e):wpCookies.set(e,"true",2592e3),a.toggleClass("wpforms-angle-right"),void i.stop().slideToggle("",function(){r.toggleClass("wpforms-closed")});"load"===o&&(i=t.find(".wpforms-add-fields-buttons"),a=t.find(".wpforms-add-fields-heading i"),e="wpforms_field_group_"+t.find(".wpforms-add-fields-heading").data("group"),"true"===wpCookies.get(e)&&(a.toggleClass("wpforms-angle-right"),i.hide(),t.toggleClass("wpforms-closed")))},fieldDelete:function(e){var o=w("#wpforms-field-"+e),t=o.data("field-type");o.hasClass("no-delete")?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"]}}}):(o={id:e,message:wpforms_builder.delete_confirm},g.trigger("wpformsBeforeFieldDeleteAlert",[o]),w.confirm({title:!1,content:o.message,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){w("#wpforms-field-"+e).fadeOut(400,function(){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])})}},cancel:{text:wpforms_builder.cancel}}}))},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,backgroundDismiss:!1,closeIcon:!1,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 o=m.clone(),t=e.html(),n=w("#wpforms-field-id").val(),i=w("#wpforms-field-option-"+c+"-label").length?w("#wpforms-field-option-"+c+"-label"):w("#wpforms-field-option-"+c+"-name"),r=i.length?i.val()+" "+wpforms_builder.duplicate_copy:wpforms_builder.field+" #"+c+" "+wpforms_builder.duplicate_copy,a=Number(n)+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"),i=new RegExp('\\b(id|for)="wpforms-(.*?)'+c+'(.*?)"',"ig");m.after(o),m.removeClass("active"),o.addClass("active").attr({id:"wpforms-field-"+n,"data-field-id":n}),t=(t=(t=(t=(t=t.replace(s,"ID #"+n)).replace(l,"fields["+n+"]")).replace(d,'data-field-id="'+n+'"')).replace(f,'data-reference="'+n+'"')).replace(i,function(e,o,t,i,r,a){return o+'="wpforms-'+t+n+i+'"'}),e.hide().after('<div class="'+e.attr("class")+'" id="wpforms-field-option-'+n+'" data-field-id="'+n+'">'+t+"</div>");var p=w("#wpforms-field-option-"+n);e.find(":input").each(function(e,o){var t=w(this),i=t.attr("name");if(!i)return"continue";var r=i.replace(l,"fields["+n+"]"),i=t.attr("type");"checkbox"===i||"radio"===i?t.is(":checked")?p.find('[name="'+r+'"]').prop("checked",!0).attr("checked","checked"):p.find('[name="'+r+'"]').prop("checked",!1).attr("checked",!1):t.is("select")?t.find("option:selected").length&&(i=t.find("option:selected").val(),p.find('[name="'+r+'"]').find('[value="'+i+'"]').prop("selected",!0)):""!==t.val()?p.find('[name="'+r+'"]').val(t.val()):t.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-"+n).find(".wpforms-field-option-hidden-id").val(n),w("#wpforms-field-id").val(a),w("#wpforms-field-option-"+n+"-label").val(r),"html"===u&&w("#wpforms-field-option-"+n+"-name").val(r),o.find(".label-title .text").text(r),g.trigger("wpformsFieldAdd",[n,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}}})},fieldAdd:function(n,s){var e=w("#wpforms-add-fields-"+n);if(!(e.hasClass("upgrade-modal")||e.hasClass("education-modal")||e.hasClass("warning-modal"))){if(-1===w.inArray(n,["captcha_hcaptcha","captcha_recaptcha","captcha_none"])){s=w.extend({},{position:"bottom",placeholder:!1,scroll:!0,defaults:!1},s);e={action:"wpforms_new_field_"+n,id:h.formID,type:n,defaults:s.defaults,nonce:wpforms_builder.nonce};return w.post(wpforms_builder.ajax_url,e,function(e){var o,t,i,r,a;e.success?(o=w(".wpforms-field").length,t=w("#wpforms-panel-fields .wpforms-panel-content-wrap"),i=w(".wpforms-field").last(),a=w(e.data.preview),r=w(e.data.options),a.css("display","none"),s.placeholder&&s.placeholder.remove(),"bottom"===s.position?i.length&&i.hasClass("wpforms-field-stick")?(w(".wpforms-field-wrap").children(":eq("+(o-1)+")").before(a),w(".wpforms-field-options").children(":eq("+(o-1)+")").before(r)):(w(".wpforms-field-wrap").append(a),w(".wpforms-field-options").append(r)):"top"===s.position?(w(".wpforms-field-wrap").prepend(a),w(".wpforms-field-options").prepend(r)):s.position===o&&i.length&&i.hasClass("wpforms-field-stick")?(w(".wpforms-field-wrap").children(":eq("+(o-1)+")").before(a),w(".wpforms-field-options").children(":eq("+(o-1)+")").before(r)):w(".wpforms-field-wrap").children(":eq("+s.position+")").length?(w(".wpforms-field-wrap").children(":eq("+s.position+")").before(a),w(".wpforms-field-options").children(":eq("+s.position+")").before(r)):(w(".wpforms-field-wrap").append(a),w(".wpforms-field-options").append(r)),a.fadeIn(),g.find(".no-fields, .no-fields-preview").remove(),g.find(".wpforms-field-submit").show(),s.scroll&&s.position.length&&(r=t.scrollTop(),a=a.position().top,t.animate({scrollTop:"bottom"===s.position?r<a?a-r:a+r:0},1e3)),w("#wpforms-field-id").val(e.data.field.id+1),wpf.initTooltips(),m.loadColorPickers(),m.toggleAllOptionGroups(),g.trigger("wpformsFieldAdd",[e.data.field.id,n])):console.log(e)}).fail(function(e,o,t){console.log(e.responseText)}).always(function(){g.find(".wpforms-add-fields .wpforms-add-fields-button").prop("disabled",!1)})}m.captchaUpdate()}},captchaUpdate:function(){var e={action:"wpforms_update_field_captcha",id:h.formID,nonce:wpforms_builder.nonce};return w.post(wpforms_builder.ajax_url,e,function(e){var o,t,i;e.success?(o={title:!1,content:!1,icon:"fa fa-exclamation-circle",type:"orange",backgroundDismiss:!1,closeIcon:!1,boxWidth:"450px",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}},t=w("#wpforms-panel-field-settings-recaptcha"),i=e.data.current,t.data("provider",e.data.provider),"configured_not_enabled"!==i&&"configured_enabled"!==i||(i=t.prop("checked")?"configured_enabled":"configured_not_enabled",o.buttons.confirm.action=function(){t.prop("checked","configured_not_enabled"===i).trigger("change")}),o.title=e.data.cases[i].title,o.content=e.data.cases[i].content,e.data.cases[i].cancel&&(o.buttons.cancel={text:wpforms_builder.cancel,keys:["esc"]}),w.confirm(o)):console.log(e)}).fail(function(e,o,t){console.log(e.responseText)})},fieldSortable:function(){var t,i,r,a,n=w(".wpforms-field-options"),s=!1,l=w("#wpforms-panel-fields .wpforms-panel-content-wrap"),d=!1;w(".wpforms-field-wrap").sortable({items:"> .wpforms-field:not(.wpforms-field-stick):not(.no-fields-preview)",axis:"y",delay:100,opacity:.75,cursor:"move",start:function(e,o){t=o.item.index(),r=n[0].children[t]},stop:function(e,o){i=o.item.index(),a=n[0].children[i],t<i?w(a).after(r):w(a).before(r),g.trigger("wpformsFieldMove",o),s=!1},over:function(e,o){var t=o.item.first();t.addClass("wpforms-field-dragging"),t.hasClass("wpforms-field-drag")&&(o=w(".wpforms-field").outerWidth()||f.$sortableFieldsWrap.find(".no-fields-preview").outerWidth(),t.addClass("wpforms-field-drag-over").removeClass("wpforms-field-drag-out").css("width",o).css("height","auto"))},out:function(e,o){var t=o.item.first();t.removeClass("wpforms-field-dragging"),s||(o=t.attr("data-original-width"),t.hasClass("wpforms-field-drag")&&t.addClass("wpforms-field-drag-out").removeClass("wpforms-field-drag-over").css("width",o).css("left","").css("top","")),t.css({top:"",left:"","z-index":""})},receive:function(e,o){s=!0;var t=w(this).data("ui-sortable").currentItem.index(),i=o.helper,o=i.attr("data-field-type");i.addClass("wpforms-field-drag-over wpforms-field-drag-pending").removeClass("wpforms-field-drag-out").css("width","100%"),i.append(h.spinnerInline),g.find(".wpforms-add-fields .wpforms-add-fields-button").prop("disabled",!0),g.find(".no-fields-preview").remove(),m.fieldAdd(o,{position:t,placeholder:i})},sort:function(e,o){if(!d){var t,i=e.clientY,r=l.offset(),a=l.height(),e=r.top+a;if(i>r.top&&i<r.top+50)t="-=";else{if(!(e-50<i&&i<e))return;t="+="}d=!0,l.animate({scrollTop:t+a/3+"px"},800,function(){d=!1})}}}),w(".wpforms-add-fields-button").not(".not-draggable").not(".warning-modal").not(".education-modal").draggable({connectToSortable:".wpforms-field-wrap",delay:200,helper:function(){var e=w(this),o=e.outerWidth(),t=e.html(),e=e.data("field-type");return w('<div class="wpforms-field-drag-out wpforms-field-drag">').html(t).css("width",o).attr("data-original-width",o).attr("data-field-type",e)},revert:"invalid",cancel:!1,scroll:!1,opacity:.75,containment:"document"})},fieldChoiceAdd:function(e,o){e.preventDefault();var t=w(o),i=t.parent(),r=i.find("input.default").is(":checked"),a=t.closest(".wpforms-field-option-row-choices").data("field-id"),e=i.parent().attr("data-next-id"),o=i.parent().data("field-type"),t=i.clone().insertAfter(i);t.attr("data-key",e),t.find("input.label").val("").attr("name","fields["+a+"][choices]["+e+"][label]"),t.find("input.value").val("").attr("name","fields["+a+"][choices]["+e+"][value]"),t.find("input.source").val("").attr("name","fields["+a+"][choices]["+e+"][image]"),t.find("input.default").attr("name","fields["+a+"][choices]["+e+"][default]").prop("checked",!1),t.find(".preview").empty(),t.find(".wpforms-image-upload-add").show(),t.find(".wpforms-money-input").trigger("focusout"),!0===r&&i.find("input.default").prop("checked",!0),e++,i.parent().attr("data-next-id",e),g.trigger("wpformsFieldChoiceAdd"),m.fieldChoiceUpdate(o,a)},fieldChoiceDelete:function(e,o){e.preventDefault();var t,i=w(o),r=i.parent().parent(),e=r.find("li").length,o={id:r.data("field-id"),choiceId:i.closest("li").data("key"),message:"<strong>"+wpforms_builder.delete_choice_confirm+"</strong>",trigger:!1};g.trigger("wpformsBeforeFieldDeleteAlert",[o]),1===e?m.fieldChoiceDeleteAlert():(t=function(){i.parent().remove(),m.fieldChoiceUpdate(r.data("field-type"),r.data("field-id")),g.trigger("wpformsFieldChoiceDelete")},o.trigger?w.confirm({title:!1,content:o.message,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){t()}},cancel:{text:wpforms_builder.cancel}}}):t())},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(i,e){w(e=void 0!==e?e:".wpforms-field-option-"+i+" .wpforms-field-option-row-choices ul").sortable({items:"li",axis:"y",delay:100,opacity:.6,handle:".move",stop:function(e,o){var t=o.item.parent().data("field-id");m.fieldChoiceUpdate(i,t),g.trigger("wpformsFieldChoiceMove",o)},update:function(e,o){}})},fieldChoiceLabel:function(e,o){var t=void 0!==e.settings.choices[o].label&&0!==e.settings.choices[o].label.length?wpf.sanitizeHTML(e.settings.choices[o].label):wpforms_builder.choice_empty_label_tpl.replace("{number}",o);return e.settings.show_price_after_labels&&(t+=" - "+wpf.amountFormatCurrency(e.settings.choices[o].value)),t},fieldChoiceUpdate:function(a,e){var n=w("#wpforms-field-"+e+" .primary-input");if("radio"===a||"checkbox"===a||"payment-multiple"===a||"payment-checkbox"===a){var o=wp.template("wpforms-field-preview-checkbox-radio-payment-multiple"),t={settings:wpf.getField(e),order:wpf.getChoicesOrder(e),type:"radio"};return"checkbox"!==a&&"payment-checkbox"!==a||(t.type="checkbox"),void w("#wpforms-field-"+e).find("ul.primary-input").replaceWith(o(t))}var s=m.dropdownField.helpers.isModernSelect(n),l="";"select"===(a="payment-select"===(a="payment-checkbox"===(a="payment-multiple"===a?"radio":a)?"checkbox":a)?"select":a)?(l='<option value="{label}">{label}</option>',n.find("option").not(".placeholder").remove()):"radio"!==a&&"checkbox"!==a&&"gdpr-checkbox"!==a||(a="gdpr-checkbox"===a?"checkbox":a,n.find("li").remove(),l='<li><input type="'+a+'" disabled>{label}</li>');var i=w("#wpforms-field-option-row-"+e+"-choices .choices-list"),r=!!i.find("input.default:checked").length,d=[],f=w("#wpforms-field-option-"+e+"-show_price_after_labels").prop("checked");i.find("li").each(function(){var e,o=w(this),t=wpf.sanitizeHTML(o.find("input.label").val().trim()),i=o.find("input.value").val(),r=o.find("input.default").is(":checked"),o=o.data("key");if(t&&(t=""!==t?t:wpforms_builder.choice_empty_label_tpl.replace("{number}",o),t+=f&&i?" - "+wpf.amountFormatCurrency(i):"",s?d.push({value:t,label:t}):(e=w(l.replace(/{label}/g,t)),n.append(e)),!0===r))switch(a){case"select":s?d[d.length-1].selected=!0:e.prop("selected","true");break;case"radio":case"checkbox":e.find("input").prop("checked","true")}}),s&&(o=n.prop("multiple")?"input.choices__input":".choices__inner .choices__placeholder",t=m.dropdownField.helpers.getInstance(n),i=w("#wpforms-field-option-"+e+"-dynamic_choices").val(),t.removeActiveItems(),t.setChoices(d,"value","label",!0),m.dropdownField.helpers.update(e,i),n.closest(".choices").find(o).toggleClass("wpforms-hidden",r))},fieldChoiceBulkAddToggle:function(e){var o=w(e),e=o.closest("label");if(o.hasClass("bulk-add-showing")){var t=e.next(".bulk-add-display");t.slideUp(400,function(){t.remove()}),o.find("span").text(wpforms_builder.bulk_add_show)}else{var i,r='<div class="bulk-add-display unfoldable-cont">';for(i in r+='<p class="heading wpforms-clear">'+wpforms_builder.bulk_add_heading+' <a href="#" class="toggle-bulk-add-presets">'+wpforms_builder.bulk_add_presets_show+"</a></p>",r+="<ul>",wpforms_preset_choices)r+='<li><a href="#" data-preset="'+i+'" class="bulk-add-preset-insert">'+wpforms_preset_choices[i].name+"</a></li>";r+="</ul>",r+='<textarea placeholder="'+wpforms_builder.bulk_add_placeholder+'"></textarea>',r+='<button class="bulk-add-insert wpforms-btn wpforms-btn-sm wpforms-btn-blue">'+wpforms_builder.bulk_add_button+"</button>",e.after(r+="</div>"),e.next(".bulk-add-display").slideDown(400,function(){w(this).find("textarea").focus()}),o.find("span").text(wpforms_builder.bulk_add_hide)}o.toggleClass("bulk-add-showing")},fieldChoiceBulkAddInsert:function(e){var o,t,i,r=w(e),a=r.closest(".wpforms-field-option-row"),n=a.find("textarea"),s=a.find(".choices-list"),l=s.find("li:first-of-type").clone().wrap("<div>").parent(),d=a.data("field-id"),e=s.data("field-type"),f=Number(s.attr("data-next-id")),p=n.val().split("\n"),c="";for(t in r.prop("disabled",!0).html(r.html()+" "+h.spinner),l.find("input.value,input.label").attr("value",""),o=l.html(),p)p.hasOwnProperty(t)&&(i=wpf.sanitizeHTML(p[t]).trim().replace(/"/g,"&quot;"),c+=o.replace(/\[choices\]\[(\d+)\]/g,"[choices]["+f+"]").replace(/data-key="(\d+)"/g,'data-key="'+f+'"').replace(/value="" class="label"/g,'value="'+i+'" class="label"').replace(/class="label" type="text" value=""/g,'class="label" type="text" value="'+i+'"'),f++);s.attr("data-next-id",f).append(c),m.fieldChoiceUpdate(e,d),g.trigger("wpformsFieldChoiceAdd"),m.fieldChoiceBulkAddToggle(a.find(".toggle-bulk-add-display"))},fieldTabToggle:function(e){var o;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?((o=w(".wpforms-field").first()).addClass("active"),e=o.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,o,t){"pagebreak"===t&&(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 o=w("#wpforms-field-"+e.data.field.id);w("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-bottom"),o.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 o=w("#wpforms-field-"+e.data.field.id);w("#wpforms-field-option-"+e.data.field.id).find(".wpforms-field-option-group").addClass("wpforms-pagebreak-top"),o.addClass("wpforms-field-stick wpforms-pagebreak-top")})))},fieldPagebreakDelete:function(e,o,t){var i,r,a;"pagebreak"===t&&(w(".wpforms-field-pagebreak").not(".wpforms-pagebreak-top, .wpforms-pagebreak-bottom").length||(r=(i=(a=w(".wpforms-preview-wrap")).find(".wpforms-pagebreak-top")).data("field-id"),a=(t=a.find(".wpforms-pagebreak-bottom")).data("field-id"),i.remove(),w("#wpforms-field-option-"+r).remove(),h.pagebreakTop=!1,t.remove(),w("#wpforms-field-option-"+a).remove(),h.pagebreakBottom=!1))},fieldPageBreakInitDisplayPrevious:function(e){var o=e.data("field-id"),t=w("#wpforms-field-option-row-"+o+"-prev_toggle"),i=w("#wpforms-field-option-row-"+o+"-prev"),o=e.find(".wpforms-pagebreak-prev");0<e.prevAll(".wpforms-field-pagebreak.wpforms-pagebreak-normal").length?(t.removeClass("hidden"),i.removeClass("hidden"),t.find("input").is(":checked")&&o.removeClass("wpforms-hidden").text(i.find("input").val())):(t.addClass("hidden"),i.addClass("hidden"),o.addClass("wpforms-hidden"))},fieldDynamicChoiceToggle:function(e){var o=w(e),t=o.parent(),i=o.val(),r=t.data("field-id"),a=w("#wpforms-field-option-"+r).find(".wpforms-field-option-hidden-type").val(),n=w("#wpforms-field-"+r),s=w("#wpforms-field-option-row-"+r+"-choices"),e=w("#wpforms-field-option-"+r+"-choices_images");if(m.fieldDynamicChoiceToggleImageChoices(),g.trigger("wpformsFieldDynamicChoiceToggle"),wpf.fieldOptionLoading(t),w("#wpforms-field-option-row-"+r+"-dynamic_post_type").remove(),w("#wpforms-field-option-row-"+r+"-dynamic_taxonomy").remove(),""===i){if(e.removeClass("wpforms-hidden"),s.find(".toggle-bulk-add-display").removeClass("wpforms-hidden"),w("#wpforms-field-"+r).find(".wpforms-alert").remove(),-1<["checkbox","radio","payment-multiple","payment-checkbox"].indexOf(a))return m.fieldChoiceUpdate(a,r),s.find("ul").removeClass("wpforms-hidden"),s.find(".wpforms-alert").addClass("wpforms-hidden"),void wpf.fieldOptionLoading(t,!0);var l,d=[],f=n.find(".primary-input");if(w("#wpforms-field-option-row-"+r+"-choices li").each(function(){var e=w(this);d.push({label:wpf.sanitizeHTML(e.find(".label").val()),selected:e.find(".default").is(":checked")})}),n.hasClass("wpforms-field-select")){var o=m.dropdownField.helpers.isModernSelect(f),p="";if(f.find("option").not(".placeholder").remove(),o&&d.length)m.dropdownField.helpers.update(r,!1);else for(l in d)p="<option",p+=d[l].selected?" selected>":">",p+=d[l].label+"</option>",f.append(p)}else for(l in a="radio",n.hasClass("wpforms-field-checkbox")&&(a="checkbox"),f.empty(),d)p='<li><input type="'+a+'" disabled',p+=d[l].selected?" selected>":">",p+=d[l].label+"</li>",f.append(p);s.find("ul").removeClass("wpforms-hidden"),s.find(".wpforms-alert").addClass("wpforms-hidden"),wpf.fieldOptionLoading(t,!0)}else{e.addClass("wpforms-hidden"),s.find(".toggle-bulk-add-display").addClass("wpforms-hidden");s={type:i,field_id:r,action:"wpforms_builder_dynamic_choices",nonce:wpforms_builder.nonce};w.post(wpforms_builder.ajax_url,s,function(e){e.success?t.after(e.data.markup):console.log(e),wpf.fieldOptionLoading(t,!0),wpf.initTooltips(),w("#wpforms-field-option-"+r+"-dynamic_"+i).find("option:first").prop("selected",!0),w("#wpforms-field-option-"+r+"-dynamic_"+i).trigger("change")}).fail(function(e,o,t){console.log(e.responseText)})}},fieldDynamicChoiceSource:function(e){var o=w(e),t=o.parent(),i=o.val(),r=t.data("field-id"),e=w("#wpforms-builder-form").data("id"),a=w("#wpforms-field-option-row-"+r+"-choices"),n=w("#wpforms-field-"+r),o=w("#wpforms-field-option-"+r+"-dynamic_choices option:selected").val(),s=20;wpf.fieldOptionLoading(t);e={type:o,source:i,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?(a.find(".dynamic-name").text(e.data.source_name),a.find(".dynamic-type").text(e.data.type_name),a.find("ul").addClass("wpforms-hidden"),a.find(".wpforms-alert").removeClass("wpforms-hidden"),m.fieldDynamicChoiceSourceItems(n,e.data.items),n.hasClass("wpforms-field-select")&&(s=200),Number(e.data.total)>s&&(o=(o=(o=(o=(o=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:o,icon:"fa fa-info-circle",type:"blue",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}))):console.log(e),void wpf.fieldOptionLoading(t,!0);var o}).fail(function(e,o,t){console.log(e.responseText)})},fieldDynamicChoiceSourceItems:function(e,o){var t=e.find(".primary-input"),i=0;if(e.hasClass("wpforms-field-select"))m.dropdownField.helpers.isModernSelect(t)?m.fieldDynamicChoiceSourceForModernSelect(t,o):m.fieldDynamicChoiceSourceForClassicSelect(t,o);else{var r="radio";for(i in e.hasClass("wpforms-field-checkbox")&&(r="checkbox"),t.empty(),o)t.append('<li><input type="'+r+'" disabled> '+wpf.sanitizeHTML(o[i])+"</li>")}},fieldDynamicChoiceSourceForModernSelect:function(e,o){var t=m.dropdownField.helpers.getInstance(e),i=e.closest(".wpforms-field").data().fieldId;t.destroy(),m.dropdownField.helpers.updatePlaceholderChoice(t,i),m.fieldDynamicChoiceSourceForClassicSelect(e,o),m.dropdownField.events.choicesInit(e)},fieldDynamicChoiceSourceForClassicSelect:function(e,o){var t=0,i=o.length;for(e.find("option").not(".placeholder").remove();t<i;t++){var r=wpf.sanitizeHTML(o[t]);e.append('<option value="'+r+'">'+r+"</option>")}},fieldDynamicChoiceToggleImageChoices:function(){w("#wpforms-builder .wpforms-field-options .wpforms-field-option").each(function(e,o){var t=w(o),o=t.find(".wpforms-field-option-row-dynamic_choices select");void 0!==o.val()&&""!==o.val()?(t.find(".wpforms-field-option-row-choices_images").hide(),t.find(".wpforms-field-option-row-choices_images_style").hide()):(t.find(".wpforms-field-option-row-choices_images").show(),t.find(".wpforms-field-option-row-choices_images_style").show())})},fieldLayoutSelectorToggle:function(e){var o=w(e),e=o.closest("label"),t={"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"}]};if(o.hasClass("layout-selector-showing")){var i=e.next(".layout-selector-display");i.slideUp(400,function(){i.remove()}),o.find("span").text(wpforms_builder.layout_selector_show)}else{var r,a='<div class="layout-selector-display unfoldable-cont">';for(r in a+='<p class="heading">'+wpforms_builder.layout_selector_layout+"</p>",a+='<div class="layouts">',t){var n,s=t[r];for(n in a+='<div class="layout-selector-display-layout">',s)a+='<span class="'+s[n].class+'" data-classes="'+s[n].data+'"></span>';a+="</div>"}e.after(a+="</div></div>"),e.next(".layout-selector-display").slideDown(),o.find("span").text(wpforms_builder.layout_selector_hide)}o.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 o=w(e),t=o.closest(".layout-selector-display"),i=t.parent(),e=i.find("label"),i=i.find("input[type=text]"),o=o.data("classes");i.val()&&(o=" "+o),i.insertAtCaret(o),t.slideUp(400,function(){t.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-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"),o=w("#wpforms-panel-field-settings-recaptcha"),t=(t=o.data("provider"))||"recaptcha";e.length&&(o.is(":checked")?e.show().toggleClass("is-recaptcha","recaptcha"===t):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 o=w(this),t=o.val().trim();o.val(t),wpf.isURL(t)||""===t||w.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.redirect_url_field_error,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){o.focus()}}}})})},confirmationFieldsToggle:function(e){if(!e.length)return!1;var o=e.val(),t=e.closest(".wpforms-builder-settings-block-content");t.find(".wpforms-panel-field").not(e.parent()).not(".wpforms-conditionals-enable-toggle").hide(),t.find(".wpforms-panel-field-confirmations-"+o).closest(".wpforms-panel-field").show(),"message"===o&&t.find(".wpforms-panel-field-confirmations-message_scroll").closest(".wpforms-panel-field").show()},notificationToggle:function(){var e=w("#wpforms-panel-field-settings-notification_enable"),o=e.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block"),e=e.is(":checked");w(".wpforms-notifications-add").toggleClass("wpforms-hidden",!e),e?o.show():o.hide()},notificationsByStatusAlerts:function(){g.on("change",".wpforms-panel-content-section-notifications .wpforms-notification-by-status-alert",function(e){var o,t,i=w(this);i.prop("checked")&&(t="",t=0===(o=w(".wpforms-radio-group-"+i.attr("data-radio-group")+":checked:not(#"+i.attr("id")+")")).length?(t=wpforms_builder.notification_by_status_enable_alert).replace(/%s/g,i.data("provider-title")):(t=(t=wpforms_builder.notification_by_status_switch_alert).replace(/%2\$s/g,o.data("provider-title"))).replace(/%1\$s/g,i.data("provider-title")),w.confirm({title:wpforms_builder.heads_up,content:t,backgroundDismiss:!1,closeIcon:!1,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"],o='<input autofocus="" type="text" id="settings-block-name" placeholder="'+wpforms_builder[f+"_ph"]+'">',t='<p class="error">'+wpforms_builder[f+"_error"]+"</p>",i=w.confirm({container:g,title:!1,content:e+o+t,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()),o=this.$content.find(".error");if(""===e)return o.show(),!1;var t=s.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block").first();wpf.restoreTooltips(t);var i=t.clone(),o=t.data("block-id");i.attr("data-block-id",l),i.find(".wpforms-builder-settings-block-header span").text(e),i.find("input, textarea, select").not(".from-name input").not(".from-email input").each(function(e,o){var t=w(this);t.attr("name")&&(t.val("").attr("name",t.attr("name").replace(/\[(\d+)\]/,"["+l+"]")),t.is("select")?(t.find("option").prop("selected",!1).attr("selected",!1),t.find("option:first").prop("selected",!0).attr("selected","selected")):"checkbox"===t.attr("type")?t.prop("checked",!1).attr("checked",!1).val("1"):t.val("").attr("value",""))});var a="wpforms-panel-field-"+d+"-",n=a+o;i.find('[id^="'+n+'"], [for^="'+n+'"]').each(function(e,o){var t=w(this),i="LABEL"===t.prop("tagName")?"for":"id",r=t.attr(i).replace(new RegExp(n,"g"),a+l);t.attr(i,r)});var r=o+"-notification-by-status";i.find('[data-radio-group="'+r+'"]').each(function(e,o){w(this).removeClass("wpforms-radio-group-"+r).addClass("wpforms-radio-group-"+l+"-notification-by-status").attr("data-radio-group",l+"-notification-by-status")}),i.find(".wpforms-builder-settings-block-header input").val(e).attr("value",e),"notification"===f&&(i.find(".email-msg textarea").val("{all_fields}").attr("value","{all_fields}"),i.find(".email-recipient input").val("{admin_email}").attr("value","{admin_email}")),i.removeClass("wpforms-builder-settings-block-default"),"confirmation"===f&&(i.find(".wpforms-panel-field-tinymce").remove(),"undefined"!=typeof WPForms&&i.find(".wpforms-panel-field-confirmations-type-wrap").after(WPForms.Admin.Builder.Templates.get("wpforms-builder-confirmations-message-field")({id:l})));e=i.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(i.find(".wpforms-panel-field-conditional_logic-checkbox").data("actions")),actionDesc:i.find(".wpforms-panel-field-conditional_logic-checkbox").data("action-desc")}));e=i.find(".wpforms-field-map-table");e.length&&e.each(function(e,o){var t=w(o);t.find("tr:not(:first-child)").remove();var i=t.find(".key input"),o=t.find(".field select"),t=o.data("name");i.attr("value",""),o.attr("name","").attr("data-name",t.replace(/\[(\d+)\]/,"["+l+"]"))}),i=(i=i.wrap("<div>").parent().html()).replace(/\[conditionals\]\[(\d+)\]\[(\d+)\]/g,"[conditionals][0][0]"),t.before(i);t=t.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",[t]),s.attr("data-next-id",l+1)}},cancel:{text:wpforms_builder.cancel}}});g.on("keypress","#settings-block-name",function(e){13===e.keyCode&&w(i.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 o=e.parents(".wpforms-builder-settings-block-header"),t=o.find(".wpforms-builder-settings-block-name"),i=o.find(".wpforms-builder-settings-block-name-edit"),o=i.find("input").val().trim(),e=e.closest(".wpforms-builder-settings-block").data("block-type");o.length||(o=wpforms_builder[e+"_def_name"]),i.find("input").val(o),t.text(o),t.removeClass("editing").show(),i.removeClass("active")},settingsBlockPanelClone:function(e){var o=e.closest(".wpforms-panel-content-section").find(".wpforms-builder-settings-block-add"),t=e.closest(".wpforms-builder-settings-block"),i=t.find(".wpforms-builder-settings-block-content"),r=parseInt(o.attr("data-next-id"),10),a=t.data("block-type"),e=t.find(".wpforms-builder-settings-block-name").text().trim()+wpforms_builder[a+"_clone"],i=i.is(":hidden");wpf.restoreTooltips(t);var n=t.clone(!1,!0);m.settingsBlockUpdateState(i,r,a),n.data("block-id",r),n.find(".wpforms-builder-settings-block-header span").text(e),n.find(".wpforms-builder-settings-block-header input").val(e),n.removeClass("wpforms-builder-settings-block-default"),o.attr("data-next-id",r+1),n.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+"-"))}),n.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+"]"))}),t.find("select").each(function(){var e=w(this).attr("name"),o=w(this).attr("name").replace(/\[(\d+)\]/,"["+r+"]");n.find('select[name="'+o+'"]').val(w(this).attr("name",e).val())}),n.css("display","none").insertBefore(t).show("fast",function(){wpf.initTooltips()})},settingsBlockPanelToggle:function(e){var o=e.closest(".wpforms-builder-settings-block"),t=o.data("block-id"),i=o.data("block-type"),r=o.find(".wpforms-builder-settings-block-content"),a=r.is(":visible");r.stop().slideToggle({duration:400,start:function(){m.settingsBlockUpdateState(a,t,i)},always:function(){r.is(":visible")?e.html('<i class="fa fa-chevron-circle-up"></i>'):e.html('<i class="fa fa-chevron-circle-down"></i>')}})},settingsBlockDelete:function(e){var o=e.closest(".wpforms-panel-content-section"),t=e.closest(".wpforms-builder-settings-block"),i=t.data("block-type");o.find(".wpforms-builder-settings-block").length<2||w.confirm({title:!1,content:wpforms_builder[i+"_delete"],icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"],action:function(){var e=t.data("block-id"),o=t.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:o,form_id:h.formID}),t.remove(),g.trigger("wpformsSettingsBlockDeleted",[i,e])}},cancel:{text:wpforms_builder.cancel}}})},settingsBlockUpdateState:function(e,o,t){w.post(wpforms_builder.ajax_url,{action:"wpforms_builder_settings_block_state_save",state:e?"closed":"opened",form_id:h.formID,block_id:o,block_type:t,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,o){wpf.removeQueryParam("newform")})},formSave:function(o){var e=w("#wpforms-save"),t=e.find("i.fa-check"),i=e.find("i.wpforms-loading-spinner"),r=e.find("span"),a=r.text();"undefined"!=typeof tinyMCE&&tinyMCE.triggerSave(),r.text(wpforms_builder.saving),t.addClass("wpforms-hidden"),i.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===o&&m.isBuilderInPopup()?m.builderInPopupClose("saved"):!0===o&&(n.location.href=wpforms_builder.exit_url)):(wpf.debug(e),m.formSaveError(e.data))}).fail(function(e,o,t){wpf.debug(e),m.formSaveError()}).always(function(){r.text(a),i.addClass("wpforms-hidden"),t.removeClass("wpforms-hidden")})},formSaveError:function(e){wpf.empty(e)&&(e=wpforms_builder.error_save_form),w.confirm({title:wpforms_builder.heads_up,content:"<p>"+e+"</p><p>"+wpforms_builder.error_contact_support+"</p>",icon:"fa fa-exclamation-circle",type:"orange",backgroundDismiss:!1,closeIcon:!1,buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}})},formExit:function(){m.isBuilderInPopup()&&m.formIsSaved()?m.builderInPopupClose("saved"):m.formIsSaved()?n.location.href=wpforms_builder.exit_url:w.confirm({title:!1,content:wpforms_builder.exit_confirm,icon:"fa fa-exclamation-circle",type:"orange",backgroundDismiss:!1,closeIcon:!1,buttons:{confirm:{text:wpforms_builder.save_exit,btnClass:"btn-confirm",keys:["enter"],action:function(){m.formSave(!0)}},cancel:{text:wpforms_builder.exit,action:function(){o=!1,m.isBuilderInPopup()?m.builderInPopupClose("canceled"):n.location.href=wpforms_builder.exit_url}}}})},setCloseConfirmation:function(e){o=!!e},formIsSaved:function(){return wpf.savedState==wpf.getFormState("#wpforms-builder-form")},isBuilderInPopup:function(){return n.self!==n.parent&&"wpforms-builder-iframe"===n.self.frameElement.id},builderInPopupClose:function(e){var o=n.parent.jQuery("#wpforms-builder-elementor-popup");o.find("#wpforms-builder-iframe").attr("src","about:blank"),o.fadeOut(),o.trigger("wpformsBuilderInPopupClose",[e,h.formID])},bindUIActionsGeneral:function(){g.on("click",".toggle-smart-tag-display",function(e){e.preventDefault(),m.smartTagToggle(this)}),g.on("click",".smart-tags-list-display a",function(e){e.preventDefault(),m.smartTagInsert(this)}),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(),o=w(this).parent().parent().find(".key-destination"),t=o.data("name");e&&o.attr("name",t.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 o=w(this),t=o.val(),i=o[0].selectionStart,r=o[0].selectionEnd;o.val(t.replace(/[^0-9.,]/g,"")),o[0].setSelectionRange(i,r)}),g.on("focusout",".wpforms-money-input",function(e){var o=w(this),t=o.val();if(!t)return t;t=wpf.amountSanitize(t),t=wpf.amountFormat(t);o.val(t)}),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 o=w(this),t=o.attr("id").replace("wpforms-panel-field-","").replace("-enable",""),i=w('.wpforms-panel-content-section-notifications [id*="-'+t+'-wrap"]');o.prop("checked")?w("#wpforms-panel-field-settings-disable_entries").prop("checked")?(w.confirm({title:wpforms_builder.heads_up,content:wpforms_builder.payments_entries_off,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}),o.prop("checked",!1)):i.removeClass("wpforms-hidden"):(i.addClass("wpforms-hidden"),i.find('input[id*="-'+t+'"]').prop("checked",!1))}),g.on("change","#wpforms-panel-field-settings-disable_entries",function(e){var o=w(this);o.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,backgroundDismiss:!1,closeIcon:!1,icon:"fa fa-exclamation-circle",type:"orange",buttons:{confirm:{text:wpforms_builder.ok,btnClass:"btn-confirm",keys:["enter"]}}}),o.prop("checked",!1)):w.alert({title:wpforms_builder.heads_up,content:wpforms_builder.disable_entries,backgroundDismiss:!1,closeIcon:!1,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 o=w(this),t=o.parent(),i=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}});i.on("select",function(){var e=i.state().get("selection").first().toJSON();t.find(".source").val(e.url),t.find(".preview").empty(),t.find(".preview").prepend('<img src="'+e.url+'"><a href="#" title="'+wpforms_builder.upload_image_remove+'" class="wpforms-image-upload-remove"><i class="fa fa-trash-o"></i></a>'),"hide"===o.data("after-upload")&&o.hide(),g.trigger("wpformsImageUploadAdd",[o,t])}),i.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 o(){e.prop("disabled",!1)}var t=e.attr("name"),i=e.attr("type"),r="",t=w('.wpforms-panel-field-toggle-body[data-toggle="'+t+'"]');0!==t.length?(r="checkbox"!==i&&"radio"!==i||e.prop("checked")?e.val():"0",t.each(function(){var e=w(this);e.attr("data-toggle-value").toString()===r.toString()?e.slideDown("",o):e.slideUp("",o)})):o()},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 o=w(e.target).closest(".wpforms-panel-fields-group"),t=o.find(".wpforms-panel-fields-group-inner"),e="wpforms_fields_group_"+o.data("group");o.hasClass("opened")?(wpCookies.remove(e),o.removeClass("opened"),t.stop().slideUp()):(wpCookies.set(e,"true",2592e3),o.addClass("opened"),t.stop().slideDown())},smartTagToggle:function(e){var o=w(e),t=o.closest("label");if(o.hasClass("smart-tag-showing")){var i=t.next(".smart-tags-list-display");i.slideUp(400,function(){i.remove()}),o.find("span").text(wpforms_builder.smart_tags_show)}else{var r=o.data("fields"),e=o.data("type"),a=[],a=r&&r.length?wpf.getFields(r.split(","),!0):wpf.getFields(!1,!0),n='<ul class="smart-tags-list-display unfoldable-cont">';if("fields"===e||"all"===e)if(a)for(var s in n+='<li class="heading">'+wpforms_builder.fields_available+"</li>",wpf.orders.fields){var l=wpf.orders.fields[s],s="";a[l]&&(s=a[l].label?wpf.encodeHTMLEntities(wpf.sanitizeHTML(a[l].label)):wpforms_builder.field+" #"+a[l].id,n+='<li><a href="#" data-type="field" data-meta=\''+a[l].id+"'>"+s+"</a></li>")}else n+='<li class="heading">'+wpforms_builder.fields_unavailable+"</li>";var d=-1!==t.attr("for").indexOf("wpforms-field-option-");if("all"===e&&(n+='<li class="heading">'+wpforms_builder.other+"</li>"),"other"===e||"all"===e)for(var f in wpforms_builder.smart_tags)d&&-1<wpforms_builder.smart_tags_disabled_for_fields.indexOf(f)||(n+='<li><a href="#" data-type="other" data-meta=\''+f+"'>"+wpforms_builder.smart_tags[f]+"</a></li>");t.after(n+="</ul>"),t.next(".smart-tags-list-display").slideDown(),o.find("span").text(wpforms_builder.smart_tags_hide)}o.toggleClass("smart-tag-showing")},smartTagInsert:function(e){var o=w(e),t=o.closest(".smart-tags-list-display"),i=t.parent(),r=i.find("label"),a=i.find("input[type=text]"),e=o.data("meta"),o=o.data("type");a.length||(a=i.find("textarea")),"field"===o?a.insertAtCaret('{field_id="'+e+'"}'):a.insertAtCaret("{"+e+"}"),t.slideUp(400,function(){t.remove()}),r.find(".toggle-smart-tag-display span").text(wpforms_builder.smart_tags_show),r.find(".toggle-smart-tag-display").removeClass("smart-tag-showing")},fieldMapTableDeleteRow:function(e,o){var t=w(o),i=t.closest("tr"),o=t.closest("table"),t=i.closest(".wpforms-builder-settings-block");"1"<o.find("tr").length&&(i.remove(),g.trigger("wpformsFieldMapTableDeletedRow",[t]))},fieldMapTableAddRow:function(e,o){var t=w(o).closest("tr"),o=t.closest(".wpforms-builder-settings-block"),t=t.clone().insertAfter(t);t.find("input").val(""),t.find("select :selected").prop("selected",!1),t.find(".key-destination").attr("name",""),g.trigger("wpformsFieldMapTableAddedRow",[o,t])},fieldMapSelect:function(e,l){w(".wpforms-field-map-select").each(function(e,o){var t,i=w(this),r=i.find("option:selected").val(),a=i.data("field-map-allowed"),n=i.data("field-map-placeholder");if(void 0!==n&&n||(n=wpforms_builder.select_field),i.empty().append(w("<option>",{value:"",text:n})),void 0!==a&&a){if(a=a.split(" "),l&&!w.isEmptyObject(l))for(var s in wpf.orders.fields)Object.prototype.hasOwnProperty.call(wpf.orders.fields,s)&&(t=wpf.orders.fields[s],s="",l[t]&&(s=void 0!==l[t].label&&""!==l[t].label.toString().trim()?wpf.sanitizeHTML(l[t].label.toString().trim()):wpforms_builder.field+" #"+t,(0<=w.inArray(l[t].type,a)||0<=w.inArray("all-fields",a))&&i.append(w("<option>",{value:l[t].id,text:s}))));r&&i.find('option[value="'+r+'"]').prop("selected",!0);r=i.data("custom-value-support");"boolean"==typeof r&&r&&i.append(w("<option>",{value:"custom_value",text:wpforms_builder.add_custom_value_label,class:"wpforms-field-map-option-custom-value"})),g.trigger("wpformsFieldSelectMapped",[i])}})},validateEmailSmartTags:function(e){var o=e.val();o&&(o=o.replace(/{(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))}/g,function(e){return e.slice(1,-1)}),e.val(o))},dismissNotice:function(){g.on("click",".wpforms-alert-dismissible .wpforms-dismiss-button",function(e){e.preventDefault();var e=w(this),o=e.closest(".wpforms-alert"),e=e.data("field-id");o.addClass("out"),setTimeout(function(){o.remove()},250),e&&w("#wpforms-field-option-"+e).remove()})},trimFormTitle:function(){var e,o=w(".wpforms-center-form-name");38<o.text().length&&(e=w.trim(o.text()).substring(0,38).split(" ").slice(0,-1).join(" ")+"...",o.text(e))},loadColorPickers:function(){w(".wpforms-color-picker").minicolors()},builderHotkeys:function(){w(r).keydown(function(e){if(e.ctrlKey){switch(e.keyCode){case 72:w("#wpforms-help",g).click();break;case 80:n.open(wpforms_builder.preview_url);break;case 66:w("#wpforms-embed",g).click();break;case 69:n.open(wpforms_builder.entries_url);break;case 83:w("#wpforms-save",g).click();break;case 81:w("#wpforms-exit",g).click();break;default:return}return!1}})},registerTemplates:function(){"undefined"!=typeof WPForms&&WPForms.Admin.Builder.Templates.add(["wpforms-builder-confirmations-message-field","wpforms-builder-conditional-logic-toggle-field"])},exitBack:function(){1<n.history.length&&r.referrer?n.history.back():n.location.href=wpforms_builder.exit_url}};return m}(document,window,jQuery);WPFormsBuilder.init();