"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.getDebugOptions = getDebugOptions;

function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }

var batchTimeoutId = null;

function getDebugOptions() {
  var debug = window && window.sgTransitionDebug;
  var options = {
    speed: 1,
    outlines: false
  };

  if (!debug || _typeof(debug) !== 'object') {
    return options;
  }

  if (typeof debug.speed === 'number') {
    options.speed = debug.speed;
  }

  if (typeof debug.outlines === 'boolean') {
    options.outlines = debug.outlines;
  }

  var printWarning = function printWarning() {
    console.warn("Transition debug mode is enabled with options: ".concat(JSON.stringify(options)));
  };
  /**
   * The debugging mode applies to every Transition component,
   * therefore multiple references to this function should not
   * immediately print a warning.
   */


  clearTimeout(batchTimeoutId);
  batchTimeoutId = setTimeout(printWarning, 100);
  return options;
}