text: 'use strict';
  
  var cls = require('../lib/class')
    , h = require('../lib/helper')
    , instances = require('./instances')
    , updateGeometry = require('./update-geometry');
  
  // Handlers
  var clickRailHandler = require('./handler/click-rail')
    , dragScrollbarHandler = require('./handler/drag-scrollbar')
    , keyboardHandler = require('./handler/keyboard')
    , mouseWheelHandler = require('./handler/mouse-wheel')
    , nativeScrollHandler = require('./handler/native-scroll')
    , selectionHandler = require('./handler/selection')
    , touchHandler = require('./handler/touch');
  
  module.exports = function (element, userSettings) {
    userSettings = typeof userSettings === 'object' ? userSettings : {};
  
    cls.add(element, 'ps-container');
  
    // Create a plugin instance.
    var i = instances.add(element);
  
    i.settings = h.extend(i.settings, userSettings);
    cls.add(element, 'ps-theme-' + i.settings.theme);
  
    clickRailHandler(element);
    dragScrollbarHandler(element);
    mouseWheelHandler(element);
    nativeScrollHandler(element);
  
    if (i.settings.useSelectionScroll) {
      selectionHandler(element);
    }
  
    if (h.env.supportsTouch || h.env.supportsIePointer) {
      touchHandler(element, h.env.supportsTouch, h.env.supportsIePointer);
    }
    if (i.settings.useKeyboard) {
      keyboardHandler(element);
    }
  
    updateGeometry(element);
  };
  