function page_generator_pro_keywords_generate_locations_update_output_types(){jQuery('body.page-generator-pro select[name="output_type[]"]').selectize().each((function(){var e=jQuery('select[name="method"]').val(),a=jQuery('select[name="country_code"]').val();"area"==e&&"GB"==a?(this.selectize.addOption({value:"street_name",text:page_generator_pro_keywords_generate_locations.options.output_types.street_name}),this.selectize.addOption({value:"zipcode_district",text:page_generator_pro_keywords_generate_locations.options.output_types.zipcode_district})):(this.selectize.removeOption("street_name"),this.selectize.removeOption("zipcode_district"))}))}function page_generator_pro_keywords_generate_locations_request(e,a){wpzinc_modal_open(page_generator_pro_keywords_generate_locations.titles.keywords_generate_location_request,page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request+" #"+a),jQuery.ajax({url:ajaxurl,type:"POST",async:!0,data:e,error:function(e,a,t){return wpzinc_modal_show_error_message(e.status+" "+e.statusText)},success:function(t){if(!t.success)return wpzinc_modal_show_error_message_and_exit(t.data);if(wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_response),e.keyword_id=t.data.keyword_id,void 0!==t.data.meta.has_more&&!0===t.data.meta.has_more)wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request_next),e.start_id=t.data.meta.next_id,page_generator_pro_keywords_generate_locations_request(e,a+=1);else{if(!(void 0!==t.data.meta.last_page&&t.data.meta.current_page<t.data.meta.last_page))return wpzinc_modal_show_success_message_and_exit(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_success+' <a href="'+t.data.keyword_url+'" rel="noopener" target="_blank">View Keyword</a>');wpzinc_modal_update_message(page_generator_pro_keywords_generate_locations.messages.keywords_generate_location_request_next),e.page=t.data.meta.current_page+1,page_generator_pro_keywords_generate_locations_request(e,a+=1)}}})}jQuery(document).ready((function($){$('body.page-generator-pro select[name="method"]').on("change.page-generator-pro",(function(){switch($(this).val()){case"radius":$("div.radius").show(),$("div.area").hide(),$('select[name="orderby"] option[value="distance"]').removeAttr("disabled");break;case"area":$("div.radius").hide(),$("div.area").show(),$('select[name="orderby"] option[value="distance"]').attr("disabled","disabled");break}page_generator_pro_keywords_generate_locations_update_output_types()})),$('body.page-generator-pro select[name="method"]').trigger("change.page-generator-pro"),$('body.page-generator-pro select[name="country_code"]').on("change.page-generator-pro",(function(){page_generator_pro_destroy_selectize(),page_generator_pro_reinit_selectize(),page_generator_pro_keywords_generate_locations_update_output_types()})),$('body.page-generator-pro select[name="country_code"]').trigger("change.page-generator-pro"),$("form#keywords-generate-locations.georocket").on("submit",(function(e){e.preventDefault(),$(".js-notices").html("");for(var a=$(this).serializeArray(),t={},r=a.length,o=0;o<r;o++)if("_wp_http_referer"!=a[o].name)switch(a[o].name){case"output_type[]":case"region_id[]":case"county_id[]":case"city_id[]":var _=a[o].name.split("[]");void 0===t[_[0]]?t[_[0]]=[a[o].value]:t[_[0]].push(a[o].value);break;default:t[a[o].name]=a[o].value;break}t.action="page_generator_pro_keywords_generate_locations",page_generator_pro_keywords_generate_locations_request(t,1)}))}));