// source --> https://ueberdachungen-heilbronn.de/wp-content/plugins/woocommerce-germanized/build/static/unit-price-observer-queue.js?ver=4.0.1 
/******/ (function() { // webpackBootstrap
var __webpack_exports__ = {};
/*global woocommerce_admin_meta_boxes, woocommerce_admin, accounting, woocommerce_admin_meta_boxes_order */
window.germanized = window.germanized || {};
(function ($, germanized) {
  germanized.unit_price_observer_queue = {
    queue: {},
    timeout: null,
    params: {},
    request: null,
    init: function () {
      this.params = wc_gzd_unit_price_observer_queue_params;
      this.queue = {};
      this.queuesInExecution = {};
      this.latestQueueInExection = '';
      this.aborted = {};
      this.timeout = null;
      this.request = null;
    },
    execute: function () {
      var self = germanized.unit_price_observer_queue,
        data = [],
        currentQueueId = Date.now() + '';
      self.queuesInExecution[currentQueueId] = {
        ...self.queue
      };
      self.latestQueueInExection = currentQueueId;
      self.queue = {};

      /**
       * Reverse queue
       */
      Object.keys(self.queuesInExecution[currentQueueId]).forEach(function (queueKey) {
        data = data.concat([{
          'product_id': self.queuesInExecution[currentQueueId][queueKey].productId,
          'price': self.queuesInExecution[currentQueueId][queueKey].priceData.price,
          'price_sale': self.queuesInExecution[currentQueueId][queueKey].priceData.sale_price,
          'quantity': self.queuesInExecution[currentQueueId][queueKey].priceData.quantity,
          'is_range': self.queuesInExecution[currentQueueId][queueKey].priceData.hasOwnProperty('is_range') ? self.queuesInExecution[currentQueueId][queueKey].priceData.is_range : false,
          'key': queueKey
        }]);
      });
      self.request = $.ajax({
        type: "POST",
        url: self.params.wc_ajax_url.toString().replace('%%endpoint%%', 'gzd_refresh_unit_price'),
        data: {
          'security': self.params.refresh_unit_price_nonce,
          'products': data,
          'queue_id': currentQueueId
        },
        queueId: currentQueueId,
        success: function (data) {
          var xhrQueueId = this.queueId,
            currentQueue = self.queuesInExecution.hasOwnProperty(xhrQueueId) ? self.queuesInExecution[xhrQueueId] : {},
            aborted = self.aborted.hasOwnProperty(xhrQueueId) ? self.aborted[xhrQueueId] : {};
          Object.keys(currentQueue).forEach(function (queueId) {
            if (!aborted.hasOwnProperty(queueId)) {
              var current = currentQueue[queueId],
                observer = current.observer,
                priceData = current.priceData,
                priceSelector = current.priceSelector,
                isPrimary = current.isPrimary,
                unitPrices = self.getUnitPricesFromMap(priceData.unit_price);
              if (observer) {
                if (data.products.hasOwnProperty(queueId)) {
                  var response = data.products[queueId];
                  observer.stopObserver(observer, priceSelector);

                  /**
                   * Do only adjust unit price in case current product id has not changed
                   * in the meantime (e.g. variation change).
                   */
                  if (parseInt(response.product_id) === observer.getCurrentProductId(observer)) {
                    if (response.hasOwnProperty('unit_price_html')) {
                      observer.unsetUnitPriceLoading(observer, unitPrices, response.unit_price_html);
                    } else {
                      observer.unsetUnitPriceLoading(observer, unitPrices);
                    }
                  } else {
                    observer.unsetUnitPriceLoading(observer, unitPrices);
                  }
                  observer.startObserver(observer, priceSelector, isPrimary);
                } else {
                  observer.stopObserver(observer, priceSelector);
                  observer.unsetUnitPriceLoading(observer, unitPrices);
                  observer.startObserver(observer, priceSelector, isPrimary);
                }
              }
            } else {
              delete self.aborted[xhrQueueId][queueId];
            }
          });
          delete self.queuesInExecution[xhrQueueId];
        },
        error: function () {
          var xhrQueueId = this.queueId,
            currentQueue = self.queuesInExecution.hasOwnProperty(xhrQueueId) ? self.queuesInExecution[xhrQueueId] : {},
            aborted = self.aborted.hasOwnProperty(xhrQueueId) ? self.aborted[xhrQueueId] : {};
          Object.keys(currentQueue).forEach(function (queueId) {
            if (!aborted.hasOwnProperty(queueId)) {
              var current = currentQueue[queueId],
                observer = current.observer,
                priceData = current.priceData,
                priceSelector = current.priceSelector,
                isPrimary = current.isPrimary,
                unitPrices = self.getUnitPricesFromMap(priceData.unit_price);
              if (observer) {
                observer.stopObserver(observer, priceSelector);
                observer.unsetUnitPriceLoading(observer, unitPrices);
                observer.startObserver(observer, priceSelector, isPrimary);
              }
            } else {
              delete self.aborted[xhrQueueId][queueId];
            }
          });
          delete self.queuesInExecution[xhrQueueId];
        },
        dataType: 'json'
      });
    },
    getUnitPricesFromMap: function (unitPriceMap) {
      let unitPrices = [];
      unitPriceMap.forEach(function (unitPrice) {
        unitPrices = $.merge(unitPrices, $(unitPrice));
      });
      return $(unitPrices);
    },
    getQueueKey: function (productId) {
      return (productId + '').replace(/[^a-zA-Z0-9]/g, '');
    },
    getLatestQueueInExecution() {
      var self = germanized.unit_price_observer_queue;
      return self.queuesInExecution.hasOwnProperty(self.latestQueueInExection) ? self.queuesInExecution[self.latestQueueInExection] : {};
    },
    exists: function (productId) {
      var self = germanized.unit_price_observer_queue,
        queueKey = self.getQueueKey(productId);
      return self.queue.hasOwnProperty(queueKey) || self.getLatestQueueInExecution().hasOwnProperty(queueKey);
    },
    get: function (productId) {
      var self = germanized.unit_price_observer_queue,
        queueKey = self.getQueueKey(productId),
        queueInExecution = self.getLatestQueueInExecution().hasOwnProperty(queueKey);
      if (queueInExecution.hasOwnProperty(queueKey)) {
        return queueInExecution[queueKey];
      } else if (self.queue.hasOwnProperty(queueKey)) {
        return self.queue[queueKey];
      }
      return false;
    },
    abort: function (productId) {
      var self = germanized.unit_price_observer_queue,
        queueKey = self.getQueueKey(productId),
        latestQueueInExecutionKey = self.latestQueueInExection,
        latestQueueInExecution = self.queuesInExecution.hasOwnProperty(latestQueueInExecutionKey) ? self.queuesInExecution[latestQueueInExecutionKey] : {};
      if (latestQueueInExecution.hasOwnProperty(queueKey)) {
        var current = latestQueueInExecution[queueKey],
          observer = current.observer,
          priceData = current.priceData,
          priceSelector = current.priceSelector,
          isPrimary = current.isPrimary,
          unitPrices = self.getUnitPricesFromMap(priceData.unit_price);
        if (observer) {
          observer.stopObserver(observer, priceSelector);
          observer.unsetUnitPriceLoading(observer, unitPrices);
          observer.startObserver(observer, priceSelector, isPrimary);
        }
        if (!self.aborted.hasOwnProperty(latestQueueInExecutionKey)) {
          self.aborted[latestQueueInExecutionKey] = {};
        }
        self.aborted[latestQueueInExecutionKey][queueKey] = current;
        return true;
      }
      return false;
    },
    add: function (observer, productId, priceData, priceSelector, isPrimary) {
      var self = germanized.unit_price_observer_queue,
        queueKey = self.getQueueKey(productId);
      if (self.queue.hasOwnProperty(queueKey)) {
        priceData['unit_price'].each(function (i, obj) {
          if (!self.queue[queueKey]['priceData']['unit_price'].has(obj)) {
            self.queue[queueKey]['priceData']['unit_price'].set(obj, obj);
          }
        });
      } else {
        var unitPrices = new Map();
        priceData['unit_price'].each(function (i, obj) {
          unitPrices.set(obj, obj);
        });
        priceData['unit_price'] = unitPrices;
        self.queue[queueKey] = {
          'productId': productId,
          'observer': observer,
          'priceData': priceData,
          'priceSelector': priceSelector,
          'isPrimary': isPrimary
        };
      }
      clearTimeout(self.timeout);
      self.timeout = setTimeout(self.execute, 500);
    }
  };
  $(document).ready(function () {
    germanized.unit_price_observer_queue.init();
  });
})(jQuery, window.germanized);
((window.germanized = window.germanized || {})["static"] = window.germanized["static"] || {})["unit-price-observer-queue"] = __webpack_exports__;
/******/ })()
;
// source --> https://ueberdachungen-heilbronn.de/wp-content/plugins/woocommerce/assets/js/accounting/accounting.min.js?ver=0.4.2 
/*!
 * accounting.js v0.4.2
 * Copyright 2014 Open Exchange Rates
 *
 * Freely distributable under the MIT license.
 * Portions of accounting.js are inspired or borrowed from underscore.js
 *
 * Full details and documentation:
 * http://openexchangerates.github.io/accounting.js/
 */
