'use strict';

var settings = require('../../settings/settings.js');
require('../../utils/settings.js');
var index = require('../../utils/is_mobile/index.js');
require('../../constants.js');
require('../../color.js');
require('../../utils/color/premultiply.js');
require('../../utils/media/BoundingBox.js');

function maxRecommendedTextures(max) {
  let allowMax = true;
  const navigator = settings.settings.ADAPTER.getNavigator();
  if (index.isMobile.tablet || index.isMobile.phone) {
    if (index.isMobile.apple.device) {
      const match = navigator.userAgent.match(/OS (\d+)_(\d+)?/);
      if (match) {
        const majorVersion = parseInt(match[1], 10);
        if (majorVersion < 11) {
          allowMax = false;
        }
      }
    }
    if (index.isMobile.android.device) {
      const match = navigator.userAgent.match(/Android\s([0-9.]*)/);
      if (match) {
        const majorVersion = parseInt(match[1], 10);
        if (majorVersion < 7) {
          allowMax = false;
        }
      }
    }
  }
  return allowMax ? max : 4;
}

exports.maxRecommendedTextures = maxRecommendedTextures;
//# sourceMappingURL=maxRecommendedTextures.js.map
