{"version":3,"file":"compare.649fb510575058b42b09.js","mappings":";;;;;;;;;;AAAA;;;;;;;;;;;;ACAA;;;;;;;;;;;;;;ACAA;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;;;;;;;;;;;;;;ACvBA;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;;;;;;;;;;;;;;;;;;AC9CA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AClBA;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;;;;;;;;;;;;;;;;;AC3LA;AACA;AACA;AACA;AACA;AACA","sources":["webpack://advantshop/./scripts/_common/rating/styles/rating.scss?1795","webpack://advantshop/./styles/views/compareproducts.scss?faef","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"],"sourcesContent":["// extracted by mini-css-extract-plugin\nexport {};","// extracted by mini-css-extract-plugin\nexport {};","import compareModule from '../scripts/compare/compare.module.js';\nimport appDependency from '../scripts/appDependency.js';\nappDependency.addItem(compareModule);","RatingCtrl.$inject = [\"$http\"];\n/* @ngInject */\nfunction RatingCtrl($http) {\n var ctrl = this;\n ctrl.items = [];\n ctrl.select = function (val) {\n if (ctrl.readonly === false) {\n ctrl.current = val;\n for (var i = 0; i < val; i++) {\n ctrl.items[i].isSelected = true;\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;\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 (scope, element, attrs, ctrls) {\n const rating = ctrls[0];\n const ngModel = ctrls[1];\n const childs = element[0].children;\n rating.max = parseInt(attrs.max) || 5;\n rating.readonly = attrs.readonly != null ? attrs.readonly === 'true' : false;\n if (rating.readonly) {\n element[0].classList.add(\"rating-readonly\");\n }\n rating.current = parseInt(attrs.current);\n rating.url = attrs.url;\n rating.objId = attrs.objId;\n rating.rateBinding = attrs.rateBinding;\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 if (rating.readonly === false) {\n element[0].addEventListener('click', function (event) {\n const item = event.target.closest('.rating-item');\n if (item != null) {\n if (ngModel != null) {\n ngModel.$setViewValue(parseInt(item.getAttribute('data-index')));\n }\n const promise = rating.select(parseInt(item.getAttribute('data-index')));\n if (promise) {\n promise.then(() => {\n element[0].classList.add(\"rating-readonly\");\n });\n }\n scope.$digest();\n }\n });\n }\n }\n };\n}\nexport { ratingDirective };","import './styles/rating.scss';\nimport { ratingDirective } from './directives/ratingDirectives.js';\nimport RatingCtrl from './controllers/ratingController.js';\nconst moduleName = 'rating';\nangular.module(moduleName, []).controller('RatingCtrl', RatingCtrl).directive('rating', ratingDirective);\nexport default moduleName;","class AppDependency {\n constructor() {\n if (!window.___appDependency) {\n window.___appDependency = this;\n window.___appDependencyList = [];\n }\n return window.___appDependency;\n }\n addItem(moduleName) {\n window.___appDependencyList.push(moduleName);\n }\n addList(moduleNameList) {\n window.___appDependencyList.push.apply(window.___appDependencyList, moduleNameList);\n }\n get() {\n return window.___appDependencyList;\n }\n}\nexport default new AppDependency();","var container,\n containerEmpty,\n blocks = [],\n listProperties,\n listProducts,\n blocksItem = {},\n btnsRemove,\n btnsRemoveAll;\nvar makeArray = function (list) {\n var arr = [];\n if (list == null) {\n return arr;\n }\n for (var i = 0, il = list.length; i < il; i++) {\n arr.push(list[i]);\n }\n return arr;\n};\nvar getParent = function (elem, selector) {\n var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;\n while (elem) {\n if (matchesSelector.bind(elem)(selector)) {\n return elem;\n } else {\n elem = elem.parentElement;\n }\n }\n return null;\n};\nvar findRows = function () {\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};\nvar itemMouseOver = function (e) {\n var target = e.target,\n row = getParent(target, '.js-compareproduct-block-row'),\n rowIndex;\n if (row != null) {\n rowIndex = row.getAttribute('data-row-index');\n if (rowIndex == null) {\n return;\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 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};\nvar itemMouseOut = function (e) {\n var target = e.target,\n row = getParent(target, '.js-compareproduct-block-row'),\n rowIndex;\n if (row != null) {\n rowIndex = row.getAttribute('data-row-index');\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 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};\nvar itemRemove = function (selector) {\n var itemsForRemove = container.querySelectorAll(selector);\n var tempElement, tempParent;\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 rowsRemove();\n};\nvar rowRemove = function (arrayIndexs) {\n var itemProduct, itemProperty, parentItemProduct, parentItemProperty;\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 findRows();\n if (listProperties.length === 0 && listProducts.length === 0) {\n container.style.display = 'none';\n containerEmpty.style.display = 'block';\n }\n};\nvar rowsRemove = function () {\n var isNeedRemove = true,\n row,\n childs,\n indexesRemove = [];\n\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 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 if (isNeedRemove === true) {\n indexesRemove.push(j);\n }\n isNeedRemove = true;\n }\n\n //удаляем найденые строки\n rowRemove(indexesRemove);\n indexesRemove = [];\n};\nvar remove = function (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};\nvar removeAll = function (e) {\n e.target.removeEventListener('click', removeAll, false);\n clearClickEvents(btnsRemove, remove);\n itemRemove('.js-compareproduct-removeall-container');\n};\nvar init = function () {\n container = document.querySelector('.js-compareproduct-container');\n containerEmpty = document.querySelector('.js-compareproduct-empty');\n if (container == null) {\n return;\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 if (btnsRemoveAll != null) {\n addClickEvents(btnsRemoveAll, removeAll);\n }\n ;\n\n //разделяем по строчкам\n\n findRows();\n var maxHeight = 0;\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 container.addEventListener('mouseover', itemMouseOver);\n container.addEventListener('mouseout', itemMouseOut);\n\n //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};\nvar addClickEvents = function (nodes, callbackEvent) {\n for (var c = 0, cl = nodes.length; c < cl; c++) {\n nodes[c].addEventListener('click', callbackEvent);\n }\n};\nvar clearClickEvents = function (nodes, callbackEvent) {\n for (var c = 0, cl = nodes.length; c < cl; c++) {\n nodes[c].addEventListener('click', callbackEvent);\n }\n};\nvar load = function () {\n init();\n window.removeEventListener('load', load, false);\n};\nwindow.addEventListener('load', load);","import ratingModule from '../_common/rating/rating.module.js';\nimport '../../styles/views/compareproducts.scss';\nimport './compare.js';\nconst moduleName = 'comparePage';\nangular.module(moduleName, [ratingModule]).controller('ComparePageCtrl', function () {});\nexport default moduleName;"],"names":[],"sourceRoot":""}