!function(n,r){var e={version:"0.4.1",settings:{currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}}},t=Array.prototype.map,o=Array.isArray,a=Object.prototype.toString;function i(n){return!!(""===n||n&&n.charCodeAt&&n.substr)}function u(n){return o?o(n):"[object Array]"===a.call(n)}function c(n){return n&&"[object Object]"===a.call(n)}function s(n,r){var e;for(e in n=n||{},r=r||{})r.hasOwnProperty(e)&&null==n[e]&&(n[e]=r[e]);return n}function f(n,r,e){var o,a,i=[];if(!n)return i;if(t&&n.map===t)return n.map(r,e);for(o=0,a=n.length;o<a;o++)i[o]=r.call(e,n[o],o,n);return i}function p(n,r){return n=Math.round(Math.abs(n)),isNaN(n)?r:n}function l(n){var r=e.settings.currency.format;return"function"==typeof n&&(n=n()),i(n)&&n.match("%v")?{pos:n,neg:n.replace("-","").replace("%v","-%v"),zero:n}:n&&n.pos&&n.pos.match("%v")?n:i(r)?e.settings.currency.format={pos:r,neg:r.replace("%v","-%v"),zero:r}:r}var m,d=e.unformat=e.parse=function(n,r){if(u(n))return f(n,function(n){return d(n,r)});if("number"==typeof(n=n||0))return n;r=r||e.settings.number.decimal;var t=new RegExp("[^0-9-"+r+"]",["g"]),o=parseFloat((""+n).replace(/\((.*)\)/,"-$1").replace(t,"").replace(r,"."));return isNaN(o)?0:o},g=e.toFixed=function(n,r){r=p(r,e.settings.number.precision);var t=Math.pow(10,r);return(Math.round(e.unformat(n)*t)/t).toFixed(r)},h=e.formatNumber=e.format=function(n,r,t,o){if(u(n))return f(n,function(n){return h(n,r,t,o)});n=d(n);var a=s(c(r)?r:{precision:r,thousand:t,decimal:o},e.settings.number),i=p(a.precision),l=n<0?"-":"",m=parseInt(g(Math.abs(n||0),i),10)+"",y=m.length>3?m.length%3:0;return l+(y?m.substr(0,y)+a.thousand:"")+m.substr(y).replace(/(\d{3})(?=\d)/g,"$1"+a.thousand)+(i?a.decimal+g(Math.abs(n),i).split(".")[1]:"")},y=e.formatMoney=function(n,r,t,o,a,i){if(u(n))return f(n,function(n){return y(n,r,t,o,a,i)});n=d(n);var m=s(c(r)?r:{symbol:r,precision:t,thousand:o,decimal:a,format:i},e.settings.currency),g=l(m.format);return(n>0?g.pos:n<0?g.neg:g.zero).replace("%s",m.symbol).replace("%v",h(Math.abs(n),p(m.precision),m.thousand,m.decimal))};e.formatColumn=function(n,r,t,o,a,m){if(!n)return[];var g=s(c(r)?r:{symbol:r,precision:t,thousand:o,decimal:a,format:m},e.settings.currency),y=l(g.format),b=y.pos.indexOf("%s")<y.pos.indexOf("%v"),v=0;return f(f(n,function(n,r){if(u(n))return e.formatColumn(n,g);var t=((n=d(n))>0?y.pos:n<0?y.neg:y.zero).replace("%s",g.symbol).replace("%v",h(Math.abs(n),p(g.precision),g.thousand,g.decimal));return t.length>v&&(v=t.length),t}),function(n,r){return i(n)&&n.length<v?b?n.replace(g.symbol,g.symbol+new Array(v-n.length+1).join(" ")):new Array(v-n.length+1).join(" ")+n:n})},"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=e),exports.accounting=e):"function"==typeof define&&define.amd?define([],function(){return e}):(e.noConflict=(m=n.accounting,function(){return n.accounting=m,e.noConflict=void 0,e}),n.accounting=e)}(this);