"use strict";function _createForOfIteratorHelper(e,o){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=_unsupportedIterableToArray(e))||o&&e&&"number"==typeof e.length){t&&(e=t);var n=0,r=function(){};return{s:r,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return a=e.done,e},e:function(e){s=!0,i=e},f:function(){try{a||null==t.return||t.return()}finally{if(s)throw i}}}}function _unsupportedIterableToArray(e,o){if(e){if("string"==typeof e)return _arrayLikeToArray(e,o);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,o):void 0}}function _arrayLikeToArray(e,o){(null==o||o>e.length)&&(o=e.length);for(var t=0,n=new Array(o);t<o;t++)n[t]=e[t];return n}function set_wms_popup_class(){var e=document.getElementsByClassName("wms_pickup_selection_button");if(0!==e.length){var o,t=_createForOfIteratorHelper(e);try{for(t.s();!(o=t.n()).done;){var n,r=o.value,i=null===(n=document.getElementsByClassName("wc-block-components-shipping-rates-control__package")[0])||void 0===n||null===(n=n.getElementsByClassName("wc-block-components-radio-control__option-checked")[0])||void 0===n||null===(n=n.firstChild)||void 0===n?void 0:n.value;if(null==i)return;var a="";if(-1!=i.indexOf("mondial_relay"))jQuery("#wms_shipping_provider").val("mondial_relay"),a=r.getAttribute("mondial_relay_modal_id");else if(-1!=i.indexOf("chronopost"))jQuery("#wms_shipping_provider").val("chronopost"),a=r.getAttribute("chronopost_modal_id");else{if(-1==i.indexOf("ups"))return;jQuery("#wms_shipping_provider").val("ups"),a=r.getAttribute("ups_modal_id")}jQuery(r).removeAttr("wms-backbone-set"),jQuery(r).removeClass(),jQuery(r).addClass(a).addClass("wms_pickup_selection_button"),r.replaceWith(r.cloneNode(!0)),-1!=a.indexOf("google")?set_wms_google_maps_pickup_modal("wms_pickup_selection_button",a):-1!=a.indexOf("openstreetmap")?set_wms_openstreetmap_pickup_modal("wms_pickup_selection_button",a):-1!=a.indexOf("mondial_relay")&&set_wms_mondial_relay_pickup_modal("wms_pickup_selection_button",a)}}catch(e){t.e(e)}finally{t.f()}}}jQuery(function(e){function o(){var o=e(".wc-block-components-shipping-rates-control__package").find(".wc-block-components-radio-control__option-checked").first().children().first().val();void 0!==o&&(-1==o.indexOf("mondial_relay")&&-1==o.indexOf("chronopost")&&-1==o.indexOf("ups")?e("#wms_pickup_woo_block").hide():(e("#wms_pickup_woo_block").show(),set_wms_popup_class()))}o(),e(document.body).on("updated_shipping_method",function(){set_wms_popup_class()}).on("updated_wc_div",function(){set_wms_popup_class()}).on("updated_checkout",function(){set_wms_popup_class()}),e(document).ready(function(){set_wms_popup_class()}),e(document.body).on("change",".wc-block-components-shipping-rates-control__package",function(){o(),set_wms_popup_class()})});