<commit_before>var Class = li.require( 'libraries/ptclass' ),
  List = li.require( 'ui/List' ),
  Carousel;

/**
 * A representation of a stateful list
 * @class List
 * @constructor
 * @param {HTMLElement} element The HTML element containing this component
 * @param {Object} settings Configuration properties for this instance
 */
Carousel =  Class.create( List, ( function() {

  // RETURN METHODS OBJECT 
  return {
    /**
     * PTClass constructor 
     * @method initialize
     * @public
     * @param {Object} $super Pointer to superclass constructor
     * @param {Object} $element JQuery object for the element wrapped by the component
     * @param {Object} settings Configuration settings
     */    
    initialize: function ( $super, $element, settings ){

      // PRIVATE INSTANCE PROPERTIES

      /**
       * Instance of Carousel
       * @property Carousel
       * @type Object
       * @private
       */  
      var Carousel = this,
      /**
       * Default configuration values
       * @property defaults
       * @type Object
       * @private
       * @final
       */
      defaults = {
        /**
         * Number of times to cycle through carousel items when playing, set to -1 to repeat forever
         * @property repeat
         * @type Number
         * @private
         */
        repeat: -1,
        /**
         * Automatically calls play on instantiation if set to true
         * @property repeat
         * @type Boolean
         * @private
         * @final
         */
        autoplay: true,
        /**
         * The time in milliseconds to remain on an item while playing
         * @property delay
         * @type Number
         * @private
         * @final
         */
        delay: 3000,
        /**
         * A selector scoped to the $element that matches carousel pannels
         * @property repeat
         * @type String
         * @private
         * @final
         */
        pannels: '.pannels',
        /**
         * A selector scoped to the $element that matches carousel items
         * @property repeat
         * @type String
         * @private
         * @final
         */
        items: '.items',
        /**
         * The CSS class that designates a selected pannel
         * @property selectFlag
         * @default 'selected'
         * @type String
         * @final
         * @private
        */
        activeFlag: 'active'
      },
      /**
       * Integer value signalling whether the carousel is set to repeat
       * @property repeat
       * @type Type Number
       * @private
       */
      repeat,
      /**
       * Flag signalling the playing state of the carousel
       * @property playing
       * @type Boolean
       * @default false
       * @private
       */
      playing = false,
      /**
       * The collection of panels in the carousel
       * @property $pannels
       * @type Object
       * @private
       */
      $pannels;

      // MIX THE DEFAULTS INTO THE SETTINGS VALUES
      _.defaults( settings, defaults );

      repeat = settings.repeat;

      $pannels = $element.children( settings.pannels ).children();

      if( $pannels.length > 0 ) {
        settings.items = $pannels.children( settings.items );
      }

      // CALL THE PARENT'S CONSTRUCTOR
      $super( $element, settings );

      // PRIVILEGED METHODS
     /**
       * Plays the Carousel when paused
       * @method play
       * @public
       * @return {Object} The Carousel instance
       */
      Carousel.play = function() {
        if( playing === false ) {
          repeat = settings.repeat;
          playing = true;
          ( function recurse() {
            window.setTimeout( function() {
              if( playing ) {
                Carousel.next();
                recurse();
              }
            }, settings.delay );
          }() );
          Carousel.trigger( 'playing' );
        }
        return Carousel;
      };

      /**
       * Pauses the Carousel when playing
       * @method pause
       * @public
       * @return {Object} The Carousel instance
       */
      Carousel.pause = function() {
        if( playing ) {
          playing = false;
          Carousel.trigger( 'paused' );
        }
        return Carousel;
      },

      // EVENT BINDINGS
      Carousel.on( 'selected', function( event, $item ) {
         var $pannel = $item.closest( $pannels );
         if( $pannel.hasClass( settings.activeFlag ) === false ) {
           $pannels.removeClass( settings.activeFlag );
           $pannel.addClass( settings.activeFlag );
         }<commit_msg>fixed syntax error<commit_after>var Class = li.require( 'libraries/ptclass' ),
  List = li.require( 'ui/List' ),
  Carousel;

/**
 * A representation of a stateful list
 * @class List
 * @constructor
 * @param {HTMLElement} element The HTML element containing this component
 * @param {Object} settings Configuration properties for this instance
 */
Carousel =  Class.create( List, ( function() {

  // RETURN METHODS OBJECT 
  return {
    /**
     * PTClass constructor 
     * @method initialize
     * @public
     * @param {Object} $super Pointer to superclass constructor
     * @param {Object} $element JQuery object for the element wrapped by the component
     * @param {Object} settings Configuration settings
     */    
    initialize: function ( $super, $element, settings ){

      // PRIVATE INSTANCE PROPERTIES

      /**
       * Instance of Carousel
       * @property Carousel
       * @type Object
       * @private
       */  
      var Carousel = this,
      /**
       * Default configuration values
       * @property defaults
       * @type Object
       * @private
       * @final
       */
      defaults = {
        /**
         * Number of times to cycle through carousel items when playing, set to -1 to repeat forever
         * @property repeat
         * @type Number
         * @private
         */
        repeat: -1,
        /**
         * Automatically calls play on instantiation if set to true
         * @property repeat
         * @type Boolean
         * @private
         * @final
         */
        autoplay: true,
        /**
         * The time in milliseconds to remain on an item while playing
         * @property delay
         * @type Number
         * @private
         * @final
         */
        delay: 3000,
        /**
         * A selector scoped to the $element that matches carousel pannels
         * @property repeat
         * @type String
         * @private
         * @final
         */
        pannels: '.pannels',
        /**
         * A selector scoped to the $element that matches carousel items
         * @property repeat
         * @type String
         * @private
         * @final
         */
        items: '.items',
        /**
         * The CSS class that designates a selected pannel
         * @property selectFlag
         * @default 'selected'
         * @type String
         * @final
         * @private
        */
        activeFlag: 'active'
      },
      /**
       * Integer value signalling whether the carousel is set to repeat
       * @property repeat
       * @type Type Number
       * @private
       */
      repeat,
      /**
       * Flag signalling the playing state of the carousel
       * @property playing
       * @type Boolean
       * @default false
       * @private
       */
      playing = false,
      /**
       * The collection of panels in the carousel
       * @property $pannels
       * @type Object
       * @private
       */
      $pannels;

      // MIX THE DEFAULTS INTO THE SETTINGS VALUES
      _.defaults( settings, defaults );

      repeat = settings.repeat;

      $pannels = $element.children( settings.pannels ).children();

      if( $pannels.length > 0 ) {
        settings.items = $pannels.children( settings.items );
      }

      // CALL THE PARENT'S CONSTRUCTOR
      $super( $element, settings );

      // PRIVILEGED METHODS
     /**
       * Plays the Carousel when paused
       * @method play
       * @public
       * @return {Object} The Carousel instance
       */
      Carousel.play = function() {
        if( playing === false ) {
          repeat = settings.repeat;
          playing = true;
          ( function recurse() {
            window.setTimeout( function() {
              if( playing ) {
                Carousel.next();
                recurse();
              }
            }, settings.delay );
          }() );
          Carousel.trigger( 'playing' );
        }
        return Carousel;
      };

      /**
       * Pauses the Carousel when playing
       * @method pause
       * @public
       * @return {Object} The Carousel instance
       */
      Carousel.pause = function() {
        if( playing ) {
          playing = false;
          Carousel.trigger( 'paused' );
        }
        return Carousel;
      };

      // EVENT BINDINGS
      Carousel.on( 'selected', function( event, $item ) {
         var $pannel = $item.closest( $pannels );
         if( $pannel.hasClass( settings.activeFlag ) === false ) {
           $pannels.removeClass( settings.activeFlag );
           $pannel.addClass( settings.activeFlag );
         }
{'fraction_non_alphanumeric': 0.10085860232583414, 'fraction_numerical': 0.001521573741984567, 'mean_word_length': 1.55115054061547, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6704598', 'n_tokens_mistral': 2431, 'n_tokens_neox': 2367, 'n_words': 738}