Liferay.Loader.define("commerce-frontend-js@3.0.43/utilities/throttle", ['module', 'exports', 'require'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.default = throttle;

    /**
     * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
     * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
     */
    function throttle(fn, limit) {
      var _arguments = arguments,
          _this = this;

      var lastFunction, lastRan;
      return function () {
        var context = _this,
            args = _arguments;

        if (!lastRan) {
          fn.apply(context, args);
          lastRan = Date.now();
        } else {
          clearTimeout(lastFunction);
          lastFunction = setTimeout(function () {
            if (Date.now() - lastRan >= limit) {
              fn.apply(context, args);
              lastRan = Date.now();
            }
          }, limit - (Date.now() - lastRan));
        }
      };
    }
    //# sourceMappingURL=throttle.js.map
  }
});
//# sourceMappingURL=throttle.js.map