// source --> https://createyou.hu/wp-content/plugins/foxpost-packeta-group/public/js/foxpost-wc-shipping-apt-selector.js?ver=1.0.20 
jQuery(function($) {
    window.setAptSelectorEvents = () => {
        if($("#foxpost_wc_shipping_apt_selector").length == 0) return;
        $("#foxpost_wc_shipping_apt_selector").select2({
            language: aptSelector.lang
          });
          $('#foxpost_wc_shipping_apt_selector').on('select2:select', function (e) {
              var data = e.params.data;
              foxpost_wc_shipping_public.select_parcel_box( data.id )
              
          });
                                   
          $('.woocommerce-shipping-destination').hide();  
          $('.shipping-calculator-button').hide();  
          $('.shipping-calculator-button').remove();  
          $('.woocommerce-shipping-calculator').remove();  
          
          foxpost_wc_shipping_public.init();  
          $('.foxpost-wc-shipping-map-button').click(function (event) {
              event.preventDefault();
              var modalIframe = $(this).data('modal-iframe');
              MT.modalWindow.show({iframeUrl: modalIframe, animated: true});
          }); 
    }

});
jQuery((function ($) {
    'use strict';
    $(document).ready(function () {          
       window.setAptSelectorEvents()
    });
    $(document).on('updated_checkout', function(){
        window.setAptSelectorEvents()
    })
}));