!function(p){var t={init:function(){this.handle_state_country(),this.handle_separate_shipping(),this.handle_checkout_page(),this.handle_billing_phone(),p(".user-registration-form-login-toggle").parent().find("form.user-registration-form-login").hide()},handle_separate_shipping:function(){p(".field-separate_shipping").each(function(){var t,e=p(this),i=e.closest("form.register");e.find("#separate_shipping").length&&(t=["shipping_country","shipping_first_name","shipping_last_name","shipping_company","shipping_address_1","shipping_address_2","shipping_city","shipping_state","shipping_postcode"],e.find("#separate_shipping").prop("checked")?p.each(t,function(t,e){i.find("#"+e).parent().parent().show(),i.find(".field-shipping_address_title").show()}):p.each(t,function(t,e){i.find("#"+e).parent().parent().hide(),i.find(".field-shipping_address_title").hide()}),e.find("#separate_shipping").on("change",function(){p(this).prop("checked")?p.each(t,function(t,e){i.find("#"+e).parent().parent().show(),i.find(".field-shipping_address_title").show()}):p.each(t,function(t,e){i.find("#"+e).parent().parent().hide(),i.find(".field-shipping_address_title").hide()})}))})},handle_state_country:function(){t.update_country_states({country_field_class:"field-shipping_country",state_field_class:"field-shipping_state",state_input_id:"shipping_state",state_label:"State / Country"}),t.update_country_states({country_field_class:"field-billing_country",state_field_class:"field-billing_state",state_input_id:"billing_state",state_label:"State / Country"}),p(document.body).on("change","#billing_country",function(){t.update_country_states({country_field_class:"field-billing_country",state_field_class:"field-billing_state",state_input_id:"billing_state",state_label:"State / Country"})}),p(document.body).on("change","#shipping_country",function(){t.update_country_states({country_field_class:"field-shipping_country",state_field_class:"field-shipping_state",state_input_id:"shipping_state",state_label:"State / Country"})})},handle_checkout_page:function(){var t,e=p('.woocommerce  input[type="date"]');e.length&&e.addClass("flatpickr-field").attr("type","text").flatpickr({disableMobile:!0}),p('input[type="checkbox"]#createaccount').length&&(t=p("form.woocommerce-checkout").find(".user-registration"),p('input[type="checkbox"]#createaccount').is(":checked")||t.hide(),p('input[type="checkbox"]#createaccount').on("change",function(){p(this).is(":checked")?t.slideDown(1e3):t.hide()}))},update_country_states:function(t){var e=JSON.parse(wc_country_select_params.countries.replace(/&quot;/g,'"'));if(t.country_field_class&&t.state_label&&t.state_field_class&&t.state_input_id){var i=p("."+t.country_field_class),n=p("."+t.state_field_class),a=n.find("select").val(),s=e[i.find("select").val()];0<n.find("input").length?l=n.find("input").attr("placeholder"):0<n.find("select").length&&(l=n.find("select").data("placeholder"));var i=n.find(".form-row").is(".validate-required")?'required="required"':"",e='<select id="'+t.state_input_id+'" class="select ur-frontend-field" name="'+t.state_input_id+'" '+i+'data-placeholder="'+l+'"></select>',l='<span class="input-wrapper"><input data-id="'+t.state_input_id+'" type="text" class="input-text ur-frontend-field ur-state-country without_icon" name="'+t.state_input_id+'" id="'+t.state_input_id+'" data-label="'+t.state_label+'" '+i+' placeholder="'+l+'"></span>';return n.find("select,input,span:not('.ur-portal-tooltip')").remove(),s&&!Array.isArray(s)?(n.find(".form-row").append(e),p.each(s,function(t,e){n.find("select").append("<option value="+t+">"+e+"</option>")})):"1"===p("#ur-form-field-icon").val()?(n.find(".form-row").append(l),n.find(".ur-state-country").after('<span class="ur-icon ur-icon-state"></span>'),n.find(".ur-state-country").removeClass("without_icon")):n.find(".form-row").append(l),n.find('select option[value="'+a+'"]').length&&n.val(a),!0}return!1},handle_billing_phone:function(){p("#billing_phone").on("input",function(){var t=p(this),e=t.val(),i=(e=e.replace(/[^\+0-9]/g,"")).slice(1);e=e.charAt(0).concat(i.replaceAll("+","")),t.val(e)})}};p(document).ready(function(){t.init()})}(jQuery);