// source --> https://www.glassbutikk.no/wp-content/plugins/woocommerce-measurement-price-calculator/assets/js/frontend/wc-measurement-price-calculator.min.js?ver=3.17.0 
"use strict";jQuery(document).ready(function(l){if(l.cookie.json=!0,l(document).bind("reset_image",function(){wc_price_calculator_params.product_price="",wc_price_calculator_params.product_measurement_value="",wc_price_calculator_params.product_measurement_unit="",l(".variable_price_calculator").hide()}),l(".wc-measurement-price-calculator-input-help").tipTip({attribute:"title",defaultPosition:"left"}),"undefined"!=typeof wc_price_calculator_params&&"pricing"===wc_price_calculator_params.calculator_type&&(l("form.cart").bind("wc-measurement-price-calculator-update",function(){var n;if(l(".amount_needed:input").each(function(a,e){e=l(e);var r=d("number"===l(this).attr("type")?e.val():w(e.val()));e.trigger("wc-measurement-price-calculator-product-measurement-change",[r])}),l(".amount_needed:input").each(function(a,e){e=l(e);var r=d("number"===l(this).attr("type")?e.val():w(e.val()));if(!r||r<0)return n=0,!1;if(r=s(r,e.data("unit"),e.data("common-unit")),"area-linear"===wc_price_calculator_params.measurement_type)n?n+=2*r:n=2*r;else if("area-surface"===wc_price_calculator_params.measurement_type){if(!n){var c=w(l("#length_needed").val());c=s(d(c),l("#length_needed").data("unit"),l("#length_needed").data("common-unit"));var t=w(l("#width_needed").val());t=s(d(t),l("#width_needed").data("unit"),l("#width_needed").data("common-unit"));var i=w(l("#height_needed").val());return i=s(d(i),l("#height_needed").data("unit"),l("#height_needed").data("common-unit")),void(n=2*(c*t+t*i+c*i))}}else n?n*=r:n=r}),n=s(n,wc_price_calculator_params.product_total_measurement_common_unit,wc_price_calculator_params.product_price_unit),wc_price_calculator_params.pricing_rules){var a=function(r){var c=null;return l.each(wc_price_calculator_params.pricing_rules,function(a,e){if(r>=parseFloat(e.range_start)&&(""===e.range_end||r<=e.range_end))return c=e,!1}),c}(n);a?(wc_price_calculator_params.product_price=parseFloat(a.price),l(".single_variation span.price").html(a.price_html)):(wc_price_calculator_params.product_price="",l(".single_variation span.price").html(""))}l("#_measurement_needed").val(n),l("#_measurement_needed_unit").val(wc_price_calculator_params.product_price_unit);var e=0,r=0,c=parseFloat(wc_price_calculator_params.pricing_overage),t=l(".product_price"),i=l(".product_price_overage");n?(e=wc_price_calculator_params.product_price*n,wc_price_calculator_params.minimum_price>e&&(e=parseFloat(wc_price_calculator_params.minimum_price)),0<c&&(e+=r=e*c,i.html(g(r))),t.html(g(e)).trigger("wc-measurement-price-calculator-product-price-change",[n,e])):(t.html("").trigger("wc-measurement-price-calculator-product-price-change"),0<c&&i.html(""));var o=null;if(o=l(".wc-measurement-price-calculator-total-amount")){var _=wc_price_calculator_params,u=s(n,_.product_price_unit,o.data("unit"));u=parseFloat(n.toFixed(_.measurement_precision)),o.text(m(u,_.measurement_precision,_.woocommerce_price_decimal_sep,_.woocommerce_price_thousand_sep))}if("undefined"!=typeof woocommerce_addons_params&&0<l("form.cart").find("#product-addons-total").length){var p=""===e?0:e;woocommerce_addons_params.product_price=p.toFixed(2),l("form.cart").trigger("woocommerce-product-addons-update")}}),l("form.cart").trigger("wc-measurement-price-calculator-update"),l(".amount_needed:input").on("keyup change mpc-change",function(){var a=l(this).closest("form.cart");a.trigger("wc-measurement-price-calculator-update"),r(a)}).first().trigger("mpc-change"),l(".single_variation, .single_variation_wrap").bind("show_variation",function(a,e){var r=parseFloat(e.price),c=parseFloat(e.minimum_price);wc_price_calculator_params.product_price=r,wc_price_calculator_params.minimum_price=c,l("form.cart").trigger("wc-measurement-price-calculator-show-variation",e),l("form.cart").trigger("wc-measurement-price-calculator-update"),l(".variable_price_calculator").show()}),l(document.body).bind("updated_addons",function(){var a=l("form.cart"),e=a.find("#product-addons-total");e.data("price")!==woocommerce_addons_params.product_price&&0<e.length&&(e.data("price",woocommerce_addons_params.product_price),a.trigger("woocommerce-product-addons-update"))})),"undefined"!=typeof wc_price_calculator_params&&"quantity"===wc_price_calculator_params.calculator_type){l("form.cart").bind("wc-measurement-price-calculator-quantity-changed",function(a,i){var e=!(2<arguments.length&&void 0!==arguments[2])||arguments[2];if(wc_price_calculator_params.product_measurement_value){l(e?".amount_needed, .amount_actual":".amount_actual").each(function(a,e){e=l(e);var r=s(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,e.data("unit")),c=parseFloat((r*i).toFixed(2)),t=wc_price_calculator_params;e.is("input")?e.val(c):e.text(m(c,2,t.woocommerce_price_decimal_sep,t.woocommerce_price_thousand_sep))}),l(".total_price").html(g(i*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-quantity-total-price-change",[i,wc_price_calculator_params.product_price])}});var e=!1;l("form.cart").bind("wc-measurement-price-calculator-update",function(){var c;if(wc_price_calculator_params.product_measurement_value&&(l("input.amount_needed").each(function(a,e){var r=d(w((e=l(e)).val()));if(!r||r<0)return c=0,!1;r=s(r,e.data("unit"),e.data("common-unit")),c?c*=r:c=r}),c)){var a=s(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,wc_price_calculator_params.product_total_measurement_common_unit),t=Math.ceil((c/a).toFixed(wc_price_calculator_params.measurement_precision));t<parseFloat(wc_price_calculator_params.quantity_range_min_value)&&(t=parseFloat(wc_price_calculator_params.quantity_range_min_value)),e=!!(parseFloat(wc_price_calculator_params.quantity_range_max_value)&&t>parseFloat(wc_price_calculator_params.quantity_range_max_value))&&(t=parseFloat(wc_price_calculator_params.quantity_range_max_value),!0),l("input[name=quantity]").val(t),l(".amount_actual").each(function(a,e){e=l(e);var r=s(wc_price_calculator_params.product_measurement_value,wc_price_calculator_params.product_measurement_unit,e.data("unit"));r=parseFloat((r*t).toFixed(2)),e.is("input")?e.val(r):e.text(r)}),e?(l("#stock-discrepancy-warning").remove(),l(".entry-summary").find(".cart").after('<p id="stock-discrepancy-warning" class="woocommerce-error">'+wc_price_calculator_params.stock_warning+"</p>")):l("#stock-discrepancy-warning").remove(),l(".total_price").html(g(t*wc_price_calculator_params.product_price)).trigger("wc-measurement-price-calculator-total-price-change",[t,wc_price_calculator_params.product_price])}});var a=l(".amount_needed:input");a.on("keyup change mpc-change",function(){var a=l(this).closest("form.cart");a.trigger("wc-measurement-price-calculator-update"),r(a)}),a.on("blur",function(){var a=l(this).closest("form.cart"),e=l("input[name=quantity]").val();a.trigger("wc-measurement-price-calculator-quantity-changed",[e,!1])}),l("input[name=quantity]").on("change mpc-change",function(a){var e=l(this).closest("form.cart");e.trigger("wc-measurement-price-calculator-quantity-changed",[a.target.value]),r(e)}).trigger("change"),l(".single_variation, .single_variation_wrap").bind("show_variation",function(a,e){wc_price_calculator_params.product_price=parseFloat(e.price),wc_price_calculator_params.product_measurement_value=parseFloat(e.product_measurement_value),wc_price_calculator_params.product_measurement_unit=e.product_measurement_unit,e.product_measurement_value?(0<l("input.amount_needed").length&&l("input.amount_needed").val()?l("form.cart").trigger("wc-measurement-price-calculator-update"):l("form.cart").trigger("wc-measurement-price-calculator-quantity-changed",[l("input[name=quantity]").val()]),l(".variable_price_calculator").show()):l(".variable_price_calculator").hide()})}function r(a){void 0===wc_price_calculator_params.page_loaded?(function(a){var e=l.cookie(wc_price_calculator_params.cookie_name);if(!1===l.isPlainObject(e)||l.isEmptyObject(e))return;for(var r in e)!1!==e.hasOwnProperty(r)&&a.find('.amount_needed[name="'+r+'"]:not(.fixed-value), input[name="'+r+'"].qty').val(e[r]);l("form.cart").trigger("wc-measurement-price-calculator-update"),setTimeout(function(a){return function(){a.trigger("mpc-change")}}(a.find("input.amount_needed:first")),100)}(a),wc_price_calculator_params.page_loaded=!0):setTimeout(function(){var r={};a.find(".amount_needed:input, input[name=quantity]").each(function(a,e){r[e.name]=e.value}),l.cookie(wc_price_calculator_params.cookie_name,r)},100)}function m(a,e,r,c){a=(a+"").replace(/[^0-9+\-Ee.]/g,"");var t=isFinite(+a)?+a:0,i=isFinite(+e)?Math.abs(e):0,n=void 0===c?",":c,o=void 0===r?".":r,_="";return 3<(_=(i?function(a,e){var r=Math.pow(10,e),c=""+a,t=c.indexOf(".");if(-1<t){t+=e,c=c.replace(".","");var i="";String.prototype.startsWith||(String.prototype.startsWith=function(a,e){return e=isNaN(parseInt(e))?0:e,this.indexOf(a,e)===e}),c.startsWith("0")&&(i=c.slice(0,c.length-parseFloat(c).toString().length));var n=c;if(c=c.slice(0,t),5<=n.slice(t,t+1)&&(c=parseFloat(c),c=i+(c=""+(c+=1))),c.length<t){var o=t-c.length;c*=Math.pow(10,o),c=Number(c,10)}else c=Number([c,".",c.slice(t)].join(""),10);return""+Math.round(c)/r}return a.toFixed(e)}(t,i):""+Math.round(t)).split("."))[0].length&&(_[0]=_[0].replace(/\B(?=(?:\d{3})+(?!\d))/g,n)),(_[1]||"").length<i&&(_[1]=_[1]||"",_[1]+=new Array(i-_[1].length+1).join("0")),_.join(o)}function s(a,e,r){return void 0!==wc_price_calculator_params.unit_normalize_table[e]&&(void 0!==wc_price_calculator_params.unit_normalize_table[e].inverse&&wc_price_calculator_params.unit_normalize_table[e].inverse?a/=wc_price_calculator_params.unit_normalize_table[e].factor:a*=wc_price_calculator_params.unit_normalize_table[e].factor,e=wc_price_calculator_params.unit_normalize_table[e].unit),void 0!==wc_price_calculator_params.unit_conversion_table[e]&&void 0!==wc_price_calculator_params.unit_conversion_table[e][r]&&(void 0!==wc_price_calculator_params.unit_conversion_table[e][r].inverse&&wc_price_calculator_params.unit_conversion_table[e][r].inverse?a/=wc_price_calculator_params.unit_conversion_table[e][r].factor:a*=wc_price_calculator_params.unit_conversion_table[e][r].factor),a}function d(a){var e;return(e=a.match(/(\d+)\s+(\d+)\/(\d+)/))?0!==e[3]?parseFloat(e[1])+e[2]/e[3]:parseFloat(e[1]):(e=a.match(/(\d+)\/(\d+)/))?0!==e[2]?e[1]/e[2]:0:""===a?0:parseFloat(a)}function w(a){var e=l.trim(wc_price_calculator_params.woocommerce_price_thousand_sep).toString(),r=l.trim(wc_price_calculator_params.woocommerce_price_decimal_sep).toString();return a&&null!==a?isNaN(a)||(a=a.toString()):a="",0<a.length&&(a=(a="."===e?a.replace(/\./g,""):a.replace(new RegExp(e,"g"),"")).replace(r,".")),a}function g(a){var e="",r=wc_price_calculator_params.woocommerce_price_num_decimals,c=wc_price_calculator_params.woocommerce_currency_pos,t=wc_price_calculator_params.woocommerce_currency_symbol;switch(a=m(a,r,wc_price_calculator_params.woocommerce_price_decimal_sep,wc_price_calculator_params.woocommerce_price_thousand_sep),"yes"===wc_price_calculator_params.woocommerce_price_trim_zeros&&0<r&&(a=function(a){return a.replace(new RegExp(function(a,e){return(a+"").replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\"+(e||"")+"-]","g"),"\\$&")}(wc_price_calculator_params.woocommerce_price_decimal_sep,"/")+"0+$"),"")}(a)),c){case"left":e='<span class="amount">'+t+a+"</span>";break;case"right":e='<span class="amount">'+a+t+"</span>";break;case"left_space":e='<span class="amount">'+t+"&nbsp;"+a+"</span>";break;case"right_space":e='<span class="amount">'+a+"&nbsp;"+t+"</span>"}return e}});
// source --> https://www.glassbutikk.no/wp-content/plugins/estimate-delivery-date-for-woocommerce-pro/public/js/pi-edd-product.js?ver=4.7.7.7 
(function ($) {
  "use strict";
  /* 4.4.9.6 */
  /**
   * All of the code for your public-facing JavaScript source
   * should reside in this file.
   *
   * Note: It has been assumed you will write jQuery code here, so the
   * $ function reference has been prepared for usage within the scope
   * of this function.
   *
   * This enables you to define handlers, for when the DOM is ready:
   *
   * $(function() {
   *
   * });
   *
   * When the window is loaded:
   *
   * $( window ).load(function() {
   *
   * });
   *
   * ...and/or other possibilities.
   *
   * Ideally, it is not considered best practise to attach more than a
   * single DOM-ready or window-load handler for a particular page.
   * Although scripts in the WordPress core, Plugins and Themes may be
   * practising this, we should strive to set a better example in our own work.
   */

  jQuery(document).ready(function ($) {

    function variableProduct() {
      this.init = function () {
        this.variationChange();
      }

      this.variationChange = function () {
        var parent = this;
        $(document).on('change', "input[type='hidden'].variation_id", function () {
          var variation_id = parseInt($(this).val());
          var form = $(this).closest('form');
          var product_id = form.data('product_id');
          if (variation_id != "" && variation_id != 0 && !isNaN(variation_id)) {
            parent.selectEstimate(product_id, variation_id);
          } else {
            parent.noVariationSelected(product_id);
          }
        });
      }

      this.noVariationSelected = function (product_id) {
        var parent = this;
        jQuery(".pi-edd-estimate-" + product_id).each(function () {
          var estimates = jQuery(this).data('notselected');

          if (estimates == "") {
            parent.hideContainer(product_id);
          } else {
            parent.showContainer(product_id);
            jQuery(this).html(estimates);
          }
        })
      }

      this.selectEstimate = function (product_id, variation_id) {
        var parent = this;
        jQuery(".pi-edd-estimate-" + product_id).each(function () {
          var estimates = (jQuery(this).data('estimates'));
          if (estimates[variation_id] != null) {
            parent.showContainer(product_id);
            jQuery(this).html(estimates[variation_id]);
          } else {
            parent.hideContainer(product_id);
          }
        })
      }

      this.hideContainer = function (product_id) {
        jQuery(".pi-edd-estimate-" + product_id).fadeOut(1);
      }

      this.showContainer = function (product_id) {
        jQuery(".pi-edd-estimate-" + product_id).fadeIn(1);
      }


    }
    var variableProductObj = new variableProduct();
    variableProductObj.init();

  });



})(jQuery);
// source --> https://www.glassbutikk.no/wp-content/plugins/estimate-delivery-date-for-woocommerce-pro/public/js/pi-edd-common.js?ver=6.8.5 
(function ($) {
    "use strict";

    $(document).ajaxComplete(function (event, jqxhr, settings) {
        if (settings.url.includes("wc-ajax=update_shipping_method")) {
            jQuery("[name='update_cart']")
                .removeAttr("disabled")
                .trigger("click")
                .attr("disabled");
        }
    });

    /** shipping calculation on cart page */
    $(document).ajaxComplete(function (event, jqxhr, settings) {

        if (typeof settings !== 'undefined' && typeof settings.data !== 'undefined' && typeof settings.data == 'string' && settings.data.includes('woocommerce-shipping-calculator-nonce')) {
            jQuery("[name='update_cart']")
                .removeAttr("disabled")
                .trigger("click")
                .attr("disabled");
        }
    });

})(jQuery);