var PC=PC||{};PC.fe=PC.fe||{},PC.fe.models=PC.fe.models||{},PC.actionParameter="pc_get_data",((p,C)=>{PC.fe.config=PC.fe.config||PC_config.config,PC.fe.config=C.extend({},PC.fe.config),PC.fe.products_content=PC.fe.products_content||[],PC.fe.validation=PC.fe.validation||{},PC.fe.validation.errors=PC.fe.validation.errors||[],PC.fe.errors=PC.fe.validation.errors,PC.fe.validation.detach_live_sync=function(){var e=PC.fe.validation._live;e&&(wp.hooks.removeAction("PC.fe.choice.set_choice","mkl/pc-validation-live"),PC.fe.layers&&e._onLayerCshow&&PC.fe.layers.off("change:cshow",e._onLayerCshow),e.$container&&e._onFieldInput&&e.$container.off(".mklPcValLive"),e._debounced&&e._debounced.cancel&&e._debounced.cancel(),PC.fe.validation._live=null)},PC.fe.validation.error_layer_id=function(e){return e?e.layer?e.layer.id:e.choice&&e.choice.get?e.choice.get("layerId"):null:null},PC.fe.validation.error_touches_layer=function(e,t){return PC.fe.validation.error_layer_id(e)===t},PC.fe.validation.live_errors_equivalent=function(e,t){var o,a,n,i;return!(!e||!t||(n=e.layer?e.layer.id:null,a=t.layer?t.layer.id:null,i=e.choice&&e.choice.get?e.choice.get("layerId"):null,o=t.choice&&t.choice.get?t.choice.get("layerId"):null,a=null!=a?a:o,null==(o=null!=n?n:i))||null==a||o!==a||null==(n=e.choice?e.choice.id:null)!=(null==(i=t.choice?t.choice.id:null))||null!=n&&n!==i)},PC.fe.validation.clear_error_annotations_for_index=function(e,t,o){var a,n;e&&o&&o.length&&(a="mkl-pc-validation-error-"+t,e.choice&&((t=PC.fe.validation.get_choice_target(o,e.choice)).length&&(t.removeAttr("aria-invalid"),(n=(n=(t.attr("aria-describedby")||"").split(/\s+/).filter(Boolean)).filter(function(e){return e!==a})).length?t.attr("aria-describedby",n.join(" ")):t.removeAttr("aria-describedby"),t.attr("data-pc-validation-describedby")===a)&&t.removeAttr("data-pc-validation-describedby"),e.choice.set("has_error",!1)),e.layer)&&((n=o.find("#config-layer-"+e.layer.id).first()).length&&(n.removeAttr("aria-invalid"),(t=(t=(n.attr("aria-describedby")||"").split(/\s+/).filter(Boolean)).filter(function(e){return e!==a})).length?n.attr("aria-describedby",t.join(" ")):n.removeAttr("aria-describedby"),n.attr("data-pc-validation-describedby")===a)&&n.removeAttr("data-pc-validation-describedby"),e.layer.set("has_error",!1))},PC.fe.validation.remove_one_error_row=function(e){var t=PC.fe.validation._live;t&&e&&!e.removed&&(PC.fe.validation.clear_error_annotations_for_index(e.error,e.errorIndex,t.$container),t.$summary&&t.$summary.length&&t.$summary.find("#mkl-pc-validation-error-"+e.errorIndex).remove(),e.removed=!0)},PC.fe.validation.update_summary_counts=function(){var e,t,o=PC.fe.validation._live;o&&o.$summary&&o.$summary.length&&((e=C.filter(o.rows,function(e){return!e.removed}).length)?(e=(o._countTemplate||"%d errors found.").replace("%d",e),t=o._focusMovedText||"",(o=o.$summary.find(".mkl-pc-validation-summary__title .screen-reader-text")).length&&o.text(e+" "+t)):PC.fe.validation.clear_errors())},PC.fe.validation.sync_error_rows_for_layer_ids=function(e){var a=PC.fe.validation._live;a&&a.rows&&PC.fe.save_data&&PC.fe.save_data.collect_errors_for_layer&&(C.each(e=e||[],function(e){var t,o;null!=e&&(t=PC.fe.layers&&PC.fe.layers.get?PC.fe.layers.get(e):null)&&(o=PC.fe.save_data.collect_errors_for_layer(t),C.each(a.rows,function(t){t.removed||!PC.fe.validation.error_touches_layer(t.error,e)||C.some(o,function(e){return PC.fe.validation.live_errors_equivalent(t.error,e)})||PC.fe.validation.remove_one_error_row(t)}))}),PC.fe.validation.update_summary_counts())},PC.fe.validation.queue_row_sync_for_layer=function(e){var t=PC.fe.validation._live;t&&null!=e&&t._debounced&&(t.pendingLayerIds[e]=!0,t._debounced())},PC.fe.validation.attach_live_sync=function(e){PC.fe.validation.detach_live_sync();var o=C.extend({rows:[],pendingLayerIds:{},$container:null,$summary:null,goto_items_by_index:{},_countTemplate:"%d errors found.",_focusMovedText:""},e);(PC.fe.validation._live=o)._debounced=C.debounce(function(){var e,t=PC.fe.validation._live;t&&t.pendingLayerIds&&(e=C.keys(t.pendingLayerIds),t.pendingLayerIds={},PC.fe.validation.sync_error_rows_for_layer_ids(C.map(e,function(e){return parseInt(e,10)})))},180),o._onChoiceSet=function(e){e&&e.get&&null!=(e=e.get("layerId"))&&PC.fe.validation.queue_row_sync_for_layer(e)},wp.hooks.addAction("PC.fe.choice.set_choice","mkl/pc-validation-live",o._onChoiceSet,20),o._onLayerCshow=function(e){var t;e&&!1===e.get("cshow")&&(t=e.id,e=o.rows,C.each(e,function(e){!e.removed&&PC.fe.validation.error_touches_layer(e.error,t)&&PC.fe.validation.remove_one_error_row(e)}),PC.fe.validation.update_summary_counts())},PC.fe.layers&&PC.fe.layers.on&&PC.fe.layers.on("change:cshow",o._onLayerCshow),o._onFieldInput=function(e){var t,o,e=e.target;e&&e.id&&null!=(o=null==(o=(t=e.id.match(/^pc-field-(\d+)-/))?parseInt(t[1],10):null)&&(t=e.id.match(/^choice_(\d+)_/))?parseInt(t[1],10):o)&&PC.fe.validation.queue_row_sync_for_layer(o)},o.$container&&o.$container.length&&o.$container.on("input.mklPcValLive change.mklPcValLive","input, textarea, select",o._onFieldInput)},PC.fe.validation.get_choice_target=function(e,t){var o,a,n;return t&&e&&e.length?(o=t.get("layerId"),t=t.id,(n=e.find("#choice_"+o+"_"+t).first()).length?n:(n=e.find("#pc-field-"+o+"-"+t).first()).length?"input"!==(a=(n.prop("tagName")||"").toLowerCase())&&"textarea"!==a&&"select"!==a&&(a=n.find('input:not([type="hidden"]), textarea, select').filter(":visible").first()).length?a:n:e.find('input[type="radio"][id^="pc-field-'+o+"-"+t+'-"]').filter(":visible").first()):p()},PC.fe.validation.clear_errors=function(){PC.fe.validation.detach_live_sync();var e=p(".mkl-pc-validation-summary").first();e.length&&(e.empty().attr("hidden","hidden"),p("body").removeClass("has-validation-errors")),p('.mkl_pc .mkl_pc_container .mkl_pc_toolbar [aria-invalid="true"]').removeAttr("aria-invalid"),p(".mkl_pc .mkl_pc_container .mkl_pc_toolbar [data-pc-validation-describedby]").each(function(){var t=p(this).attr("data-pc-validation-describedby"),e=(p(this).attr("aria-describedby")||"").split(/\s+/).filter(Boolean);(e=e.filter(function(e){return e!==t})).length?p(this).attr("aria-describedby",e.join(" ")):p(this).removeAttr("aria-describedby"),p(this).removeAttr("data-pc-validation-describedby")})},PC.fe.validation.show_errors=function(e){e=e||[];var t=PC.fe.modal||{},d=t.$main_window&&t.$main_window.length?t.$main_window:p(".mkl_pc.opened .mkl_pc_container").first();if((d=d.length?d:p(".mkl_pc .mkl_pc_container:visible").first()).length){var o=t.toolbar&&t.toolbar.$el&&t.toolbar.$el.length?t.toolbar.$el:d.find(".mkl_pc_toolbar").first(),a=(o.length||(o=d),t.toolbar&&t.toolbar.$selection&&t.toolbar.$selection.length?t.toolbar.$selection:o.find("section.choices").first()),n=a&&a.length?{method:"before",$target:a}:{method:"prepend",$target:o},o={$container:d,$toolbar:o,$selection:a,modal:t},a=wp.hooks.applyFilters("PC.fe.validation.summary_placement",n,o),i=(a&&a.$target&&a.$target.length&&("before"===(t=a.method)||"prepend"===t||"after"===t||"append"===t)||(a=n),d.find(".mkl-pc-validation-summary").first()),r=i=i.length?i:p('<div class="mkl-pc-validation-summary" role="alert" aria-live="assertive" aria-atomic="true" tabindex="-1" hidden="hidden"></div>'),c=a;if(r&&r.length&&c&&c.$target&&c.$target.length)switch(c.method){case"prepend":c.$target.prepend(r);break;case"append":c.$target.append(r);break;case"after":r.insertAfter(c.$target);break;default:r.insertBefore(c.$target)}PC.fe.validation.clear_errors(),p("body").addClass("has-validation-errors");var s=[],f=[],u=[],_={},g=null,o=(C.each(e,function(e,t){var o,a,n,i=PC.utils.strip_html(e.message||""),r=(i&&s.push(i),null),c=null,l="";e.choice&&(e.choice.set("has_error",e.message),r=a=PC.fe.validation.get_choice_target(d,e.choice),c=e.choice,!g&&a.length&&(g=a,e.choice),a.length)&&(a.attr("aria-invalid","true"),(l=a.attr("id")||"")||a.attr("id",l="mkl-pc-validation-target-"+t),a.attr("data-pc-validation-describedby",o="mkl-pc-validation-error-"+t),-1===(n=(a.attr("aria-describedby")||"").split(/\s+/).filter(Boolean)).indexOf(o))&&(n.push(o),a.attr("aria-describedby",n.join(" "))),e.layer&&(e.layer.set("has_error",e.message),o=d.find("#config-layer-"+e.layer.id).first(),r&&r.length||(r=o,c=e.layer),!g&&o.length&&(g=o,e.layer),o.length)&&(o.attr("aria-invalid","true"),(l=l||o.attr("id")||"")||o.attr("id",l="mkl-pc-validation-target-"+t),o.attr("data-pc-validation-describedby",a="mkl-pc-validation-error-"+t),-1===(n=(o.attr("aria-describedby")||"").split(/\s+/).filter(Boolean)).indexOf(a))&&(n.push(a),o.attr("aria-describedby",n.join(" "))),i&&(f.push({message:i,target_id:l,index:t}),u.push({errorIndex:t,error:e,removed:!1}),c||r&&r.length)&&(_[t]={item:c,$focus:r})}),PC_config.lang&&PC_config.lang.validation_error_list_label?PC_config.lang.validation_error_list_label:"Please review the following errors:"),t=PC_config.lang&&PC_config.lang.validation_errors_found?PC_config.lang.validation_errors_found:"%d errors found.",n=t.replace("%d",s.length),a=PC_config.lang&&PC_config.lang.validation_focus_moved_to_summary?PC_config.lang.validation_focus_moved_to_summary:"Focus moved to validation summary.",l='<p class="mkl-pc-validation-summary__title">'+o+' <span class="screen-reader-text">'+n+" "+a+"</span></p><ul>";C.each(f,function(e){var t=e.message,t=e.target_id?'<a class="mkl-pc-validation-summary__error-link" href="#'+C.escape(e.target_id)+'" data-validation-index="'+e.index+'">'+C.escape(e.message)+"</a>":C.escape(e.message);l+='<li id="mkl-pc-validation-error-'+e.index+'">'+t+"</li>"}),l+="</ul>",i.html(l).removeAttr("hidden"),i.find(".mkl-pc-validation-summary__error-link").on("click",function(e){var t=parseInt(p(this).attr("data-validation-index"),10);isNaN(t)||((t=_[t])&&t.item&&PC.fe.goto?(e.preventDefault(),PC.fe.goto(t.item,{$container:d,focusEl:t.$focus,should_scroll:!0})):t&&t.$focus&&t.$focus.length&&(e.preventDefault(),t.$focus.trigger("focus")))}),u.length&&PC.fe.validation.attach_live_sync({rows:u,$container:d,$summary:i,goto_items_by_index:_,_countTemplate:t,_focusMovedText:a}),PC.fe.a11y.announce&&PC.fe.a11y.announce(n+" "+a),setTimeout(function(){i.trigger("focus")},50)}return!1},PC.fe.clear_validation_errors=PC.fe.validation.clear_errors,PC.fe.show_validation_errors=PC.fe.validation.show_errors,PC.fe.get_choice_validation_target=PC.fe.validation.get_choice_target,PC.fe.a11y=PC.fe.a11y||{},PC.fe.a11y.focus_without_scroll||(PC.fe.a11y.focus_without_scroll=function(e){PC.fe.a11y.focus(e,!0)}),PC.fe.a11y.focus||(PC.fe.a11y.focus=function(e,t=!1){e&&e.length&&(t?(t=e.get(0))&&t.focus&&t.focus({preventScroll:!0}):e.trigger("focus"))}),PC.fe.a11y.modal_focusable_selector='a[href], area[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',PC.fe.a11y.choices_panel_focusable_selector='input, select, textarea, button:not([disabled]):not([tabindex="-1"]), [tabindex]:not([tabindex="-1"])',PC.fe.a11y.is_focusable_enabled=function(e){e=p(e);return!!e.length&&!e.is(":disabled")&&"true"!==e.attr("aria-disabled")&&!e.is('input[type="hidden"]')},PC.fe.a11y.filter_focusable=function(e){return e.filter(":visible").filter(function(){return PC.fe.a11y.is_focusable_enabled(this)})},PC.fe.a11y.focus_first_in_scope=function(e,t){if(!e||!e.length)return p();t=t||PC.fe.a11y.choices_panel_focusable_selector;e=PC.fe.a11y.filter_focusable(e.find(t)).first();return e.length&&PC.fe.a11y.focus_without_scroll(e),e},PC.fe.a11y.focus_after_panel_transition=function(t,e,o){var a,n,i,r=void 0!==(o=o||{}).timeoutMs?o.timeoutMs:350,c=void 0!==o.delayIfInactive?o.delayIfInactive:50,l=o.namespace||"mklPcFocus";t&&t.length&&t.hasClass("active")?(a=!1,n=function(){t.off("transitionend."+l)},i=function(){a||(a=!0,n(),e())},t.on("transitionend."+l,function(e){e&&e.target!==t.get(0)||i()}),setTimeout(function(){n(),i()},r)):setTimeout(e,c)},PC.fe.goto||(PC.fe.goto=function(e,t){var o=(t=t||{}).should_scroll?PC.fe.a11y.focus:PC.fe.a11y.focus_without_scroll,a=PC.fe.modal||{},n=t.$container||(a.$main_window&&a.$main_window.length?a.$main_window:p()),i=((n=n.length?n:p(".mkl_pc.opened .mkl_pc_container").first()).length||(n=p(".mkl_pc .mkl_pc_container:visible").first()),null),r=(e&&(e.get&&void 0!==e.get("layerId")&&null!==e.get("layerId")?i=e.get("layerId"):void 0!==e.id&&e.get&&void 0!==e.get("type")?i=e.id:null!=e.layerId?i=e.layerId:null!=e._id&&(i=e._id)),t.layers||PC.fe.layers);if(!r||!i)return t.focusEl&&t.focusEl.length&&setTimeout(function(){o(t.focusEl)},500),!1;i=r.get?r.get(i):null;if(!i)return t.focusEl&&t.focusEl.length&&setTimeout(function(){o(t.focusEl)},500),!1;for(var c=[],l=i,d=0;l&&d++<50;){c.unshift(l.id);var s=l.get?l.get("parent"):null;if(!s)break;l=l.collection&&l.collection.get?l.collection.get(s):r.get?r.get(s):null}C.each(c,function(e){var t=r.get?r.get(e):null,t=!(!t||!t.get)&&!0===t.get("active"),o=n.find('.layers-list-item[data-layer="'+e+'"]').first();(o=!o.length&&a.$el&&a.$el.length?a.$el.find('.layers-list-item[data-layer="'+e+'"]').first():o).length&&!(t=!(t||!o.hasClass("active"))||t)&&((e=o.data("view"))&&e.show_choices?e.show_choices(null,!0):o.find("> button.layer-item").first().trigger("click"))});var f=p();return t.focusEl&&t.focusEl.length?f=t.focusEl.first():t.focusChoice&&e&&e.get&&n.length&&PC.fe.validation.get_choice_target&&(f=PC.fe.validation.get_choice_target(n,e)),f&&f.length&&(i=f.closest(".layer_choices"),PC.fe.a11y.focus_after_panel_transition(i,function(){o(f)},{namespace:"mklPcGotoFocus",timeoutMs:350,delayIfInactive:50})),!0}),PC.fe.a11y.announce||(PC.fe.a11y._announce_state=PC.fe.a11y._announce_state||{last_message:"",last_ts:0},PC.fe.a11y.announce=function(e,t){var o,a;e&&(t="number"==typeof(t=t||{}).dedupe_window?t.dedupe_window:700,o=String(e).replace(/\s+/g," ").trim())&&(e=Date.now(),PC.fe.a11y._announce_state.last_message===o&&e-PC.fe.a11y._announce_state.last_ts<t||(a=p(".mkl-pc-live-region").first()).length&&(PC.fe.a11y._announce_state.last_message=o,PC.fe.a11y._announce_state.last_ts=e,a.text(""),setTimeout(function(){a.text(o)},15)))}),p(function(){function e(e){e.preventDefault(),PC.fe.config.current_language&&(PC.fe.lang=PC.fe.config.current_language,PC.utils.add_language_filters(PC.fe.lang));var t,o=p(e.target);if((o=o.is(".configure-product")?o:o.closest(".configure-product")).data("product_id")?(t=o.data("product_id"),o.is(".is-shortcode")?PC.fe.is_using_shortcode=!0:PC.fe.is_using_shortcode=!1):p('*[name="add-to-cart"]').length&&(PC.fe.is_using_shortcode=!1,t=p('*[name="add-to-cart"]').val()),t){var a=!1;o.data("preset")&&(PC.fe.initial_preset&&(PC.fe.initial_preset,PC.fe.initial_preset==o.data("preset"))||(a=!0),PC.fe.initial_preset=o.data("preset")),o.data("view")&&(PC.fe.initial_view=o.data("view")),"mkl/pc/inline-init"==e.type&&(PC.fe.inline=!0,PC.fe.inlineTarget=e.target);try{PC.fe.open(t,t,o,a)}catch(e){console.error("we had an error: ",e),console.trace(e)}}else console.log("No product ID was found")}function t(e){e.model.get("angle_switch")&&"no"!=e.model.get("angle_switch")&&!1!==e.model.get("cshow")&&(e=PC.fe.angles.get(e.model.get("angle_switch")))&&!e.get("active")&&(e.collection.each(function(e){e.set("active",!1)}),e.set("active",!0))}PC.utils._isTouch()&&p("body").addClass("is-touch"),PC.utils._isMobile()&&p("body").addClass("is-mobile"),PC.fe.config.open_configurator||new URLSearchParams(location.search).has("open_configurator")&&(PC.fe.config.open_configurator=!0),p("body").on("keydown",function(e){p(this).hasClass("keyboard-navigation")||"Tab"!=e.key||e.ctrlKey||(p(this).addClass("keyboard-navigation"),PC.fe.keyboard_navigation=!0)}),p("body").on("pointerdown mousedown touchstart",function(){p(this).hasClass("keyboard-navigation")&&(p(this).removeClass("keyboard-navigation"),PC.fe.keyboard_navigation=!1)}),PC.fe.product_type=PC.fe.product_type||"simple",p("body").on("click",".configure-product-redq_rental",e),p("body").on("click",".configure-product-simple",e),p("body").on("mkl/pc/inline-init",".mkl-configurator-inline",e),p("form.cart").each(function(e,t){p("body").is(".is_configurable")&&!p("body").is(".enable-add-to-cart")&&p(t).find('button[name="add-to-cart"]').prop("disabled","disabled"),p(t).on("submit",function(e){p("input[name=pc_configurator_data]").val(PC.fe.save_data.save()),""==p("input[name=pc_configurator_data]").val()&&(e.preventDefault(),console.log("empty data"))})}),wp.hooks.addAction("PC.fe.start","mkl/product_configurator",function(e){var t;p('form.cart button[name="add-to-cart"]').prop("disabled",!1),p(document).on("change","form.cart input[name=quantity], .mkl_pc .form input[name=quantity]",function(e){var o=p(this).val();p("form.cart input[name=quantity], .mkl_pc .form input[name=quantity]").each(function(e,t){p(t).val(o)})}),"object"==typeof ctFrontend&&ctFrontend.hasOwnProperty("handleEntryPoints")&&ctFrontend.hasOwnProperty("allFrontendEntryPoints")&&ctFrontend.handleEntryPoints(ctFrontend.allFrontendEntryPoints),p.nmThemeInstance&&p.nmThemeInstance.quantityInputsBindButtons&&p.nmThemeInstance.quantityInputsBindButtons(p(".mkl_pc")),"function"==typeof avadaAddQuantityBoxes&&avadaAddQuantityBoxes(),wp.hooks.applyFilters("PC.fe.reset.on.start",!0)&&PC.fe.contents.content.resetConfig(),PC_config.config.swipe_to_change_view&&1<PC.fe.angles.length&&(t={triggerOnTouchEnd:!0,swipeStatus:function(e,t,o,a){var n=PC.fe.angles.findWhere({active:!0}),i=PC.fe.angles.indexOf(n),r=!1,c=0<=i-1&&PC.fe.angles.at(i-1),i=PC.fe.angles.at(i+1);"end"==t&&("right"==o&&c&&(r=c),"left"==o&&i&&(r=i),n)&&r&&(n.set("active",!1),r.set("active",!0))},allowPageScroll:"vertical",threshold:75},p(".mkl_pc_layers").swipe(t))},20),wp.hooks.addAction("PC.fe.start","mkl/product_configurator",function(e){setTimeout(function(){var e,t=PC.fe.initial_view||!1;PC_config.config.load_config_content&&Array.isArray(PC_config.config.load_config_content)?PC.fe.setConfig(PC_config.config.load_config_content):PC.fe.initial_preset&&PC.fe.setConfig(PC.fe.initial_preset),(t=window.location.hash&&(e=window.location.hash.match(/view=([^,]+)/))&&1<e.length?e[1]:t)&&(e=isNaN(t)?PC.fe.angles.findWhere({name:t}):PC.fe.angles.get(parseInt(t)))&&!e.get("active")&&(e.collection.each(function(e){e.set("active",!1)}),e.set("active",!0))},300)},50),wp.hooks.addAction("PC.fe.start","mkl/product_configurator",function(e){setTimeout(function(){wp.hooks.addAction("PC.fe.layer.activate","mkl/product_configurator",t,20),wp.hooks.addAction("PC.fe.choice.activate","mkl/product_configurator",t,20)},310)},55),wp.hooks.addAction("PC.fe.layer.activate","mkl/product_configurator",function(e){"full-screen"===e.model.get("display_mode")&&p("body").addClass("pc-full-screenlayer--opened")}),wp.hooks.addAction("PC.fe.layer.deactivate","mkl/product_configurator",function(e){"full-screen"===e.model.get("display_mode")&&p("body").removeClass("pc-full-screenlayer--opened")}),PC_config.config.open_first_layer&&wp.hooks.addAction("PC.fe.start","mkl/product_configurator",function(e){e=e.$(".layer-item:visible").first();e.parent().is(".display-mode-dropdown")||e.trigger("click")},60),p(".mkl-configurator-inline").trigger("mkl/pc/inline-init"),PC.fe.config.open_configurator&&1==PC.fe.config.open_configurator&&!p(".mkl-configurator-inline").length&&p(".configure-product-simple").first().trigger("click"),jQuery(document.body).on("wmc_cache_compatible_finish",function(e,t){t.format&&C.each(t.format,(e,t)=>{PC_config.lang[t]=e}),t.rate&&(PC.fe.config.wcpbc_rate=PC_config.config.wcpbc_rate=t.rate),wp.hooks.doAction("PC.fe.extra_price.after.get_tax_rates"),PC.fe&&PC.fe.modal&&PC.fe.modal.trigger("PC.fe.extra_price.update_taxes")})}),PC.fe.init=function(e,t,o){PC.fe.is_using_shortcode&&(this.options={}),PC.fe.trigger_el=o,t&&"async"!==PC.fe.config.data_mode?(this.currentProductData=PC.productData["prod_"+t],this.layers=new PC.layers(PC.productData["prod_"+t].layers),this.angles=new PC.angles(PC.productData["prod_"+t].angles,{parse:!0})):(this.currentProductData=PC.productData["prod_"+e],this.layers=new PC.layers(PC.productData["prod_"+e].layers),this.angles=new PC.angles(PC.productData["prod_"+e].angles,{parse:!0})),p(o).data("force_form")&&(PC.fe.currentProductData.product_info.force_form=!0),PC.fe.product_type=this.currentProductData.product_info.product_type,o?(this.currentProductData.product_info.price=o.data("price")||0,this.currentProductData.product_info.price_tiers=o.data("price_tiers"),this.currentProductData.product_info.regular_price=o.data("regular_price"),this.currentProductData.product_info.is_on_sale=1==o.data("is_on_sale")):this.currentProductData.product_info.price=0,this.currentProductData.product_info.qty=this?.modal?.form?.$("input.qty").val()||1,("simple"===PC.fe.product_type&&PC.productData["prod_"+e]||"variation"===PC.fe.product_type&&PC.productData["prod_"+e])&&(this.contents=PC.fe.setContent.parse(PC.productData["prod_"+e]),this.modal.$el.trigger("content-is-loaded")),p(document.body).trigger("mkl-pc-init",e,t),wp.hooks.doAction("PC.fe.init",e,t)},PC.fe.open=function(t,o,a,e){if(PC.fe.opened=!0,wp.hooks.doAction("PC.fe.before_open"),p("body").addClass("configurator_is_opened"),PC.fe.inline&&p("body").addClass("configurator_is_inline"),t==PC.fe.active_product)this.modal.open(),e&&PC.fe.modal&&PC.fe.modal.resetConfig();else if(t!=PC.fe.active_product&&this.modal&&(this.modal.remove(),this.modal=null,wp.hooks.doAction("PC.fe.reset_product")),PC.fe.active_product=t,PC.fe.parent_product=o||t,PC.productData&&PC.productData["prod_"+o]?(this.modal=this.modal||new PC.fe.views.configurator({product_id:t,parent_id:o}),PC.fe.init(t,o,a)):(PC.fe.config.data_mode="async",wp.hooks.addAction("mkl_pc.product_data.loaded","mkl_pc",function(e){e==t&&(this.modal=this.modal||new PC.fe.views.configurator({product_id:t,parent_id:o}),PC.fe.init(t,o,a))}.bind(this))),"async"===PC.fe.config.data_mode){a&&a.addClass("loading-data"),wp.hooks.doAction("mkl_pc.product_data.loading",t);let e=PC_config.ajaxurl+"?action=pc_get_data&data=init&fe=1&id="+t;PC_config.update_nonce&&(e+="&nonce="+encodeURIComponent(PC_config.update_nonce)),fetch(e).then(e=>e.json()).then(e=>{PC.productData=window.PC.productData||{},(PC.productData["prod_"+t]=e)?.layers?.length&&e?.content?.length||(console.log(e),a.after(p("<div>Error - the configurator data is incomplete. See browser console for data details</div>"))),a.removeClass("loading-data"),wp.hooks.doAction("mkl_pc.product_data.loaded",t)})}},PC.fe.close=function(){this.modal&&this.modal.close()},PC.fe.setContent={url:function(){var e=PC.actionParameter;return ajaxurl+"?action="+e+"&data=content&id="+this.id},idAttribute:"product_id",defaults:{product_type:"simple",modified:!1},parse:function(e){wp.hooks.doAction("PC.fe.setContent.parse.before",e);var o=new PC.content_list;return!e instanceof Object||null==e.content||0==e.content||"false"==e.content?o:(p.each(e.content,function(e,t){t=C.clone(t);t.choices&&0<t.choices.length&&PC.fe.layers.get(t.layerId)&&(t.choices=new PC.choices(t.choices,{layer:PC.fe.layers.get(t.layerId)}),o.add(t))}),{content:o})}},PC.fe.getLayerContent=PC.fe.get_layer_content=function(e){return!!PC.fe?.contents?.content.get(e)&&PC.fe.contents.content.get(e).attributes.choices},PC.fe.get_choice_model=function(e,t){e=PC.fe.get_layer_content(e);return!(!e||!t)&&e.get(t)},PC.fe.fetchContent=function(t){PC.fe.products_content[t]?(this.contents=PC.fe.products_content[t],this.modal.$el.trigger("content-is-loaded","an argument")):(this.modal.$el.show(),this.modal.$el.addClass("loading"),p.ajax({url:wp.ajax.settings.url,type:"POST",dataType:"json",data:{action:PC.actionParameter,data:"content",id:t},context:this}).done(function(e){this.modal.$el.removeClass("loading"),C.isObject(e)&&e.content?(this.contents=PC.fe.setContent.parse(e),PC.fe.products_content[t]=this.contents,e.conditions&&(PC.productData["prod_"+t]=PC.productData["prod_"+t]||{},PC.productData["prod_"+t].conditions=e.conditions),p(PC.fe).trigger("variation_content_loaded",{response:e,product_id:t}),wp.hooks.doAction("variation_content_loaded",{response:e,product_id:t}),this.modal.$el.trigger("content-is-loaded")):(alert("Couldn't load Data for this product."),1!=PC.fe.inline&&this.modal.remove())}).fail(function(){console.log("error"),this.modal.$el.addClass("loading")}))},PC.fe.fetchedContent=function(e,t,o){console.log("fetched content")},PC.fe.setConfig=function(e){PC.fe.is_setting_config=!0,wp.hooks.doAction("PC.fe.setConfig.before",e),PC.fe.contents.content.resetConfig(),p.each(e,function(e,t){try{var o=PC.fe.layers.get(t.layer_id);o&&"group"==o.get("type")||(PC.fe.getLayerContent(t.layer_id)&&PC.fe.getLayerContent(t.layer_id).selectChoice&&PC.fe.getLayerContent(t.layer_id).selectChoice(t.choice_id,!0),wp.hooks.doAction("PC.fe.setConfig.setItem",t,PC.fe.getLayerContent(t.layer_id)))}catch(e){console.log("Product configurator - setConfig: Could not set this layer:",t.layer_id,t,e)}}),wp.hooks.doAction("PC.fe.setConfig",e),PC.fe.is_setting_config=!1},PC.fe.get_product_price=function(){if(!PC.fe?.currentProductData)return 0;var e=PC.fe.currentProductData.product_info;let t=e.qty,o=parseFloat(e?.price);return e?.price_tiers&&Array.isArray(e.price_tiers)&&(e=e.price_tiers.find(e=>t>=parseInt(e.start)))&&(e.type.includes("percent")?o-=parseFloat(e.price)*parseFloat(o)/100:o=parseFloat(e.price||0)),o||0},p(document).on("yith_wacp_adding_cart_single",function(){PC&&PC.fe&&PC.fe.modal&&PC.fe.modal.$el.addClass("adding-to-cart")}),p(document).on("yith_wacp_popup_after_opening",function(){PC&&PC.fe&&PC.fe.modal&&PC.fe.modal.$el.removeClass("adding-to-cart")})})(jQuery,PC._us||window._),PC.utils=PC.utils||{_isTouch:function(){return"ontouchstart"in window||0<navigator.msMaxTouchPoints||navigator.maxTouchPoints},_isMobile:function(){return!!navigator.userAgent.match(/(iPhone|iPod|iPad|Android|playbook|silk|BlackBerry|BB10|Windows Phone|Tizen|Bada|webOS|IEMobile|Opera Mini)/)},formatMoney:function(e,t){return(t=void 0===t?!0:t)&&(e=this.maybeConvertAmountToCurrency(e)),"undefined"==typeof accounting?e:accounting.formatMoney(e,{precision:PC_config.lang.money_precision,symbol:PC_config.lang.money_symbol,decimal:PC_config.lang.money_decimal,thousand:PC_config.lang.money_thousand,format:PC_config.lang.money_format})},maybeConvertAmountToCurrency:function(e){var t;return"undefined"!=typeof woocs_current_currency&&"undefined"!=woocs_current_currency.rate?e*woocs_current_currency.rate:void 0!==PC.fe.config.wcml_rate&&parseFloat(PC.fe.config.wcml_rate)?e*parseFloat(PC.fe.config.wcml_rate):"undefined"!=typeof wc_aelia_currency_switcher_params&&"undefined"!=wc_aelia_currency_switcher_params.current_exchange_rate_from_base&&0<parseFloat(wc_aelia_currency_switcher_params.current_exchange_rate_from_base)?e*parseFloat(wc_aelia_currency_switcher_params.current_exchange_rate_from_base):void 0!==PC.fe.config.wcpbc_rate&&parseFloat(PC.fe.config.wcpbc_rate)?(t=e*parseFloat(PC.fe.config.wcpbc_rate),PC.fe.config.wcpbc_round_nearest?Math.ceil(t/PC.fe.config.wcpbc_round_nearest)*PC.fe.config.wcpbc_round_nearest:t):e},add_language_filters:function(t){function e(e){return e["name_"+t]&&""!=e["name_"+t].trim()&&(e.name=e["name_"+t]),e["description_"+t]&&""!=e["description_"+t].trim()&&(e.description=e["description_"+t]),e}wp.hooks.addFilter("PC.fe.configurator.layer_data","mkl/product_configurator",e,10),wp.hooks.addFilter("PC.fe.configurator.choice_data","mkl/product_configurator",e,10),wp.hooks.addFilter("PC.fe.configurator.angle_data","mkl/product_configurator",e,10)},strip_html:function(e){return(new DOMParser).parseFromString(e,"text/html").body.textContent||""},escape_html:function(e){return String(e).replace(/[&<>"']/g,e=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#039;"})[e])},get_message_with_vars:function(e,o){return e.replace(/{{(.*?)}}/g,(e,t)=>PC.utils.escape_html(o[t.trim()]??""))}};