<commit_before>(function () {
    angular.module('redeUi')
    .directive('owlCarousel', OwlCarouselDirective);

    OwlCarouselDirective.$inject = ['CarouselItemFactory', '$window'];
    function OwlCarouselDirective(CarouselItemFactory, $window) {
        var divOwlStageOuter, divOwlStage, divOwlNav, divOwlDots, divControls;

        function OwlCarouselLink (scope, element, attrs, controller) {
                // size variables
            var intOwlItemWidth = undefined,
                intOwlItemWholeWidth = undefined,
                intOwlStageWidth = undefined,
                intStagePadding = undefined,
                intMarginPerItem = undefined,
                objResponsiveConfig = undefined,
                // autoplay variables
                bolAutoplay = undefined,
                objAutoplayInterval = undefined,
                bolAutoplayHoverPause = undefined,
                intAutoplayTimeout = undefined,
                intAutoplaySpeed = undefined,
                // count variables
                intSlideBy = undefined,
                intItemCount = undefined,
                intMaxItemWindow = undefined,
                // dots variables
                bolEnableDots = undefined,
                intDotsEach = undefined,
                intDotsSpeed = undefined,
                // drag variables
                bolEnableTouchDrag = undefined,
                bolEnableMouseDrag = undefined,
                bolPullDrag = undefined,
                intMaxTranslate = undefined,
                intMinTranslate = undefined,
                intDragEndSpeed = undefined,
                intItemsOnScreen = undefined,
                // nav variables
                bolEnableNav = undefined,
                arrNavText = undefined,
                intNavSpeed = undefined,
                // position variables
                intStartPosition = undefined,
                intPosition = 0,
                arrBestTranslate = [],
                // elements
                divContainer = element;

            // Start configuration
            InitOwlConfig();

            // Create basic container elements
            InitElements();

            // Apply templates and everything related to item config
            InitItems(scope.items);

            // Enable navigation next/prev
            InitNav();

            // Enable dragging
            InitStage();

            // Load carousel
            InitCarousel();

            // Enable navigation and indication by dots
            InitDots();
            
            // Apply item size control 
            InitItemSize();

            // Apply start position 
            InitPosition();

            // Apply autoplay configuration
            InitAutoplay();

            function InitOwlConfig() {
                try {
                    bolEnableDots = scope.config.dots === true;
                    bolEnableNav = scope.config.nav === true;
                    bolAutoplayHoverPause = scope.config.autoplayHoverPause;
                    bolAutoplay = scope.config.autoplay;
                    intAutoplayTimeout = scope.config.autoplayTimeout;
                    intAutoplaySpeed = scope.config.autoplaySpeed;
                    intSlideBy = scope.config.slideBy;
                    intMaxItemWindow = scope.config.items || 3;
                    intStagePadding = scope.config.stagePadding || 0;
                    intDotsEach = scope.config.dotsEach || intMaxItemWindow;
                    intDotsSpeed = scope.config.dotsSpeed || 250;
                    intMarginPerItem = scope.config.margin;
                    bolPullDrag = scope.config.pullDrag;
                    intDragEndSpeed = scope.config.dragEndSpeed || 250;
                    arrNavText = scope.config.navText;
                    intNavSpeed = scope.config.navSpeed || 250;
                    bolEnableTouchDrag = scope.config.touchDrag === true;
                    bolEnableMouseDrag = scope.config.mouseDrag === true;
                    intStartPosition = scope.config.startPosition || 1;
                    objResponsiveConfig = scope.config.responsive;
                    
                    intItemsOnScreen = intItemCount < intMaxItemWindow ? intItemCount : intMaxItemWindow;
                    intItemCount = scope.items.length;  
                } catch (err) {
                    console.log('ERR: error during initialization', err);
                }
            }

            function InitItemSize() {
                // Set initial size of items
                SetItemSize();

                // Resize elements to fit the viewport
                angular.element($window).bind('resize', function(){
                    SetItemSize();
                    scope.$digest();
                });

                // Use viewport size to resize its elements
                function SetItemSize() {
                    var intWindowWidth = $window.innerWidth;<commit_msg>Persist current position on size change.<commit_after>(function () {
    angular.module('redeUi')
    .directive('owlCarousel', OwlCarouselDirective);

    OwlCarouselDirective.$inject = ['CarouselItemFactory', '$window'];
    function OwlCarouselDirective(CarouselItemFactory, $window) {
        var divOwlStageOuter, divOwlStage, divOwlNav, divOwlDots, divControls;

        function OwlCarouselLink (scope, element, attrs, controller) {
                // size variables
            var intOwlItemWidth = undefined,
                intOwlItemWholeWidth = undefined,
                intOwlStageWidth = undefined,
                intStagePadding = undefined,
                intMarginPerItem = undefined,
                objResponsiveConfig = undefined,
                // autoplay variables
                bolAutoplay = undefined,
                objAutoplayInterval = undefined,
                bolAutoplayHoverPause = undefined,
                intAutoplayTimeout = undefined,
                intAutoplaySpeed = undefined,
                // count variables
                intSlideBy = undefined,
                intItemCount = undefined,
                intMaxItemWindow = undefined,
                // dots variables
                bolEnableDots = undefined,
                intDotsEach = undefined,
                intDotsSpeed = undefined,
                // drag variables
                bolEnableTouchDrag = undefined,
                bolEnableMouseDrag = undefined,
                bolPullDrag = undefined,
                intMaxTranslate = undefined,
                intMinTranslate = undefined,
                intDragEndSpeed = undefined,
                intItemsOnScreen = undefined,
                // nav variables
                bolEnableNav = undefined,
                arrNavText = undefined,
                intNavSpeed = undefined,
                // position variables
                intStartPosition = undefined,
                intPosition = 0,
                arrBestTranslate = [],
                // elements
                divContainer = element;

            // Start configuration
            InitOwlConfig();

            // Create basic container elements
            InitElements();

            // Apply templates and everything related to item config
            InitItems(scope.items);

            // Enable navigation next/prev
            InitNav();

            // Enable dragging
            InitStage();

            // Load carousel
            InitCarousel();

            // Enable navigation and indication by dots
            InitDots();
            
            // Apply item size control 
            InitItemSize();

            // Apply start position 
            InitPosition();

            // Apply autoplay configuration
            InitAutoplay();

            function InitOwlConfig() {
                try {
                    bolEnableDots = scope.config.dots === true;
                    bolEnableNav = scope.config.nav === true;
                    bolAutoplayHoverPause = scope.config.autoplayHoverPause;
                    bolAutoplay = scope.config.autoplay;
                    intAutoplayTimeout = scope.config.autoplayTimeout;
                    intAutoplaySpeed = scope.config.autoplaySpeed;
                    intSlideBy = scope.config.slideBy;
                    intMaxItemWindow = scope.config.items || 3;
                    intStagePadding = scope.config.stagePadding || 0;
                    intDotsEach = scope.config.dotsEach || intMaxItemWindow;
                    intDotsSpeed = scope.config.dotsSpeed || 250;
                    intMarginPerItem = scope.config.margin;
                    bolPullDrag = scope.config.pullDrag;
                    intDragEndSpeed = scope.config.dragEndSpeed || 250;
                    arrNavText = scope.config.navText;
                    intNavSpeed = scope.config.navSpeed || 250;
                    bolEnableTouchDrag = scope.config.touchDrag === true;
                    bolEnableMouseDrag = scope.config.mouseDrag === true;
                    intStartPosition = scope.config.startPosition || 1;
                    objResponsiveConfig = scope.config.responsive;
                    
                    intItemsOnScreen = intItemCount < intMaxItemWindow ? intItemCount : intMaxItemWindow;
                    intItemCount = scope.items.length;  
                } catch (err) {
                    console.log('ERR: error during initialization', err);
                }
            }

            function InitItemSize() {
                // Set initial size of items
                SetItemSize();

                // Resize elements to fit the viewport
                angular.element($window).bind('resize', function(){
                    SetItemSize();
                    MoveToItem(intPosition);
                    scope.$digest();
                });

                // Use viewport size to resize its elements
                function SetItemSize() {
                    var intWindowWidth = $window.innerWidth;
{'fraction_non_alphanumeric': 0.07085987261146497, 'fraction_numerical': 0.0025875796178343948, 'mean_word_length': 1.3745274102079394, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '1771781', 'n_tokens_mistral': 2381, 'n_tokens_neox': 2152, 'n_words': 493}