!function(E,q){var O="wapf-",V="."+O;E.wapfTT=function(){var s=10,u=E(".wttw"),p=u.find(".wapf-ttp"),h=p[0],i=null,g=null,e="mouseleave";function t(){i=setTimeout(function(){u.is(":hover")||(u.attr({style:"","aria-hidden":!0})[0].className="wttw",g=null)},75)}E(".wapf").on("mouseenter focus",V+"tt-wrap",function(e){function t(e,t){var a,n,i,r,c,l,o,d,f;e&&(p.html(e),u[0].className="wttw",t&&u.addClass("tt-img"),a=g[0].getBoundingClientRect(),e=t?"t":(n=g.data("dir")||"r",i={v:{s:a.top-s>h.offsetHeight,e:innerHeight-(a.bottom+s)>h.offsetHeight},h:{s:a.left-s>h.offsetWidth,e:innerWidth-(a.right+s)>h.offsetWidth}},r={t:"s",b:"e",l:"s",r:"e"},c={t:"b",b:"t",l:"r",r:"l",v:"h",h:"v"},(i=i[-1<["t","b"].indexOf(n)?"v":"h"])[r[n]]?n:i[r[c[n]]]?c[n]:"t"),l=a,o=e,d=h.getBoundingClientRect(),f={x:(f={x:scrollX,y:scrollY}).x,y:f.y},"t"!=o&&"b"!=o||(f.x+=l.left+(l.width/2-d.width/2)),"t"==o&&(f.y+=l.top-d.height-s),"b"==o&&(f.y+=t?l.top+20:l.bottom+s),"l"!=o&&"r"!=o||(f.y+=l.top+(l.height/2-d.height/2)),"l"==o&&(f.x+=l.left-s-d.width),"r"==o&&(f.x+=l.right+s),u.css({left:f.x,top:f.y}),u.addClass("tt-v tt-"+e).attr("aria-hidden",!1))}clearTimeout(i);var a,n,e=E(e.currentTarget);e.is(g)||(a=(g=e).data("tip")||g.find(V+"tt-content").html()||"",g.data("zoom-url")&&780<innerWidth?((n=new Image).addEventListener("load",function(){t(a="<div>"+n.outerHTML+"</div>"+a,!0)}),n.src=g.data("zoom-url")):t(a,!1))}).on(e+" blur",V+"tt-wrap",t),u.on(e,t)};var d={f:[],add:function(e,t){d.f[e]||(d.f[e]=[]),d.f[e].push(t)},apply:function(e,t,a){return d.f[e]&&d.f[e].forEach(function(e){t=e(t,a)}),t}},P={first:function(e,t,a){for(var n=0;n<e.length;n++)if(e[n][t]===a)return e[n];return null},formulas:Object.assign({len:function(e){return(""+e[0]).replace("true"==e[1]?/\s/g:"","").length},min:function(e,t){return Math.min.apply(null,e.map(function(e){return P.parseFx(e,t)}))},max:function(e,t){return Math.max.apply(null,e.map(function(e){return P.parseFx(e,t)}))}},window.customFormulas||{}),replaceFx:function(e,t,a,n,i,r){return void 0===r&&(r=0),e=(e=(e=(""+e).replace(/\[qty]/g,t).replace(/\[price]/g,a).replace(/\[x]/g,n).replace(/\[options_total]/g,r)).replace(/\[field\.(.+?)]/g,function(e,t){return P.getFieldValue(i.find(".input-"+t).first())})).replace(/\[price\.(.+?)]/g,function(e,t){t=i.find(".input-"+t).first();return 1===t.length?P.getFieldPrice(t):0}),d.apply("fx/replace",e,{qty:t,base:a,value:n,$parent:i})},parseFx:function(c,l,e,o){void 0===l&&(l=null),void 0===e&&(e=!0),void 0===o&&(o=null),c=c.replace(/&gt;/g,">").replace(/&lt;/g,"<");return d.apply("wapf/fx/functions",Object.keys(P.formulas)).forEach(function(e){for(var t,a=e+"(";-1<(t=(""+c).indexOf(a));){var n=t+a.length,i=function(e,t){for(var a=1,n=0,i=t;i<e.length;i++)if("("==e[i]&&a++,")"==e[i]&&a===++n)return i;return t}(c,n),r=function(e){for(var t=0,a="",n=[],i=0;i<e.length;i++)";"!=e[i]||t?("("==e[i]&&t++,")"==e[i]&&t--,a+=e[i]):(n.push(a.trim()),a="");return!a.length&&n.length||n.push(a.trim()),n}(c.substring(n,i)),n=P.formulas[e]?P.formulas[e](r,l,o):"";c=d.apply("wapf/fx/solve",c.substr(0,t)+n+c.substr(i+1),{func:e,args:r,$parent:l})}}),e?P.evalFx(c):c},evalFx:function(e,f){if(void 0===f&&(f=!0),!e)return 0;function s(e){return parseFloat(e.replace(",","."))}function u(e,t){return-1<e.indexOf(t)}var p=function(e){var t=!1,a=!1,n=0;if(f&&(e=(""+e).replace(/[^\d.+\-*\/()]/gi,"")),u(e,"(")&&u(e,")")){var i=/\(([\d.+\-*\/]+)\)/;if(1<(l=e.match(i)||[]).length)return p(e.replace(i,p(l[1])))}if(e=e.replace("(","").replace(")",""),u(e,"/")||u(e,"*"))for(var t=!0,r=["/","*"];r.length;)for(var c=r.pop();c&&u(e,c);){var l,i=new RegExp("([\\d.]+)\\"+c+"(\\-?[\\d.]+)");if(!(2<(l=e.match(i)||[]).length))return 0;"+"==c&&(n=s(l[1])+s(l[2])),"-"==c&&(n=s(l[1])-s(l[2])),"*"==c&&(n=s(l[1])*s(l[2])),"/"==c&&(n=s(l[1])/s(l[2])),e=(e=e.replace(i,n)).replace("++","+").replace("--","+").replace("-+","-").replace("+-","-")}if(u(e,"+")||u(e,"-")){var a=!0,o=(e=e.replace("--","+")).match(/([\d.]+|[+\-])/g)||[];if(0<o.length)for(var n=0,c="+",d=0;d<o.length;d++)"+"==o[d]||"-"==o[d]?c=o[d]:n="+"==c?n+s(o[d]):n-s(o[d])}return n=!t&&!a?s(e):n};return p(e)},cloneField:function(e,t,a){if(!a)return e;t=t.find(".field-"+e).first();return t.length&&(t.hasClass("has-repeat")||t.hasClass("has-parent-repeat"))?e+"_clone_"+a:e},cloneFx:function(e,n,i){return i?e.replace(/\[(field\.)(.+?)]/g,function(e,t,a){return"["+t+P.cloneField(a,n,i)+"]"}).replace(/\[(price\.)(.+?)]/g,function(e,t,a){return"["+t+P.cloneField(a,n,i)+"]"}).replace(/(files|checked|lookuptable)\((.+?)\)/g,function(e,t,a){return t+"("+a.split(";").map(function(e){return P.cloneField(e,n,i)}).join(";")+")"}):e},evalVars:function(o,e,d,f,s,u,p,h){return e.replace(/\[var_.+?]/g,function(e){var t=p.data("uid");if(o[t]){var a=P.first(o[t],"name",e.replace(/\[var_|]/g,""));if(a){for(var n=a.default,i=u.data("clone")||0,r=0;r<a.rules.length;r++){var c=a.rules[r],l=P.cloneField(c.field,p,i);if(P.isValidRule(p,l,c.condition,c.value||"")){n=c.variable;break}}return P.parseFx(P.replaceFx(P.cloneFx(P.evalVars(o,n,d,f,s,u,p,h),p,i),f,s,d,p,h),p,!0,u)}}return"0"})},fxPriceHint:function(e){e=d.apply("wapf/fx/hint",e);var t=P.formatMoney(e,wapf_config.display_options),e=0<e?"+":"";return d.apply("wapf/html/fxhint",wapf_config.hint.replace("{x}",t).replace("+",e))},getFieldType:function(t){if(t.is("input"))return t.data("df")?"date":t.data("isFile")?"file":t.data("isCalc")?"calc":t.attr("type");for(var e=["select","textarea","option"],a=0;a<e.length;a++)if(t.is(e[a]))return e[a];return["select","textarea","option"].find(function(e){return t.is(e)})||""},setFieldValue:function(t,a){a=Array.isArray(a)?a:[a];function e(a){var e=t.closest(V+"field-input"),n=e.find(V+"swatch").removeClass(O+"checked").length,i=e.find(V+"input").prop("checked",!1);a.forEach(function(e,t){e=i.filter('[value="'+e+'"]');n&&e.closest(V+"swatch").addClass(O+"checked"),e.prop("checked",!0),t==a.length-1&&e.trigger("change")})}switch(P.getFieldType(t)){case"radio":e(a);break;case"checkbox":"[]"==t.attr("name").slice(-2)?e(a):t.prop("checked",a[0]===""+t.data("true-label"));break;case"file":t.val(a),E("#wapf-dz-"+t.data("fieldId"))[0].dropzone.addFromUrl(a[0]);break;case"number":if(1<a.length){t.closest(V+"swatch-wrapper").find(".wapf-input").each(function(e,t){t.value=a[e]||0});break}default:t.val(a[0])}},getFieldPrice:function(e){switch(P.getFieldType(e)){case"select":return e.find("option:selected").data("price")||0;case"radio":return e.closest(V+"field-input").find("input:checked").data("price")||0;case"checkbox":if("[]"!=e.attr("name").slice(-2))return e.is(":checked")&&e.data("price")||0;var t=0;return e.closest(V+"field-input").find("input:checked").each(function(){t+=parseFloat(E(this).data("price"))||0}),t;default:return e.data("price")||0}},getFieldValue:function(e,a){switch(void 0===a&&(a=!1),P.getFieldType(e)){case"select":return(a?e.val():e.find("option:selected").data("wapfLabel"))||"";case"radio":var t=e.closest(V+"field-input").find("input:checked");return(a?t.val():t.data("wapfLabel"))||"";case"checkbox":return"[]"==e.attr("name").slice(-2)?e.closest(V+"field-input").find("input:checked").map(function(e,t){return a?t.value:t.dataset.wapfLabel}).get():e.is(":checked");case"file":return e.is(":file")?Array.from(e[0].files).map(function(e){return e.name}).join(","):e.val();case"calc":return a?e.data("raw"):e.val();default:return e.val()}},selectedVar:null,getQty:function(e){return parseInt(e.data("$qty").val())||1},currentProductType:function(e){return e.data("productType")},currentProductPrice:function(e){var t,a,n=0;return n="variable"==e.data("productType")?(a=P.getVariation(e))&&null!==(t=null!==(t=a.apf_base)&&void 0!==t?t:a.display_price)&&void 0!==t?t:0:e.data("$totals").data("productPrice"),d.apply("wapf/pricing/base",n,{parent:e})},getVariationId:function(e){e=e.find(".variation_id").val();return e?parseInt(e):0},varsViaAjax:function(e){return 0==e.find(".variations_form").data("product_variations")},getVariation:function(e){var t=e.find(".variations_form").data("product_variations");if(!t)return P.selectedVar;e=P.getVariationId(e);return e?P.first(t,"variation_id",e):null},formatNumber:function(e,t,a,n,i){void 0===i&&(i=!1);var r,c,l=null!==t?Math.abs(e).toFixed(t).split(".")[1]||"":(""+Math.abs(e)).split(".")[1]||"",l=i?(""+l).replace(new RegExp("^0+$","g"),""):l,i=null!==t?(r=Math.abs(e),c=t,Number(Math.round(r+"e"+c)+"e-"+c).toFixed(c)):""+e,t=e<0?"-":"",e=parseInt(i,10)+"",i=3<e.length?e.length%3:0;return t+(i?e.slice(0,i)+a:"")+e.slice(i).replace(/(\d{3})(?=\d)/g,"$1"+a)+(l?n+l:"")},formatMoney:function(e,t){return e<0&&t.format.replace("%2$s","-%2$s"),t.format.replace("%1$s",t.symbol).replace("%2$s",P.formatNumber(e,t.decimals||0,t.thousand,t.decimal,t.trim_zeroes))},isValidRule:function(e,t,a,n){var i=null;if("qty"==t)i=P.getQty(e);else{if(-1<a.indexOf("product_var")||-1<a.indexOf("patts")){var r=e.data("productType");if(-1===r.indexOf("variable")&&-1===r.indexOf("variation"))return!0;var c=P.getVariation(e);if(null==c)return!1;function l(){for(var e=0;e<o.length;e++){var t=o[e].split("|");if(c.attributes&&c.attributes["attribute_pa_"+t[0]]&&("*"==t[1]||c.attributes["attribute_pa_"+t[0]]===t[1]))return!0}return!1}var o=n.split(","),d=""+c.variation_id;switch(a){case"product_var":return-1<o.indexOf(d);case"!product_var":return-1==o.indexOf(d);case"patts":return!0===l();case"!patts":return!1===l()}}e=e.find(".input-"+t).first();if(!e.length)return!1;if(e.closest(V+"field-container").hasClass(O+"hide"))return!1;i=P.getFieldValue(e,!0),"date"===P.getFieldType(e)&&n&&(i=e.data("selected"),t=n.split("-"),n=new Date(parseInt(t[2]),parseInt(t[0])-1,parseInt(t[1]))),e.hasClass("is-qty")&&(i=e.closest(V+"field-input").find("input[type=number]").map(function(e,t){return t.value||"0"}).get().filter(function(e){return"0"!=e}))}switch("number"==typeof i&&(i=i.toString()),a){case"check":return 1==i;case"!check":return 0==i;case"==":return Array.isArray(i)?-1<i.indexOf(n):i instanceof Date?i&&i.getTime()===n.getTime():i==n;case"!=":return Array.isArray(i)?-1==i.indexOf(n):i instanceof Date?i&&i.getTime()!=n.getTime():i!=n;case"empty":return Array.isArray(i)&&0===i.length||""==i;case"!empty":return!(Array.isArray(i)&&0===i.length)&&""!=i;case"==contains":return-1<i.indexOf(n);case"!=contains":return-1===i.indexOf(n);case"lt":return parseFloat(i)<parseFloat(n);case"gt":return parseFloat(i)>parseFloat(n);case"gtd":return i&&i.getTime()>n.getTime();case"ltd":return i&&i.getTime()<n.getTime()}return!1},doDependencies:function(n){function i(e){var t=e.data("wapfD");if(!Array.isArray(t))return!0;for(var a=0;a<t.length;a++)if(function(e){for(var t=0;t<e.length;t++)if(!P.isValidRule(n,e[t].field,e[t].condition,e[t].value||""))return!1;return!0}(t[a].rules))return!0;return!1}var e=n.find(".has-conditions");e.length&&(e.each(function(e,t){var a=E(t),n=i(a);n?a.removeClass(O+"hide"):a.addClass(O+"hide"),a.hasClass(O+"field-true-false")&&a.find(V+"tf-h").prop("disabled",!n),a.find(V+"input").each(function(e,t){t=E(t);t.prop("required",!!n&&a.hasClass("wapf-required")),parseInt(t.data("disabled"))||t.prop("disabled",!n)})}),q.dispatchEvent(new CustomEvent("wapf/dependencies")))},repeat:function(o,a){var e,t=a.data("dupe")||[],n=t.length+2,d=a.hasClass(O+"section"),i=(a.data("cloneTxt")||"").replace("{n}",n),r=function(e,r,t,a){e.find(V+"cloner").remove();function n(e){var t=e.data("wapfD");t&&((t=JSON.parse(JSON.stringify(t))).forEach(function(e){e.rules.forEach(function(e){var t=o.find(".field-"+e.field).first();(t.hasClass("has-repeat")||t.closest(".has-repeat").length)&&(e.field=e.field+"_clone_"+r)})}),e.attr("data-wapf-d",JSON.stringify(t)).data("wapfD",t))}var i=e.find(V+"input,.wapf-tf-h").data("clone",r),c=e.find(".has-conditions");n(e),c.each(function(e,t){n(E(t))});function l(t,e){var a=t.hasClass(O+"tf-h"),n=t.data(a?"fid":"fieldId"),i=n+"_clone_"+r;["name","id","data-field-id","data-fid"].forEach(function(e){t.attr(e)&&t.attr(e,t.attr(e).replace(n,i))}),t.data("fieldId",i),e||a||t.removeClass("input-"+n).addClass("input-"+i)}a&&l(e,!0),i.each(function(e,t){t=E(t);l(t,!1);function a(e){var t;"fx"==e.data("wapfPricetype")&&(t=P.cloneFx(e.data("wapfPrice"),o,r),e.attr("data-wapf-price",t).data("wapfPrice",t))}a(t),t.find("option").data("clone",r).each(function(e,t){a(E(t))})}),e.removeAttr("data-qty-based data-clone-txt");i=e.find(V+"field-label");return!a&&t?i.find("label > span:first-child").html(t):d||i.remove(),e}(a.clone(!0),n,i,d);return r.insertAfter(t.length?t[t.length-1]:a),d&&i&&(e=E('<div class="wapf-clone-title">'+i+"</div>").prependTo(r),r.find(".has-conditions").length&&(i=function(){e[(r.find(".wapf-field-container:not(.wapf-hide)").length?"remove":"add")+"Class"](O+"hide")},E(q).on("wapf/dependencies",i),i())),r.find("select").each(function(e,t){t=E(t);P.setFieldValue(t,P.getFieldValue(a.find(".input-"+t.data("fieldId").split("_")[0]),!0))}),E(q).trigger("wapf/cloned",[a.attr("for"),n,r,o]),t.push(r),a.data("dupe",t),r},unrepeat:function(e,t,a){var n=t.data("dupe")||[];n.splice(-1*a,a).forEach(function(e){e.remove()}),t.data("dupe",n),E(q).trigger("wapf/uncloned")},doQtyLogic:function(r,e){var c=P.getQty(r);e.each(function(e,t){var a=E(t),t=a.nextAll(".has-repeat.field-"+a.attr("for")).length,n=c-(t+1);if(0!=n)if(0<n)for(var i=0;i<n;i++)P.repeat(r,a);else P.unrepeat(r,a,-1*n)}),I.calculateAll(r)}},I={variables:[],calculateOptionTotal:function(r){function s(e,t,a,n,i){return e=P.replaceFx(e,h,p,n,r,i),e=P.evalVars(I.variables,e,n,h,p,a,r,i),e=P.parseFx(e,r,t,a)}var u=0,p=P.currentProductPrice(r),h=P.getQty(r),g=r.data("tax")||1;return r.find(V+"field-input [data-wapf-price]").each(function(e,t){var a=E(t).data("price",0),n=a.data(),i=P.getFieldType(a),r=n.wapfPricetype||"",c=""+(n.wapfPrice||"0"),l=n.wapfLabel||a.val(),o="calc"===i&&"cost"!==(n.calcType||"")?"info":"cost",d=null,f=u/h;"fx"===r&&"calc"!==i&&(d=s(c,!0,a,l,f),t=P.fxPriceHint(I.addTax(d,g)),a.is("option")&&n.fxHint?a.html(n.wapfLabel+" "+t):a.closest(".has-pricing").find(V+"pricing-hint").html(t)),!0!==a.prop("disabled")&&(-1<["checkbox","radio"].indexOf(i)&&!a.is(":checked")||("option"!=i||a.is(":selected")&&!0!==a.closest("select").prop("disabled"))&&(!(i=a.val())||n.noZero&&0==i||(null===d&&(d="fx"===r?s(c,"cost"==o,a,l,f):function(e,t,a){switch(e){case"percent":return p*(t/100)*h;case"p":return p*(t/100);case"qt":return h*t;case"nr":return a*t;case"nrq":return a*t*h;case"char":return(""+a).length*t;case"charq":return(""+a).length*t*h;default:return t}}(r,parseFloat(c||"0"),l)),a.data("price",d||0),"cost"==o&&(u+=d||0))))}),u},addTax:function(e,t,a,n){void 0===t&&(t=1),void 0===a&&(a=null),void 0===n&&(n=null);var i=wapf_config.display_options;return e&&i&&i.tax_enabled?(n=n||i.tax_display,(a=a||(i.price_incl_tax?"incl":"excl"))===n?e:"excl"===a&&"incl"===n?e*t:"incl"===a&&"excl"===n?e/t:e):e},calculateAll:function(e){var t=e.data("$totals"),a=P.formatMoney,n=e.data("tax")||1,i=I.addTax,r=wapf_config.display_options,c=P.currentProductPrice(e)*P.getQty(e),l=I.calculateOptionTotal(e),o=Math.max(0,c+l);e.data("optionsTotal",l);function d(e){var t=a(i(e,n),r);return t=r.tax_enabled&&r.tax_suffix&&r.tax_suffix.length?t+" "+r.tax_suffix.replace("{price_including_tax}",a(i(e,n,null,"incl"),r)).replace("{price_excluding_tax}",a(i(e,n,null,"excl"),r)):t}t.find(V+"product-total").html(d(c)),t.find(V+"options-total").html(d(l)),t.find(V+"grand-total").html(d(o)),E(q).trigger("wapf/pricing",[i(c),i(l),i(o),e])}};WAPF={Pricing:I,Util:P,Filter:d,Frontend:function(d){var e,t,a,n,i,r,c,l,o,f,s,u,p,h,g,v,w,m,x,b,y,_,k,F=d.find(".wapf").attr("id");function T(e){v=e.image_id,q.dispatchEvent(new CustomEvent("wapf/image_changed",{detail:{image:e}})),setTimeout(function(){E(window).trigger("resize"),d.find(".images").trigger("woocommerce_gallery_init_zoom")},15)}function C(i){i&&v!=i&&setTimeout(function(){var e=f[parseInt(i)],t=d.find("[data-wapf-att-id="+i+"]");if(t.length&&wapf_config.slider_support){var a=d.find(".images").data("flexslider");if(a){var n=a.vars?a.vars.animationSpeed:250;x&&(a.vars.animationSpeed=0);t=d.find(".flex-control-nav li").eq(E("[data-wapf-att-id]").index(t)).find("img");return t.hasClass("flex-active")||t.trigger("click"),a.vars.animationSpeed=n,x=!1,T(e)}}!function(t){b=d.find(".images .wp-post-image").eq(0),w.forEach(function(e){t[e]&&b.attr(e,t[e])}),t.srcset||b.attr("srcset",""),Object.keys(m).forEach(function(e){b.attr(e,t[m[e]])});var e=d.find(".flex-control-nav li").eq(0).find("img");e.removeAttr("srcset").attr("src",t.thumb_src),b.closest("a").attr("href",t.full_src),b.closest("div").attr("data-wapf-att-id",t.image_id),e.hasClass("flex-active")||e.trigger("click"),T(t)}(e)},5)}function A(e,t,a){(t=function(e,t,a){for(var n=0;n<a.length;n++){for(var i=a[n],r=!0,c=0;c<i.values.length;c++){var l=i.values[c];if("*"!=l.value){var o=d.find(".input-"+l.field);if(o.closest(".wapf-field-container").hasClass(O+"hide")){r=!1;break}o=P.getFieldValue(o,!0);if(!(Array.isArray(o)?-1<o.indexOf(l.value):l.value==o)||"last"===e&&l.field!=t.data("fieldId")){r=!1;break}}}if(r)return i}return null}(e=void 0===e?"rules":e,a=void 0===a?null:a,t=void 0===t?[]:t))?C(t.image):(t=P.getVariation(d),C(t?t.image_id:_))}F&&(k=(e=d.find(V+"product-totals")).data("productType"),t=d.find("[data-qty-based]"),a=d.find("form :input.qty"),n=d.find(".has-pricing"),i=d.find(V+"field-group"),d.data({uid:F,productType:k,$qty:a,$totals:e,tax:e.data("tax")||1}),E(q).trigger("wapf/before_init",[d]),q.dispatchEvent(new CustomEvent("wapf:before_init",{detail:{wrapper:d[0]}})),r=d.data("uid"),I.variables[r]=[],i.each(function(e,t){t.dataset.variables&&(I.variables[r]=I.variables[r].concat(E(t).data("variables")))}),(c=null!==d[0].querySelector(".has-conditions"))&&(d.on("keyup change",V+'input, input[name="variation_id"]',P.doDependencies.bind(this,d)),P.doDependencies(d)),F=!(l=0<n.length)&&0<d.find(V+"field-calc").length,(l||F)&&(d.on("keyup change","".concat(V,'input,input[name="variation_id"]'),I.calculateAll.bind(this,d)),t.length||a.on("keyup change",I.calculateAll.bind(this,d)),I.calculateAll(d)),t.length&&(a.on("change",P.doQtyLogic.bind(this,d,t)),P.doQtyLogic(d,t)),f=o={},s=c,w=["src","height","width","title","srcset","alt","sizes"],m={"data-src":"full_src","data-caption":"caption","data-large_image":"full_src","data-large_image_width":"full_src_w","data-large_image_height":"full_src_h"},x=!(v=null),b=d.find(".images .wp-post-image"),y=i.filter("[data-wapf-gi]"),_=null,b.length&&y.length&&(q.dispatchEvent(new CustomEvent("wapf/delete_var")),_=b.closest("div").data("wapfAttId"),d.find("[data-wapf-att-id]").each(function(e,t){var a,n,i,r=E(t),t=r.data("wapfAttId");f[t]||(f[t]=(a={image_id:(r=r).attr("data-wapf-att-id")},n=r.find("img"),i=n.data("o_src")?"data-o_":"",w.forEach(function(e){a[e]=n.attr(i+e)}),a.thumb_src=r.data("thumb"),Object.keys(m).forEach(function(e){a[m[e]]=n.attr(i+e)}),wapf_config.slider_support||(a.srcset=" "),a))}),!(u=d.find('input[name="variation_id"]')).length||(p=d.find("form.cart").data("product_variations"))&&p.forEach(function(e){e.image.image_id=e.image_id,f[e.image_id]=e.image}),h=[],g=[],y.each(function(e,t){var a=E(t),n=a.data("wapfGi"),i=a.data("group"),t=n.rules.reverse();h[i]=t,g=g.concat(t),n.images.forEach(function(e){f[e.image_id]=e});var r=a.data("wapfSt"),c=null,l=a.find(V+"input").on("change",function(e){c=E(e.currentTarget),s||A(r,h[i],c)});(c=l.filter(":visible").eq(0)).length&&A(r,h[i],c),s&&q.addEventListener("wapf/dependencies",function(){l.filter(":visible").length&&A(r,h[i],c)})}),u.on("change",function(){A("rules",g,u)})),E(q).on("found_variation",function(e,t){d.data({tax:t.tax||1}),P.varsViaAjax(d)&&(P.selectedVar=t,P.doDependencies(d),o[t.variation_id]=t),n.length&&I.calculateAll(d)}),-1<k.indexOf("varia")&&E(q).on("wapf/pricing",function(){e[0<d.find(".wapf-wrapper").height()?"show":"hide"]()}),d.on("change",V+"swatch input",function(){var e,t=E(this);t.is(":disabled")||(e=t.closest(V+"swatch"),t.is(":radio")&&e.closest(V+"field-container").find(V+"swatch").removeClass(O+"checked"),e[t.is(":checked")?"addClass":"removeClass"](O+"checked"))}),d.on("click",".wapf-single-select ",function(e){var t=E(this),a=O+"checked",n=t.find("input");!n.prop("required")&&n.is(":checked")&&t.hasClass(a)&&(n.prop("checked",!1).trigger("change"),t.removeClass(a),e.stopPropagation(),e.preventDefault())}),d.on("change",'.wapf-checkbox input[type="checkbox"], .wapf-radio input[type="radio"]',function(){var e=E(this);e.is(":radio")&&e.closest(V+"radios").find(V+"radio").removeClass(O+"checked"),e.closest(V+"radio, .wapf-checkbox").toggleClass(O+"checked",e.is(":checked"))}),d.on("click",".wapf-card:not(.is-qty-select)",function(e){"A"!==e.target.tagName&&((e=this.querySelector("input")).disabled||(this.classList.toggle(O+"checked"),e.checked=!e.checked,e.dispatchEvent(new Event("change",{bubbles:!0}))))}),(k=function(){d.find(".wapf-required").each(function(e,t){var a,t=E(t);!(t.find(V+"checkboxes").length||t.find(V+"swatch-wrapper").length||t.find(V+"card-wrap").length)||(a=t.find('input[type="checkbox"]')).length&&(t=function(){a.filter(":checked").length?a.not(":checked").prop("required",!1):a.first().prop("required",!0)},a.off("change",t).on("change",t),t(),E(q).off("wapf/dependencies",t).on("wapf/dependencies",t))})})(),E(q).on("wapf/cloned",k),(k=function(){d.find(".has-minmax").each(function(e,t){var a=E(t),n=a.find('input[type="checkbox"]'),i=a.data("maxc"),r=a.data("minc");1!==r||1!==i?(t=function(){var e,t;a.hasClass(O+"hide")||(e=n.filter("input:checked").length,t=n.not(":checked").not("[data-disabled=1]"),i&&t.prop("disabled",i<=e),r&&t.prop("required",!(!a.hasClass("wapf-required")&&!e)&&e<r))},n.off("change",t).on("change",t),t(),E(q).off("wapf/dependencies",t).on("wapf/dependencies",t)):n.on("change",function(e){this.checked&&n.filter("input:checked").length&&((e=n.not(E(e.currentTarget))).prop("checked",!1).prop("required",!1),e.closest(V+"checked").removeClass(O+"checked"))})})})(),E(q).on("wapf/cloned",k),E("body").on("adding_to_cart",function(e,t,a){if("object"!=typeof a)return a;if(-1<Object.keys(a).indexOf("wapf_field_groups"))return a;t=(t=E(t)).closest("form.cart").find(V+"wrapper :input").serializeArray();if(!t)return a;t.forEach(function(e){var t;-1<e.name.indexOf("[]")?(t=e.name.replace("[]",""),a[t]||(a[t]=[]),a[t].push(e.value)):a[e.name]=e.value})}),/^iPad|iPhone$/.test(navigator.platform||navigator.userAgent)&&d[0].querySelectorAll('.wapf input[type="radio"], .wapf input[type="checkbox"]').forEach(function(e){e.addEventListener("invalid",function(e){e.target.scrollIntoView({block:"center",behavior:"smooth"})})}),d.on("click",".apf-minus, .apf-plus",function(e){var t,a,n,i,r=jQuery(e.currentTarget).siblings("input");r.is(":disabled")||(t=jQuery(e.currentTarget).hasClass("apf-minus"),a=parseFloat(r.attr("min"))||0,i=parseFloat(r.attr("max"))||9999999,n=parseFloat(r.attr("step"))||1,(e=parseFloat(""+r.val()||"0"))!==(i=t?Math.max(e-n,a):Math.min(e+n,i))&&r.val(i).trigger("change"))}),E.wapfTT(),E(q).trigger("wapf/init",[d]),q.dispatchEvent(new CustomEvent("wapf:init",{detail:{wrapper:d[0]}})))}}}(jQuery,document),jQuery(function(a){"product"==wapf_config.page_type?new WAPF.Frontend(a("body")):a("[data-product-page-preselected-id], .wp-block-woocommerce-single-product").each(function(e,t){new WAPF.Frontend(a(t))})});