"use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};!function(){var e={};e.api={ajaxUrl:null,getShippingMethodExtraLabelNonce:null,getPointsNonce:null,setPointNonce:null,setApiConfiguration:function(e,t,n,o){this.ajaxUrl=e,this.getShippingMethodExtraLabelNonce=t,this.getPointsNonce=n,this.setPointNonce=o},selectPoint:function(e,t,n,o,i,a,r,p,s,c,l,d,u){var h=this,g=new XMLHttpRequest;g.onreadystatechange=function(){if(4===g.readyState){var e=h.getRequestResponse(g);h.isValidResponse(e)?d({data:e.data,name:o,address:a,zipcode:r,city:p,distance:l}):u(e)}},g.open("POST",h.ajaxUrl),g.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),g.responseType="json",g.send("action=laposteproexp_set_point&carrier="+encodeURIComponent(e)+"&code="+encodeURIComponent(n)+"&name="+encodeURIComponent(o)+"&address="+encodeURIComponent(a)+"&zipcode="+encodeURIComponent(r)+"&city="+encodeURIComponent(p)+"&country="+encodeURIComponent(s)+"&openingHours="+encodeURIComponent(c)+"&network="+encodeURIComponent(i)+"&packageKey="+encodeURIComponent(t)+"&_wpnonce="+encodeURIComponent(h.setPointNonce))},getParcelPoints:function(e,t,n,o){var i=this,a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState){var e=i.getRequestResponse(a);i.isValidResponse(e)?n(e.data):o(e)}},a.open("POST",i.ajaxUrl),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.responseType="json",a.send("action=laposteproexp_get_points&carrier="+encodeURIComponent(e)+"&packageKey="+encodeURIComponent(t)+"&_wpnonce="+encodeURIComponent(i.getPointsNonce))},getMapUrl:function(e,t){var n=this,o=new XMLHttpRequest;o.onreadystatechange=function(){if(4===o.readyState){var i=n.getRequestResponse(o);n.isValidResponse(i)?e(i.data.mapUrl):t(i)}},o.open("POST",n.ajaxUrl),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),o.responseType="json",o.send("action=laposteproexp_get_map_url")},getShippingMethodExtraLabel:function(e,t,n,o){var i=this,a=new XMLHttpRequest;a.onreadystatechange=function(){if(4===a.readyState){var e=i.getRequestResponse(a);i.isValidResponse(e)?n(e.data):o(e)}},a.open("POST",i.ajaxUrl),a.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),a.responseType="json",a.send("action=laposteproexp_get_shipping_method_extra_label&shippingMethod="+encodeURIComponent(e)+"&packageKey="+encodeURIComponent(t)+"&_wpnonce="+encodeURIComponent(i.getShippingMethodExtraLabelNonce))},isValidResponse:function(e){return"object"===(void 0===e?"undefined":_typeof(e))&&null!==e&&!0===e.success&&"data"in e},getRequestResponse:function(e){return"object"===_typeof(e.response)&&null!==e.response?e.response:JSON.parse(e.response)}},e.util={translations:{},initTranslations:function(){var e="undefined"!=typeof wp&&"i18n"in wp;if(this.translations["%skm away"]=e?wp.i18n.__("%skm away","la-poste-pro-expeditions-woocommerce"):"%skm away",this.translations["Unable to find carrier"]=e?wp.i18n.__("Unable to find carrier","la-poste-pro-expeditions-woocommerce"):"Unable to find carrier",this.translations["Opening hours"]=e?wp.i18n.__("Opening hours","la-poste-pro-expeditions-woocommerce"):"Opening hours",this.translations["Choose this parcel point"]=e?wp.i18n.__("Choose this parcel point","la-poste-pro-expeditions-woocommerce"):"Choose this parcel point",this.translations["Your parcel point:"]=e?wp.i18n.__("Your parcel point:","la-poste-pro-expeditions-woocommerce"):"Your parcel point:",this.translations["Close map"]=e?wp.i18n.__("Close map","la-poste-pro-expeditions-woocommerce"):"Close map",this.translations.MONDAY=e?wp.i18n.__("MONDAY","la-poste-pro-expeditions-woocommerce"):"MONDAY",this.translations.TUESDAY=e?wp.i18n.__("TUESDAY","la-poste-pro-expeditions-woocommerce"):"TUESDAY",this.translations.WEDNESDAY=e?wp.i18n.__("WEDNESDAY","la-poste-pro-expeditions-woocommerce"):"WEDNESDAY",this.translations.THURSDAY=e?wp.i18n.__("THURSDAY","la-poste-pro-expeditions-woocommerce"):"THURSDAY",this.translations.FRIDAY=e?wp.i18n.__("FRIDAY","la-poste-pro-expeditions-woocommerce"):"FRIDAY",this.translations.SATURDAY=e?wp.i18n.__("SATURDAY","la-poste-pro-expeditions-woocommerce"):"SATURDAY",this.translations.SUNDAY=e?wp.i18n.__("SUNDAY","la-poste-pro-expeditions-woocommerce"):"SUNDAY",translations){var t=Object.keys(this.translations),n=!0,o=!1,i=undefined;try{for(var a,r=t[Symbol.iterator]();!(n=(a=r.next()).done);n=!0){var p=a.value;p in this.translations&&this.translations[p]!==translations[p]&&(this.translations[p]=translations[p])}}catch(s){o=!0,i=s}finally{try{!n&&r["return"]&&r["return"]()}finally{if(o)throw i}}}},translate:function(e){var t=e;return t in translations&&(t=this.translations[t]),t},on:function(e,t,n,o){if("undefined"!=typeof jQuery)jQuery(e).on(t,n,o);else{var i=document.querySelector(e);i.addEventListener(t,function(e){for(var t=i.querySelectorAll(n),a=e.target,r=0,p=t.length;r<p;r++)for(var s=a,c=t[r];s&&s!==i;){if(s===c)return o.call(c,e);s=s.parentNode}})}},observeDom:function(e,t,n){var o=void 0;return(o=new MutationObserver(function(e){var o=!0,i=!1,a=undefined;try{for(var r,p=e[Symbol.iterator]();!(o=(r=p.next()).done);o=!0){var s=r.value;if(t(s)){setTimeout(function(){return n()});break}}}catch(c){i=!0,a=c}finally{try{!o&&p["return"]&&p["return"]()}finally{if(i)throw a}}})).observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!1}),o},formatDistance:function(t){var n=e.util.translate("%skm away"),o=null;return null!==t&&(t=Math.round(t/100)/10,isNaN(t)||(o=" ("+this.sprintf(n,t)+")")),o},formatParcelPoingAddress:function(t,n,o,i){var a=[t,[o,n].filter(function(e){return null!==e}).join(", ")].join(" ");return null!==(i=e.util.formatDistance(i))&&(a+=" "+i),a},fillSpaces:function(e,t){for(;e.length<t;)e+=" ";return e},formatOpeningDays:function(t){for(var n=[],o=e.util.fillSpaces("",11),i=0;i<t.length;i++){var a=t[i];if(a.weekday){for(var r=e.util.translate(a.weekday).charAt(0)+" ",p=a.openingPeriods,s=[],c=0;c<p.length;c++){var l=p[c],d=l.openingTime===undefined?"":l.openingTime,u=l.closingTime===undefined?"":l.closingTime;""!==d&&""!==u?s.push(d+"-"+u):s.push(o)}r+=s.join(" "),i%2==1&&(r='<span style="background-color: #d8d8d8;">'+r+"</span>"),n.push(r)}}return'<pre class="laposteproexp-parcel-point-schedule">'+n.join("\n")+"</pre>"},formatHours:function(e){var t=e.split(":");return 3===t.length&&(e=t[0]+":"+t[1]),e},isWoocommerceBlocks:function(){return"wc"in window&&"blocksCheckout"in window.wc&&"wcSettings"in window.wc&&window.wc.wcSettings.getSetting("la-poste-pro-expeditions-woocommerce-parcel-point_data")},sprintf:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){for(var t=arguments.length,n=Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];if("undefined"!=typeof sprintf)return sprintf.apply(undefined,[e].concat(n));var i=!0,a=!1,r=undefined;try{for(var p,s=n[Symbol.iterator]();!(i=(p=s.next()).done);i=!0){var c=p.value;e=e.replace("%s",c)}}catch(l){a=!0,r=l}finally{try{!i&&s["return"]&&s["return"]()}finally{if(a)throw r}}return e}),showError:function(t){e.map.close(),console.error(t)}},e.map={mapContainer:null,map:null,markers:[],mapLogoImageUrl:null,mapLogoHrefUrl:null,setMapConfiguration:function(e,t){this.mapLogoImageUrl=e,this.mapLogoHrefUrl=t},buildMapContainer:function(t){var n=this,o=document.createElement("div"),i=e.util.translate("Close map");o.setAttribute("class","laposteproexp-close"),o.setAttribute("title",i),o.addEventListener("click",function(){n.close()});var a=document.createElement("div");a.setAttribute("id","laposteproexp-map-canvas");var r=document.createElement("div");r.setAttribute("id","laposteproexp-map-container"),r.appendChild(a);var p=document.createElement("div");p.setAttribute("id","laposteproexp-pp-container");var s=document.createElement("div");s.setAttribute("id","laposteproexp-map-inner"),s.appendChild(o),s.appendChild(r),s.appendChild(p);var c=document.createElement("div");c.setAttribute("id","laposteproexp-map"),c.appendChild(s),document.body.appendChild(c),n.map=new maplibregl.Map({container:"laposteproexp-map-canvas",style:t,zoom:14,accessToken:"whatever"}),n.map.addControl(new maplibregl.NavigationControl);var l=document.createElement("img");l.setAttribute("src",n.mapLogoImageUrl);var d=document.createElement("a");d.setAttribute("href",n.mapLogoHrefUrl),d.setAttribute("target","_blank"),d.appendChild(l);var u=document.createElement("div");u.setAttribute("id","laposteproexp-logo"),u.appendChild(d);var h=document.querySelector(".maplibregl-ctrl-top-left");return h&&h.appendChild(u),c},init:function(t){var n=this;n.mapContainer=document.querySelector("#laposteproexp-map"),n.mapContainer?t():e.api.getMapUrl(function(e){n.mapContainer=n.buildMapContainer(e),t()},function(e){"object"===(void 0===e?"undefined":_typeof(e))&&"data"in e&&n.showError(e.data.message)})},open:function(){this.mapContainer.classList.add("laposteproexp-modal-show");var e=window.pageYOffset+(window.innerHeight-this.mapContainer.offsetHeight)/2;e<window.pageYOffset&&(e=window.pageYOffset),this.mapContainer.style.top=e+"px",this.map.resize()},close:function(){this.mapContainer.classList.remove("laposteproexp-modal-show"),this.clearMarkers()},addParcelPointMarkers:function(e,t){for(var n=0;n<e.length;n++)e[n].index=n,this.addParcelPointMarker(e[n],t)},addParcelPointMarker:function(t,n){var o=e.util.translate("Choose this parcel point"),i=e.util.translate("Opening hours"),a='<div class="laposteproexp-marker-popup"><b>'+t.parcelPoint.name+'</b><br/><a href="#" class="laposteproexp-parcel-point-button" '+this.generateParcelPointTagData(t,n)+"><b>"+o+"</b></a><br/>"+t.parcelPoint.location.street+", "+t.parcelPoint.location.zipCode+" "+t.parcelPoint.location.city+"<br/><b>"+i+"</b><br/>";a+=e.util.formatOpeningDays(t.parcelPoint.openingDays);var r=this.getMarkerHtmlElement(t.index+1),p=new maplibregl.Popup({offset:25}).setHTML(a),s=new maplibregl.Marker({element:r,anchor:"bottom"}).setLngLat(new maplibregl.LngLat(parseFloat(t.parcelPoint.location.position.longitude),parseFloat(t.parcelPoint.location.position.latitude))).setPopup(p).addTo(this.map);this.markers.push(s),this.addRightColMarkerEvent(s,t.parcelPoint.code)},generateParcelPointTagData:function(e,t){var n='data-code="'+e.parcelPoint.code+'" data-name="'+encodeURIComponent(e.parcelPoint.name)+'" data-network="'+e.parcelPoint.network+'" data-zipcode="'+encodeURIComponent(e.parcelPoint.location.zipCode)+'" data-country="'+encodeURIComponent(e.parcelPoint.location.country)+'" data-city="'+encodeURIComponent(e.parcelPoint.location.city)+'" data-street="'+encodeURIComponent(e.parcelPoint.location.street)+'" data-openinghours="'+encodeURIComponent(JSON.stringify(e.parcelPoint.openingDays))+'" data-distance="'+encodeURIComponent(JSON.stringify(e.distanceFromSearchLocation))+'" ';for(var o in t)n+="data-"+o+'="'+t[o]+'" ';return n},addRightColMarkerEvent:function(t,n){e.util.on("body","click",".laposteproexp-show-info-"+n,function(){t.togglePopup()})},addRecipientMarker:function(e){var t=document.createElement("div");t.className="laposteproexp-marker-recipient";var n=new maplibregl.Marker({element:t,anchor:"bottom"}).setLngLat(new maplibregl.LngLat(parseFloat(e.position.longitude),parseFloat(e.position.latitude))).addTo(this.map);this.markers.push(n)},setMapBounds:function(){for(var e=new maplibregl.LngLatBounds,t=0;t<this.markers.length;t++){var n=this.markers[t];e=e.extend(n.getLngLat())}this.map.fitBounds(e,{padding:30,linear:!0})},fillParcelPointPanel:function(t,n){var o=e.util.translate("Choose this parcel point"),i="";i+="<table><tbody>";for(var a=0;a<t.length;a++){var r=t[a],p=e.util.formatDistance(r.distanceFromSearchLocation);i+="<tr>",i+="<td>"+this.getMarkerHtmlElement(a+1).outerHTML,i+='<div class="laposteproexp-parcel-point-title"><a class="laposteproexp-show-info-'+r.parcelPoint.code+'">'+r.parcelPoint.name+"</a></div><br/>",i+=r.parcelPoint.location.street+"<br/>",i+=r.parcelPoint.location.zipCode+" "+r.parcelPoint.location.city+(null!==p?p:"")+"<br/>",i+='<a class="laposteproexp-parcel-point-button" '+this.generateParcelPointTagData(r,n)+"><b>"+o+"</b></a>",i+="</td>",i+="</tr>"}i+="</tbody></table>",document.querySelector("#laposteproexp-pp-container").innerHTML=i},getMarkerHtmlElement:function(e){var t=document.createElement("div");return t.className="laposteproexp-marker",t.innerHTML=e,t},clearMarkers:function(){for(var e=0;e<this.markers.length;e++)this.markers[e].remove();this.markers=[]},getPoints:function(t,n,o,i){var a=this;e.api.getParcelPoints(t,n,function(e){a.addParcelPointMarkers(e.nearbyParcelPoints,o),a.fillParcelPointPanel(e.nearbyParcelPoints,o),a.addRecipientMarker(e.searchLocation),a.setMapBounds()},function(e){"object"===(void 0===e?"undefined":_typeof(e))&&"data"in e&&i(e.data.message)})}},e.blocks={cache:{},init:function(){var t=this,n=(0,window.wc.wcSettings.getSetting)("la-poste-pro-expeditions-woocommerce-parcel-point_data");if(e.util.initTranslations(),n){e.api.setApiConfiguration(n.ajaxurl,n.getShippingMethodExtraLabelNonce,n.getPointsNonce,n.setPointNonce),e.map.setMapConfiguration(n.mapLogoImageUrl,n.mapLogoHrefUrl);var o=!1;t.onCartChange(function(){t.updateAllShippingMethodGroups(),o||(o=!0,jQuery("body").on("input",t.getShippingMethodInputsSelector(),function(){return t.updateAllShippingMethodGroups()}))}),jQuery("body").on("click",".wc-block-components-panel__button",function(){t.updateAllShippingMethodGroups()}),jQuery("body").on("click",".laposteproexp-select-parcel",function(n){var o=jQuery(n.target).closest(t.getShippingMethodsBlockSelector()).find("input:checked").first()[0];e.map.init(function(){e.map.open(o),t.getMapPoints(o)})}),jQuery("body").on("click",".laposteproexp-parcel-point-button",function(){var n=wp.i18n.__,o=document.getElementById(this.getAttribute("data-input")),i=t.getShippingMethod(o),a=t.getPackageKey(o);i||e.util.showError(n("Unable to find carrier","la-poste-pro-expeditions-woocommerce")),e.api.selectPoint(i,a,this.getAttribute("data-code"),decodeURIComponent(this.getAttribute("data-name")),this.getAttribute("data-network"),decodeURIComponent(this.getAttribute("data-street")),decodeURIComponent(this.getAttribute("data-zipcode")),decodeURIComponent(this.getAttribute("data-city")),decodeURIComponent(this.getAttribute("data-country")),decodeURIComponent(this.getAttribute("data-openinghours")),decodeURIComponent(this.getAttribute("data-distance")),function(n){var r=n.data;t.updateShippingMethodExtraLabelCache(a,i,r.label),t.refreshShippingMethodExtraLabel(o),e.map.close()},function(t){"object"===(void 0===t?"undefined":_typeof(t))&&"data"in t&&e.util.showError(t.data.message)})})}else console.error("[la-poste-pro-expeditions-woocommerce] Failed to load plugin configuration (blocks)")},getMapPoints:function(t){var n=wp.i18n.__,o=this,i=o.getShippingMethod(t),a=o.getPackageKey(t),r={input:t.id,"shipping-method":i,"package-key":a};i&&-1!==a||e.util.showError(n("Unable to find carrier","la-poste-pro-expeditions-woocommerce")),e.map.getPoints(i,a,r,function(e){return o.showError(e)})},updateAllShippingMethodGroups:function(){var e=this.getShippingMethodRadioGroups(),t=!0,n=!1,o=undefined;try{for(var i,a=e[Symbol.iterator]();!(t=(i=a.next()).done);t=!0){var r=i.value;this.updateShippingMethodGroup(r)}}catch(p){n=!0,o=p}finally{try{!t&&a["return"]&&a["return"]()}finally{if(n)throw o}}},updateShippingMethodGroup:function(t){var n=wp.i18n.__,o=this,i=Array.from(jQuery(t).find("input")),a=!0,r=!1,p=undefined;try{for(var s,c=function(){var t=s.value;if(o.refreshShippingMethodExtraLabel(t),t.checked){var i=o.getShippingMethod(t),a=o.getPackageKey(t);i!==undefined&&-1!==a&&e.api.getShippingMethodExtraLabel(i,a,function(e){o.updateShippingMethodExtraLabelCache(a,i,e.label),o.refreshShippingMethodExtraLabel(t)},function(){e.util.showError(n("Unable to find carrier","la-poste-pro-expeditions-woocommerce"))})}},l=i[Symbol.iterator]();!(a=(s=l.next()).done);a=!0)c()}catch(d){r=!0,p=d}finally{try{!a&&l["return"]&&l["return"]()}finally{if(r)throw p}}},getShippingMethodRadioGroups:function(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:null,t=this,n=jQuery(document.body).find(t.getShippingMethodsBlockSelector()).find(".wc-block-components-radio-control");return null!==e&&(n=n.filter(function(n,o){return t.radioGroupHasInput(o,e)})),Array.from(n).filter(function(e,t,n){return n.indexOf(e)===t})},radioGroupHasInput:function(e,t){return jQuery(e).find('input[id="'+t.id+'"]').length>0},getPackageKey:function(e){var t=this,n=t.getShippingMethodRadioGroups().findIndex(function(n){return t.radioGroupHasInput(n,e)});return n>0?"subscription":n},getShippingMethod:function(e){return jQuery(e).val()},getShippingMethodInputsSelector:function(){var e=this;return e.getShippingMethodsBlockClasses().map(function(t){return"."+t+" "+e.getShippingMethodsRadioControlSelector()}).join(", ")},getShippingMethodsBlockSelector:function(){return this.getShippingMethodsBlockClasses().map(function(e){return"."+e}).join(", ")},getShippingMethodTextLabelSelector:function(){return".wc-block-components-radio-control__label"},getShippingMethodsBlockClasses:function(){return["wp-block-woocommerce-cart-order-summary-shipping-block","wc-block-components-shipping-rates-control__package"]},getShippingMethodsRadioControlSelector:function(){return".wc-block-components-radio-control input"},onCartChange:function(t){var n=this;jQuery(n.getShippingMethodsBlockSelector()).filter(function(e,t){return n.isBlockReady(t)}).length>0&&t(),e.util.observeDom(document.body,function(e){var t=!1;if(e.addedNodes)for(var o=0;o<e.addedNodes.length;o++){var i=e.addedNodes[o];if(n.isBlockReady(i)){t=!0;break}}if(e.removedNodes&&!t)for(var a=0;a<e.removedNodes.length;a++){var r=e.removedNodes[a];if(n.isLoaderBlock(r)){t=!0;break}}return t},t)},isBlockReady:function(e){return this.getShippingMethodsBlockClasses().filter(function(t){return e.classList&&e.classList.contains(t)}).length>0&&jQuery(e).find(this.getShippingMethodsRadioControlSelector()).has(":checked")},isLoaderBlock:function(e){return e.classList&&e.classList.contains("wc-block-components-spinner")},updateShippingMethodExtraLabelCache:function(e,t,n){e in this.cache||(this.cache[e]={}),this.cache[e][t]=n},getShippingMethodCachedExtraLabel:function(e,t){return e in this.cache&&t in this.cache[e]?this.cache[e][t]:null},refreshShippingMethodExtraLabel:function(e){var t=this.getShippingMethod(e),n=this.getPackageKey(e),o=this.getShippingMethodCachedExtraLabel(n,t);jQuery('*[for="'+e.id+'"] .laposteproexp-extra-label').remove(),e.checked&&null!==o&&jQuery(this.getShippingMethodsBlockSelector()).find("label").has(e).find(this.getShippingMethodTextLabelSelector()).each(function(e,t){var n=document.createElement("span");n.className="laposteproexp-extra-label",n.innerHTML="<br/>"+o,t.appendChild(n)})}},e.legacy={init:function(){var t=this,n=t.getFrontendData();e.util.initTranslations(),null!==n?(e.api.setApiConfiguration(n.ajaxurl,n.getShippingMethodExtraLabelNonce,n.getPointsNonce,n.setPointNonce),e.map.setMapConfiguration(n.mapLogoImageUrl,n.mapLogoHrefUrl),e.util.on("body","click",".laposteproexp-select-parcel",function(n){var o=n.target.attributes.getNamedItem("data-package_key").value,i=n.target.attributes.getNamedItem("data-shipping_rate_id").value;e.map.init(function(){e.map.open(),t.getMapPoints(i,o)})}),e.util.on("body","click",".laposteproexp-parcel-point-button",function(n){var o=e.util.translate("Unable to find carrier"),i=this.getAttribute("data-package-key"),a=this.getAttribute("data-shipping-rate-id");a&&i||e.util.showError(o),e.api.selectPoint(a,i,this.getAttribute("data-code"),decodeURIComponent(this.getAttribute("data-name")),this.getAttribute("data-network"),decodeURIComponent(this.getAttribute("data-street")),decodeURIComponent(this.getAttribute("data-zipcode")),decodeURIComponent(this.getAttribute("data-city")),decodeURIComponent(this.getAttribute("data-country")),decodeURIComponent(this.getAttribute("data-openinghours")),decodeURIComponent(this.getAttribute("data-distance")),function(n){var o=n.name,a=n.address,r=n.zipcode,p=n.city,s=n.distance;t.initSelectedParcelPoint(i);for(var c=document.querySelectorAll(".laposteproexp-parcel-address-"+i),l=document.querySelectorAll(".laposteproexp-parcel-name-"+i),d=0;d<c.length;++d)c[d].innerHTML=e.util.formatParcelPoingAddress(a,p,r,s);for(var u=0;u<l.length;++u)l[u].innerHTML=o;e.map.close()},function(t){"object"===(void 0===t?"undefined":_typeof(t))&&"data"in t&&e.util.showError(t.data.message)})})):console.error("[la-poste-pro-expeditions-woocommerce] Failed to load plugin configuration (legacy)")},getFrontendData:function(){var e=null;if("undefined"!=typeof laposteproexpData)e=laposteproexpData;else if("wc"in window&&"wcSettings"in window.wc){var t=window.wc.wcSettings.getSetting("la-poste-pro-expeditions-woocommerce-parcel-point_data");t&&(e=t)}return e},initSelectedParcelPoint:function(t){var n=e.util.translate("Your parcel point:"),o=document.querySelector(".laposteproexp-parcel-client-"+t);o.innerHTML=n+" ";var i=document.createElement("span");i.setAttribute("class","laposteproexp-parcel-name-"+t),o.appendChild(i)},getMapPoints:function(t,n){var o={"shipping-rate-id":t,"package-key":n};e.map.getPoints(t,n,o,function(t){return e.util.showError(t)})},getSelectedCarrier:function(){var e=void 0,t=document.querySelector('input[type="hidden"].shipping_method');t?e=t.getAttribute("value"):e=document.querySelector("input.shipping_method:checked").getAttribute("value");return e}},document.addEventListener("DOMContentLoaded",function(){e.util.isWoocommerceBlocks()?e.blocks.init():e.legacy.init()})}();