((s,a,i)=>{window.history.replaceState&&window.history.replaceState(null,null,wu_checkout.baseurl),a.addAction("wu_on_create_order","nextpress/wp-ultimo",function(t,e){void 0!==e.order.extra.template_id&&(t.template_id=e.order.extra.template_id)}),a.addAction("wu_checkout_loaded","nextpress/wp-ultimo",function(t){void 0!==window.wu_auto_submittable_field&&window.wu_auto_submittable_field&&t.$watch(window.wu_auto_submittable_field,function(){jQuery(this.$el).submit()},{deep:!0})}),a.addAction("wu_checkout_loaded","nextpress/wp-ultimo",function(e){wu_create_cookie("wu_template",""),wu_create_cookie("wu_selected_products",""),wu_listen_to_cookie_change("wu_template",function(t){e.template_id=t})}),s(document).on("click",'[href|="#wu-checkout-add"]',function(t){t.preventDefault();var t=s(this),e=t.attr("href").split("#").pop().replace("wu-checkout-add-","");"undefined"!=typeof wu_checkout_form&&-1===wu_checkout_form.products.indexOf(e)&&(wu_checkout_form.add_product(e),t.html(wu_checkout.i18n.added_to_order))}),window.addEventListener("pageshow",function(t){t.persisted&&this.window.wu_checkout_form&&this.window.wu_checkout_form.unblock()}),s(document).ready(function(){var t;void 0!==window.Vue&&(Object.defineProperty(Vue.prototype,"$moment",{value:moment}),t={plan:(t=function(t){return isNaN(t)?t:parseInt(t,10)})(wu_checkout.plan),errors:[],order:wu_checkout.order,products:i.map(wu_checkout.products,t),template_id:wu_checkout.template_id,template_category:"",gateway:wu_checkout.gateway,request_billing_address:wu_checkout.request_billing_address,country:wu_checkout.country,state:"",city:"",site_url:wu_checkout.site_url,site_domain:wu_checkout.site_domain,is_subdomain:wu_checkout.is_subdomain,discount_code:"",toggle_discount_code:0,payment_method:"",username:"",payment_id:wu_checkout.payment_id,membership_id:wu_checkout.membership_id,cart_type:"new",auto_renew:1,duration:wu_checkout.duration,duration_unit:wu_checkout.duration_unit,prevent_submission:!1,valid_password:!0,stored_templates:{},state_list:[],city_list:[],labels:{}},a.applyFilters("wu_before_form_init",t),jQuery("#wu_form").length)&&(Vue.component("colorPicker",{props:["value"],template:'',mounted(){let r=this;s(this.$el).val(this.value).wpColorPicker({width:200,defaultColor:this.value,change(t,e){r.$emit("input",e.color.toString())}})},watch:{value(t){s(this.$el).wpColorPicker("color",t)}},destroyed(){s(this.$el).off().wpColorPicker("destroy")}}),window.wu_checkout_form=new Vue({el:"#wu_form",data:t,directives:{init:{bind(t,e,r){r.context[e.arg]=e.value}}},components:{dynamic:{functional:!0,template:"#dynamic",props:["template"],render(t,e){e=e.props.template;return t(e?{template:e}:"
nbsp;
")}}},computed:{hooks(){return wp.hooks},unique_products(){return i.uniq(this.products,!1,t=>parseInt(t,10))}},methods:{debounce(t){return i.debounce(t,200,!0)},open_url(t,e="_blank"){window.open(t,e)},get_template(t,e){void 0===e.id&&(e.id="default");var r=t+"/"+e.id;return void 0!==this.stored_templates[r]?this.stored_templates[r]:(r=this.hooks.applyFilters("wu_before_template_fetch",{duration:this.duration,duration_unit:this.duration_unit,products:this.products,...e},this),this.fetch_template(t,r),''+wu_checkout.i18n.loading+"
")},reset_templates(s){if(void 0===s)this.stored_templates={};else{let o={};i.forEach(this.stored_templates,function(t,e){var r=e.toString().substr(0,e.toString().indexOf("/"));!1===i.contains(s,r)&&(o[e]=t)}),this.stored_templates=o}},fetch_template(r,o){let s=this;void 0===o.id&&(o.id="default"),this.request("wu_render_field_template",{template:r,attributes:o},function(t){var e=r+"/"+o.id;t.success?Vue.set(s.stored_templates,e,t.data.html):Vue.set(s.stored_templates,e,""+t.data[0].message+"
")})},go_back(){console.log("Going back..."),this.block(),window.history.back()},set_prevent_submission(t){this.$nextTick(function(){this.prevent_submission=t})},remove_product(e,r){this.products=i.filter(this.products,function(t){return t!=e&&t!=r})},add_plan(t){this.plan&&this.remove_product(this.plan),this.plan=t,this.add_product(t)},add_product(t){this.products.push(t)},has_product(t){return-1',overlayCSS:{backgroundColor:t||"#ffffff",opacity:.6},css:{padding:0,margin:0,width:"50%",fontSize:"14px !important",top:"40%",left:"35%",textAlign:"center",color:"#000",border:"none",backgroundColor:"none",cursor:"wait"}})},unblock(){jQuery(this.$el).wu_unblock()},request(t,e,r,o){var s="wu_validate_form"===t?wu_checkout.late_ajaxurl:wu_checkout.ajaxurl;jQuery.ajax({method:"POST",url:s+"&action="+t,data:e,success:r,error:o})},check_pass_strength(){if(jQuery("#pass-strength-result").length){jQuery("#pass-strength-result").attr("class","wu-py-2 wu-px-4 wu-bg-gray-100 wu-block wu-text-sm wu-border-solid wu-border wu-border-gray-200");var t=jQuery("#field-password").val();if(t){this.valid_password=!1;var e=void 0===wp.passwordStrength.userInputDisallowedList?wp.passwordStrength.userInputBlacklist():wp.passwordStrength.userInputDisallowedList();switch(wp.passwordStrength.meter(t,e,t)){case-1:jQuery("#pass-strength-result").addClass("wu-bg-red-200 wu-border-red-300").html(pwsL10n.unknown);break;case 2:jQuery("#pass-strength-result").addClass("wu-bg-red-200 wu-border-red-300").html(pwsL10n.bad);break;case 3:jQuery("#pass-strength-result").addClass("wu-bg-green-200 wu-border-green-300").html(pwsL10n.good),this.valid_password=!0;break;case 4:jQuery("#pass-strength-result").addClass("wu-bg-green-200 wu-border-green-300").html(pwsL10n.strong),this.valid_password=!0;break;case 5:jQuery("#pass-strength-result").addClass("wu-bg-yellow-200 wu-border-yellow-300").html(pwsL10n.mismatch);break;default:jQuery("#pass-strength-result").addClass("wu-bg-yellow-200 wu-border-yellow-300").html(pwsL10n.short)}}else jQuery("#pass-strength-result").addClass("empty").html("Enter Password")}}},updated(){this.$nextTick(function(){a.doAction("wu_on_form_updated",this),wu_initialize_tooltip()})},mounted(){let o=this;jQuery(this.$el).on("click",function(t){s(this).data("submited_via",s(t.target))}),jQuery(this.$el).on("submit",async function(t){t.preventDefault();var e,t=jQuery(this).data("submited_via");t&&((e=jQuery("")).attr("type","hidden"),e.attr("name",t.attr("name")),e.attr("value",t.val()),jQuery(this).append(e)),o.block();try{var r=[];await Promise.all(a.applyFilters("wu_before_form_submitted",r,o,o.gateway))}catch(t){return o.errors=[],o.errors.push({code:"before-submit-error",message:t.message}),o.unblock(),void o.handle_errors(t)}o.validate_form(),a.doAction("wu_on_form_submitted",o,o.gateway)}),this.create_order(),a.doAction("wu_checkout_loaded",this),a.doAction("wu_on_change_gateway",this.gateway,this.gateway),jQuery("#field-password").on("input pwupdate",function(){o.check_pass_strength()}),wu_initialize_tooltip()},watch:{products(t,e){this.on_change_product(t,e)},toggle_discount_code(t){t||(this.discount_code="")},discount_code(t,e){this.on_change_discount_code(t,e)},gateway(t,e){this.on_change_gateway(t,e)},country(t,e){this.state="",this.on_change_country(t,e)},state(t,e){this.city="",this.on_change_state(t,e)},city(t,e){this.on_change_city(t,e)},duration(t,e){this.on_change_duration(t,e)},duration_unit(t,e){this.on_change_duration_unit(t,e)}}}))})})(jQuery,wp.hooks,_);