text: define(["require", "exports"], function (require, exports) {
      "use strict";
      Object.defineProperty(exports, "__esModule", { value: true });
      /**
       * Determines the distance between two points.
       *
       * @public
       */
      function getDistanceBetweenPoints(point1, point2) {
          var distance = Math.sqrt(Math.pow(point1.x - point2.x, 2) + Math.pow(point1.y - point2.y, 2));
          return distance;
      }
      exports.getDistanceBetweenPoints = getDistanceBetweenPoints;
      /**
       * Produces a proportionally-scaled version of an input content size when fit to a bounding size.
       * Given a `contentSize` and a `boundsSize`, this function scales `contentSize` proportionally
       * using either `contain` or `cover` fit behaviors.
       * Use this function to pre-calculate the layout for the CSS `object-fit` and `background-fit` behaviors.
       * With `contain`, the output size must be the largest it can be while completely within the `boundsSize`.
       * With `cover`, the output size must be the smallest it can be while completely around the `boundsSize`.
       * By default, there is a `maxScale` value of 1, which prevents the `contentSize` from being scaled larger.
       *
       * @param options - the options for the bounds fit operation
       */
      function fitContentToBounds(options) {
          var contentSize = options.contentSize, boundsSize = options.boundsSize, _a = options.mode, mode = _a === void 0 ? 'contain' : _a, _b = options.maxScale, maxScale = _b === void 0 ? 1 : _b;
          var contentAspectRatio = contentSize.width / contentSize.height;
          var boundsAspectRatio = boundsSize.width / boundsSize.height;
          var scale;
          if (mode === 'contain' ? contentAspectRatio > boundsAspectRatio : contentAspectRatio < boundsAspectRatio) {
              scale = boundsSize.width / contentSize.width;
          }
          else {
              scale = boundsSize.height / contentSize.height;
          }
          var finalScale = Math.min(maxScale, scale);
          return {
              width: contentSize.width * finalScale,
              height: contentSize.height * finalScale,
          };
      }
      exports.fitContentToBounds = fitContentToBounds;
      /**
       * Calculates a number's precision based on the number of trailing
       * zeros if the number does not have a decimal indicated by a negative
       * precision. Otherwise, it calculates the number of digits after
       * the decimal point indicated by a positive precision.
       * @param value - the value to determine the precision of
       */
      function calculatePrecision(value) {
          /**
           * Group 1:
           * [1-9]([0]+$) matches trailing zeros
           * Group 2:
           * \.([0-9]*) matches all digits after a decimal point.
           */
          var groups = /[1-9]([0]+$)|\.([0-9]*)/.exec(String(value));
          if (!groups) {
              return 0;
          }
          if (groups[1]) {
              return -groups[1].length;
          }
          if (groups[2]) {
              return groups[2].length;
          }
          return 0;
      }
      exports.calculatePrecision = calculatePrecision;
      /**
       * Rounds a number to a certain level of precision. Accepts negative precision.
       * @param value - The value that is being rounded.
       * @param precision - The number of decimal places to round the number to
       */
      function precisionRound(value, precision, base) {
          if (base === void 0) { base = 10; }
          var exp = Math.pow(base, precision);
          return Math.round(value * exp) / exp;
      }
      exports.precisionRound = precisionRound;
  });
  //# sourceMappingURL=math.js.map