{"version":3,"file":"compare.18c37d90b5c815e282e6.js","mappings":";;;;;;;;;;;;AAAA;AACA;AACA;;;;;;;;;;;;ACFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACrDA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;ACtCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;AC/NA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACLA;;;;;;;;;;;;;ACAA","sources":["webpack://advantshop/./bundle_config/compare.js","webpack://advantshop/./scripts/_common/rating/controllers/ratingController.js","webpack://advantshop/./scripts/_common/rating/directives/ratingDirectives.js","webpack://advantshop/./scripts/_common/rating/rating.module.js","webpack://advantshop/./scripts/appDependency.js","webpack://advantshop/./scripts/compare/compare.js","webpack://advantshop/./scripts/compare/compare.module.js","webpack://advantshop/./scripts/_common/rating/styles/rating.scss?1795","webpack://advantshop/./styles/views/compareproducts.scss?faef"],"sourcesContent":["import compareModule from '../scripts/compare/compare.module.js';\nimport appDependency from '../scripts/appDependency.js';\nappDependency.addItem(compareModule);","RatingCtrl.$inject = [\"$http\"];\n\n/* @ngInject */\nfunction RatingCtrl($http) {\n var ctrl = this;\n ctrl.items = [];\n\n ctrl.select = function (val) {\n if (ctrl.readonly === false) {\n ctrl.current = val;\n\n for (var i = 0; i < val; i++) {\n ctrl.items[i].isSelected = true;\n }\n\n if (ctrl.url) {\n return $http.post(ctrl.url, {\n objId: ctrl.objId,\n rating: ctrl.current\n }).then(function (response) {\n ctrl.current = response.data;\n });\n }\n }\n };\n}\n\n;\nexport default RatingCtrl;","function ratingDirective() {\n return {\n require: ['rating', '?ngModel'],\n restrict: 'A',\n scope: true,\n controller: 'RatingCtrl',\n controllerAs: 'rating',\n bindToController: true,\n link: function link(scope, element, attrs, ctrls) {\n var rating = ctrls[0];\n var ngModel = ctrls[1];\n var childs = element[0].children;\n rating.max = parseInt(attrs.max) || 5;\n rating.readonly = attrs.readonly != null ? attrs.readonly === 'true' : false;\n\n if (rating.readonly) {\n element[0].classList.add(\"rating-readonly\");\n }\n\n rating.current = parseInt(attrs.current);\n rating.url = attrs.url;\n rating.objId = attrs.objId;\n rating.rateBinding = attrs.rateBinding;\n\n for (var i = 0; i <= childs.length - 1; i++) {\n childs[i].setAttribute(\"data-index\", childs.length - i);\n rating.items[i] = {\n isSelected: rating.current - 1 < i\n };\n }\n\n if (rating.readonly === false) {\n element[0].addEventListener('click', function (event) {\n if (event.target.classList.contains('rating-item') === true) {\n if (ngModel != null) {\n ngModel.$setViewValue(parseInt(event.target.getAttribute('data-index')));\n }\n\n var promise = rating.select(parseInt(event.target.getAttribute('data-index')));\n\n if (promise) {\n promise.then(function () {\n element[0].classList.add(\"rating-readonly\");\n });\n }\n\n scope.$digest();\n }\n });\n }\n }\n };\n}\n\nexport { ratingDirective };","import './styles/rating.scss';\nimport { ratingDirective } from './directives/ratingDirectives.js';\nimport RatingCtrl from './controllers/ratingController.js';\nvar moduleName = 'rating';\nangular.module(moduleName, []).controller('RatingCtrl', RatingCtrl).directive('rating', ratingDirective);\nexport default moduleName;","function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, \"prototype\", { writable: false }); return Constructor; }\n\nvar AppDependency = /*#__PURE__*/function () {\n function AppDependency() {\n _classCallCheck(this, AppDependency);\n\n if (!window.___appDependency) {\n window.___appDependency = this;\n window.___appDependencyList = [];\n }\n\n return window.___appDependency;\n }\n\n _createClass(AppDependency, [{\n key: \"addItem\",\n value: function addItem(moduleName) {\n window.___appDependencyList.push(moduleName);\n }\n }, {\n key: \"addList\",\n value: function addList(moduleNameList) {\n window.___appDependencyList = window.___appDependencyList.concat(moduleNameList);\n }\n }, {\n key: \"get\",\n value: function get() {\n return window.___appDependencyList;\n }\n }]);\n\n return AppDependency;\n}();\n\nexport default new AppDependency();","var container,\n containerEmpty,\n blocks = [],\n listProperties,\n listProducts,\n blocksItem = {},\n btnsRemove,\n btnsRemoveAll;\n\nvar makeArray = function makeArray(list) {\n var arr = [];\n\n if (list == null) {\n return arr;\n }\n\n for (var i = 0, il = list.length; i < il; i++) {\n arr.push(list[i]);\n }\n\n return arr;\n};\n\nvar getParent = function getParent(elem, selector) {\n var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;\n\n while (elem) {\n if (matchesSelector.bind(elem)(selector)) {\n return elem;\n } else {\n elem = elem.parentElement;\n }\n }\n\n return null;\n};\n\nvar findRows = function findRows() {\n var containerProducts = container.querySelector('.js-compareproduct-block-products'),\n containerProperty = container.querySelector('.js-compareproduct-block-properties');\n listProducts = containerProducts == null ? [] : makeArray(containerProducts.querySelectorAll('.js-compareproduct-block-row'));\n listProperties = containerProperty == null ? [] : makeArray(containerProperty.querySelectorAll('.js-compareproduct-block-row'));\n};\n\nvar itemMouseOver = function itemMouseOver(e) {\n var target = e.target,\n row = getParent(target, '.js-compareproduct-block-row'),\n rowIndex;\n\n if (row != null) {\n rowIndex = row.getAttribute('data-row-index');\n\n if (rowIndex == null) {\n return;\n }\n\n for (var i = 0, il = listProperties.length; i < il; i++) {\n if (listProperties[i].getAttribute('data-row-index') === rowIndex) {\n listProperties[i].classList.add('compareproduct-block-item-hover');\n break;\n }\n }\n\n for (var j = 0, jl = listProducts.length; j < jl; j++) {\n if (listProducts[j].getAttribute('data-row-index') === rowIndex) {\n listProducts[j].classList.add('compareproduct-block-item-hover');\n break;\n }\n }\n }\n};\n\nvar itemMouseOut = function itemMouseOut(e) {\n var target = e.target,\n row = getParent(target, '.js-compareproduct-block-row'),\n rowIndex;\n\n if (row != null) {\n rowIndex = row.getAttribute('data-row-index');\n\n for (var i = 0, il = listProperties.length; i < il; i++) {\n if (listProperties[i].getAttribute('data-row-index') === rowIndex) {\n listProperties[i].classList.remove('compareproduct-block-item-hover');\n break;\n }\n }\n\n for (var j = 0, jl = listProducts.length; j < jl; j++) {\n if (listProducts[j].getAttribute('data-row-index') === rowIndex) {\n listProducts[j].classList.remove('compareproduct-block-item-hover');\n break;\n }\n }\n }\n};\n\nvar itemRemove = function itemRemove(selector) {\n var itemsForRemove = container.querySelectorAll(selector);\n var tempElement, tempParent;\n\n for (var i = 0, il = itemsForRemove.length; i < il; i++) {\n tempElement = itemsForRemove[i];\n tempParent = tempElement.parentNode;\n tempParent.removeChild(tempElement);\n }\n\n rowsRemove();\n};\n\nvar rowRemove = function rowRemove(arrayIndexs) {\n var itemProduct, itemProperty, parentItemProduct, parentItemProperty;\n\n for (var i = 0, il = arrayIndexs.length; i < il; i++) {\n itemProduct = listProducts[arrayIndexs[i]];\n itemProperty = listProperties[arrayIndexs[i]];\n parentItemProduct = itemProduct.parentNode;\n parentItemProperty = itemProperty.parentNode;\n parentItemProduct.removeChild(itemProduct);\n parentItemProperty.removeChild(itemProperty);\n }\n\n findRows();\n\n if (listProperties.length === 0 && listProducts.length === 0) {\n container.style.display = 'none';\n containerEmpty.style.display = 'block';\n }\n};\n\nvar rowsRemove = function rowsRemove() {\n var isNeedRemove = true,\n row,\n childs,\n indexesRemove = []; //ищем строки которые надо удалить\n\n for (var j = 0, jl = listProducts.length; j < jl; j++) {\n row = listProducts[j];\n childs = makeArray(row.querySelectorAll('.js-compareproduct-product-item'));\n\n for (var c = 0, cl = childs.length; c < cl; c++) {\n if (childs[c].innerHTML.trim().length > 0) {\n isNeedRemove = false;\n break;\n }\n }\n\n if (isNeedRemove === true) {\n indexesRemove.push(j);\n }\n\n isNeedRemove = true;\n } //удаляем найденые строки\n\n\n rowRemove(indexesRemove);\n indexesRemove = [];\n};\n\nvar remove = function remove(e) {\n var id = e.target.getAttribute('data-compare-product-id');\n itemRemove('[data-compare-product-id=\"' + id + '\"]');\n e.target.removeEventListener('click', remove, false);\n};\n\nvar removeAll = function removeAll(e) {\n e.target.removeEventListener('click', removeAll, false);\n clearClickEvents(btnsRemove, remove);\n itemRemove('.js-compareproduct-removeall-container');\n};\n\nvar init = function init() {\n container = document.querySelector('.js-compareproduct-container');\n containerEmpty = document.querySelector('.js-compareproduct-empty');\n\n if (container == null) {\n return;\n }\n\n blocks = makeArray(container.querySelectorAll('.js-compareproduct-block'));\n btnsRemove = container.querySelectorAll('[data-compare-remove]');\n btnsRemoveAll = container.querySelectorAll('[data-compare-remove-all]');\n\n if (btnsRemoveAll != null) {\n addClickEvents(btnsRemoveAll, removeAll);\n }\n\n ; //разделяем по строчкам\n\n findRows();\n var maxHeight = 0;\n\n for (var k = 0, kl = listProperties.length; k < kl; k++) {\n maxHeight = Math.max(listProperties[k].clientHeight, listProducts[k].clientHeight);\n listProperties[k].style.height = maxHeight + 'px';\n listProducts[k].style.height = maxHeight + 'px';\n }\n\n container.addEventListener('mouseover', itemMouseOver);\n container.addEventListener('mouseout', itemMouseOut); //for (var c = 0, cl = btnsRemove.length; c < cl; c++) {\n // btnsRemove[c].addEventListener('click', remove);\n //}\n\n addClickEvents(btnsRemove, remove);\n container.classList.remove('compareproduct-container-processing');\n};\n\nvar addClickEvents = function addClickEvents(nodes, callbackEvent) {\n for (var c = 0, cl = nodes.length; c < cl; c++) {\n nodes[c].addEventListener('click', callbackEvent);\n }\n};\n\nvar clearClickEvents = function clearClickEvents(nodes, callbackEvent) {\n for (var c = 0, cl = nodes.length; c < cl; c++) {\n nodes[c].addEventListener('click', callbackEvent);\n }\n};\n\nvar load = function load() {\n init();\n window.removeEventListener('load', load, false);\n};\n\nwindow.addEventListener('load', load);","import ratingModule from '../_common/rating/rating.module.js';\nimport '../../styles/views/compareproducts.scss';\nimport './compare.js';\nvar moduleName = 'comparePage';\nangular.module(moduleName, [ratingModule]).controller('ComparePageCtrl', function () {});\nexport default moduleName;","// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};"],"names":[],"sourceRoot":""}