!function(t,e){e.addAction("wu_checkout_loaded","nextpress/wp-ultimo",(function(){wu_create_cookie("wu_template",!1),wu_listen_to_cookie_change("wu_template",(function(t){window.wu_template_switching.template_id=t}))})),t(document).ready((function(){const i={functional:!0,template:"#dynamic",props:["template"],render(t,e){const i=e.props.template;return t(i?{template:i}:"
nbsp;
")}};e.doAction("wu_checkout_loaded"),window.wu_template_switching=new Vue({el:"#wp-ultimo-form-wu-template-switching-form",data:()=>({template_id:0,original_template_id:-1,template_category:"",stored_templates:{},confirm_switch:0,ready:!1}),directives:{init:{bind(t,e,i){i.context[e.arg]=e.value}}},components:{dynamic:i},watch:{ready(){const t=this;!1!==t.ready&&t.switch_template()}},methods:{get_template(t,e){void 0===e.id&&(e.id="default");const i=t+"/"+e.id;if(void 0!==this.stored_templates[i])return this.stored_templates[i];const o={duration:this.duration,duration_unit:this.duration_unit,products:this.products,...e};return this.fetch_template(t,o),'
Loading
'},fetch_template(t,e){const i=this;void 0===e.id&&(e.id="default"),this.request("wu_render_field_template",{template:t,attributes:e},(function(o){const a=t+"/"+e.id;o.success?Vue.set(i.stored_templates,a,o.data.html):Vue.set(i.stored_templates,a,"
"+o.data[0].message+"
")}))},switch_template(){this.block(),this.request("wu_switch_template",{template_id:this.template_id},(function(t){"string"==typeof t.data.redirect_url&&(window.location.href=t.data.redirect_url)}))},block(){const e=jQuery(this.$el).parents().filter((function(){return"rgba(0, 0, 0, 0)"!==t(this).css("backgroundColor")})).first().css("backgroundColor");jQuery(this.$el).wu_block({message:'
',overlayCSS:{backgroundColor:e||"#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,i,o){jQuery.ajax({method:"POST",url:wu_template_switching_params.ajaxurl+"&action="+t,data:e,success:i,error:o})}}})}))}(jQuery,wp.hooks);