{"version":3,"file":"addresses.js","mappings":";;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAAA;AAAA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AAEA;AAEA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AAEA;AAEA;AAEA;AACA;AACA;AACA;AAEA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;;;;;;ACtOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;ACvBA","sources":["webpack:///./Frontend/src/Shared/Main/Addresses/Addresses.js","webpack:///webpack/bootstrap","webpack:///./Frontend/src/addresses.ts"],"sourcesContent":["Addresses = window.Addresses = (function () {\n const selectors = {\n searchInput: '#search-input',\n bodyTableRowWrapper: '.addresses-body__table .addresses-body__table-row-wrapper',\n tableRowWrapper: '.addresses-body__table-row-wrapper',\n cityName: '.addresses-body__address-city',\n cityAddressName: '.addresses-body__address-name',\n tableRow: '.addresses-body__table-row',\n bodyTableSeparator: '.addresses-body__table .addresses-body__table-separator',\n tableSeparatorGroup: '.addresses-body__table-separator-group',\n expandedRow: '.addresses-body__expanded-row',\n expandedRowWrapper: '.addresses-body__expanded-row-wrapper',\n expandedRowTime: '.addresses-body__expanded-row-cell.m-time',\n scrollArea: '#m-page-content-scrollbar-scrollarea',\n emptySelector: '#empty_addresses'\n };\n\n const toggleMessage = 'endToggle';\n\n function init() {\n bindUI();\n Search.init('addresses');\n }\n\n function filterAddresses(query, pushCallback, withCity) {\n var cities = $(selectors.bodyTableRowWrapper);\n for (var k = 0; k < cities.length; k++) {\n var city = $(cities[k]);\n var cityName = city.find(selectors.cityName).text();\n var adrs = city.find(selectors.cityAddressName).filter(function(i, e) {\n if (withCity && cityName.toLowerCase().includes(query.toLowerCase())) return true;\n var splits = query.split(' ');\n return splits.filter(function(k) {\n return $(e).text().toLowerCase().includes(k.toLowerCase());\n }).length == splits.length;\n });\n\n pushCallback(adrs, cityName);\n }\n }\n\n function filter(query) {\n var deferred = $.Deferred();\n\n var els = [];\n filterAddresses(query,\n function(adrs, cityName) {\n for (var j = 0; j < adrs.length; j++) {\n els.push({\n city: cityName,\n address: $(adrs[j]).text()\n });\n }\n }, true);\n window.Search.hide();\n\n var deffereds = [];\n var cities = $(selectors.bodyTableRowWrapper);\n for (var j = 0; j < cities.length; j++) {\n var city = $(cities[j]);\n var cityName = city.find(selectors.cityName).text();\n\n if (els.filter(function(el) { return el.city === cityName; }).length === 0) {\n city.hide();\n city.addClass(\"m-hidden\");\n } else {\n var def = $.Deferred();\n deffereds.push(def);\n\n city.show();\n city.removeClass(\"m-hidden\");\n\n var row = city.find(selectors.tableRow);\n row.one(toggleMessage,\n function() {\n //по адресам------\n var addrs = $(this).closest(selectors.bodyTableRowWrapper).find(selectors.cityAddressName);\n for (var i = 0; i < addrs.length; i++) {\n var addr = $(addrs[i]);\n var addrName = $(addr).text();\n var exp = $(addr).closest(selectors.expandedRowWrapper);\n if (els.filter(function(el) { return el.address === addrName; }).length === 0) {\n exp.hide();\n exp.addClass(\"m-hidden\");\n } else {\n exp.show();\n exp.removeClass(\"m-hidden\");\n }\n }\n def.resolve();\n });\n if (row.hasClass(\"m-opened\")) {\n row.trigger(toggleMessage);\n } else {\n row.click();\n }\n }\n }\n\n var separators = $(selectors.bodyTableSeparator);\n for (var l = 0; l < separators.length; l++) {\n var separator = $(separators[l]);\n var group = separator.siblings(selectors.tableSeparatorGroup + \"[data-group=\" + separator.text() + \"]\");\n if (group.length == 0) continue;\n\n if (group.find(selectors.tableRowWrapper + ':not(.m-hidden)').length == 0) {\n separator.addClass(\"m-hidden\");\n separator.hide();\n } else {\n separator.show();\n separator.removeClass(\"m-hidden\");\n }\n }\n\n if (deffereds.length > 0) {\n $.when(deffereds).done(function() { deferred.resolve(); });\n } else {\n deferred.resolve();\n }\n\n var empty = $(selectors.emptySelector);\n if (els.length === 0) {\n if (!empty.hasClass('active'))\n empty.addClass('active');\n } else {\n if (empty.hasClass('active'))\n empty.removeClass('active');\n }\n\n return deferred.promise();\n }\n\n function bindUI() {\n var lastQuery = '';\n app.body.on('keypress', selectors.searchInput,\n function(e) {\n if (e.which == 13) {\n var query = $(this).val().trim();\n if (query.trim() === lastQuery)\n return false;\n lastQuery = query.trim();\n\n filter(query);\n\n return false;\n }\n });\n }\n\n function dispose() {\n $('#page-content').empty();\n }\n\n function reset() {\n var cities = $(selectors.bodyTableRowWrapper);\n for (var j = 0; j < cities.length; j++) {\n var city = $(cities[j]);\n city.show();\n city.removeClass(\"m-hidden\");\n var row = city.closest(selectors.tableRowWrapper).find(selectors.tableRow);\n if(row.hasClass(\"m-opened\")) row.click();\n }\n\n var separators = $(selectors.bodyTableSeparator);\n for (var l = 0; l < separators.length; l++) {\n var separator = $(separators[l]);\n separator.show();\n separator.removeClass(\"m-hidden\");\n }\n }\n\n return {\n selectors: selectors,\n init: init,\n dispose: dispose,\n search: function(query) {\n var els = [];\n filterAddresses(query,\n function(adrs, cityName) {\n for (var j = 0; j < adrs.length; j++) {\n els.push({\n city: cityName,\n address: $(adrs[j]).text(),\n id: $(adrs[j]).closest(selectors.expandedRow).data('id'),\n time: $(adrs[j]).parent().siblings(selectors.expandedRowTime).text()\n });\n }\n }, true);\n\n Search.drawResultEvents({\n events: els,\n overflow: els.length > 10\n }, query);\n Search.show();\n },\n select: function(id) {\n filter($(selectors.searchInput).val()).done(function() {\n var row = $(selectors.expandedRow + '[data-id=' + id + ']');\n var city = row.closest(selectors.tableRowWrapper).find(selectors.tableRow);\n\n var rowClick = function() {\n row.one(toggleMessage,\n function() {\n var pageContentMargin = 20;\n $(selectors.scrollArea).scrollTop(row.position().top - pageContentMargin);\n });\n if (row.closest(selectors.expandedRowWrapper).hasClass('m-opened')) {\n row.trigger(toggleMessage);\n } else {\n row.click();\n }\n };\n\n city.one(toggleMessage,\n function() {\n rowClick();\n });\n if (city.hasClass('m-opened')) {\n city.trigger(toggleMessage);\n } else {\n city.click();\n }\n });\n },\n reset: reset\n }\n}());\n\n$(function() {\n Addresses.init();\n});","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","import './Shared/Main/Addresses/Addresses.js';\n"],"names":[],"sourceRoot":""}