{"version":3,"sources":["webpack:///webpack/universalModuleDefinition","webpack:///optimal-select.min.js","webpack:///webpack/bootstrap 5aff67bacfce974833ae","webpack:///./src/index.js","webpack:///./src/adapt.js","webpack:///./src/common.js","webpack:///./src/optimize.js","webpack:///./src/utilities.js","webpack:///./src/match.js","webpack:///./src/select.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","_interopRequireWildcard","obj","__esModule","newObj","key","Object","prototype","hasOwnProperty","default","_interopRequireDefault","defineProperty","value","common","optimize","getMultiSelector","getSingleSelector","select","undefined","_select2","enumerable","get","_select3","_optimize2","_optimize3","_common2","_common","global","adapt","element","options","document","context","parent","ElementPrototype","getPrototypeOf","getOwnPropertyDescriptor","children","filter","node","type","attribs","attributesNames","keys","NamedNodeMap","reduce","attributes","attributeName","index","name","configurable","length","getAttribute","getElementsByTagName","tagName","HTMLCollection","traverseDescendants","childTags","descendant","push","getElementsByClassName","className","names","trim","replace","split","descendantClassName","class","every","indexOf","querySelectorAll","selectors","_this","instructions","getInstructions","discover","shift","total","step","contains","inclusive","done","reverse","map","selector","_selector$split","_selector$split2","_slicedToArray","pseudo","validate","instruction","test","substr","nodeClassName","join","getAncestor","_type$replace$split","_type$replace$split2","attributeKey","attributeValue","hasAttribute","_ret2","NodeList","v","_typeof","_ret3","_ret4","_ret5","rule","match","kind","parseInt","validatePseudo","compareSet","nodeIndex","findIndex","child","matchedNode","nodes","handler","forEach","progress","Symbol","iterator","constructor","sliceIterator","arr","i","_arr","_n","_d","_e","_s","_i","next","err","Array","isArray","TypeError","getCommonAncestor","elements","arguments","_options$root","ancestors","skip","ignore","parents","parentNode","unshift","sort","curr","shallowAncestor","ancestor","_loop","missing","some","otherParents","otherParent","l","_ret","getCommonProperties","commonProperties","classes","tag","commonClasses","commonAttributes","commonTag","entry","elementAttributes","attribute","commonAttributesNames","nextCommonAttributes","toLowerCase","_utilities","convertNodeList","nodeType","Error","globalModified","_adapt2","path","optimizePart","shortened","pop","current","prePart","postPart","pattern","matches","slice","compareResults","references","reference","description","partial","_references","_loop2","_adapt","_options$skip","_options$ignore","skipCompare","skipChecks","compare","ignoreClass","predicate","toString","RegExp","bind","ignoreAttribute","defaultPredicate","checkId","checkClassGlobal","checkAttributeGlobal","checkTagGlobal","checkClassLocal","checkAttributeLocal","checkTagLocal","checkClassChild","checkAttributeChild","checkTagChild","checkClass","checkIgnore","checkChild","checkAttribute","defaultIgnore","checkTag","check","getQuerySelector","input","_match2","optimized","ancestorSelector","commonSelectors","getCommonSelectors","descendantSelector","selectorMatches","console","warn","_getCommonProperties","selectorPath","classSelector","attributeSelector","parts","_match","_optimize"],"mappings":"CAAA,SAAAA,EAAAC,GACA,gBAAAC,UAAA,gBAAAC,QACAA,OAAAD,QAAAD,IACA,kBAAAG,gBAAAC,IACAD,UAAAH,GACA,gBAAAC,SACAA,QAAA,cAAAD,IAEAD,EAAA,cAAAC,KACCK,KAAA,WACD,MCAgB,UAAUC,GCN1B,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAP,OAGA,IAAAC,GAAAO,EAAAD,IACAP,WACAS,GAAAF,EACAG,QAAA,EAUA,OANAL,GAAAE,GAAAI,KAAAV,EAAAD,QAAAC,IAAAD,QAAAM,GAGAL,EAAAS,QAAA,EAGAT,EAAAD,QAvBA,GAAAQ,KAqCA,OATAF,GAAAM,EAAAP,EAGAC,EAAAO,EAAAL,EAGAF,EAAAQ,EAAA,GAGAR,EAAA,KDgBM,SAASL,EAAQD,EAASM,GAE/B,YAgCA,SAASS,GAAwBC,GAAO,GAAIA,GAAOA,EAAIC,WAAc,MAAOD,EAAc,IAAIE,KAAa,IAAW,MAAPF,EAAe,IAAK,GAAIG,KAAOH,GAAWI,OAAOC,UAAUC,eAAeX,KAAKK,EAAKG,KAAMD,EAAOC,GAAOH,EAAIG,GAAgC,OAAtBD,GAAOK,QAAUP,EAAYE,EAElQ,QAASM,GAAuBR,GAAO,MAA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qC,KAAKG,GAAYD,OAAO,SAACoM,EAAOhM,GAE/D,MADAgM,GAAMtL,KAAN,IAAeV,EAAf,KAAwBH,EAAWG,GAAnC,MACOgM,OACFnJ,KAAK,GACZgJ,GAAanL,KAAKqL,GAOpB,MAJIF,GAAa3L,QAKf2L,EAAahJ,KAAK,KRorCrBxF,OAAOK,eAAezB,EAAS,cAC7B0B,OAAO,GAGT,IAAI4F,GAA4B,kBAAXkB,SAAoD,gBAApBA,QAAOC,SAAwB,SAAUzH,GAAO,aAAcA,IAAS,SAAUA,GAAO,MAAOA,IAAyB,kBAAXwH,SAAyBxH,EAAI0H,cAAgBF,OAAS,eAAkBxH,GAO1OhB,GAAQuB,QQtzCeyN,ERuzCvBhP,EQzyCe8B,oBR0yCf9B,EQxwCe6B,kBA7DhB,IAAAqL,GAAA5M,EAAA,GRy0CK0L,EAAUxK,EAAuB0L,GQx0CtC8C,EAAA1P,EAAA,GR40CK4O,EAAU1N,EAAuBwO,GQ30CtCC,EAAA3P,EAAA,GR+0CK+B,EAAab,EAAuByO,GQ90CzCtE,EAAArL,EAAA,GACAkC,EAAAlC,EAAA,KRm+C8BK,KAAKX,EAAU,WAAa,MAAOI","file":"optimal-select.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"OptimalSelect\"] = factory();\n\telse\n\t\troot[\"OptimalSelect\"] = factory();\n})(this, function() {\nreturn \n\n\n/** WEBPACK FOOTER **\n ** webpack/universalModuleDefinition\n **/","(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"OptimalSelect\"] = factory();\n\telse\n\t\troot[\"OptimalSelect\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId])\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\texports: {},\n/******/ \t\t\tid: moduleId,\n/******/ \t\t\tloaded: false\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.loaded = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(0);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = exports.common = exports.optimize = exports.getMultiSelector = exports.getSingleSelector = exports.select = undefined;\n\t\n\tvar _select2 = __webpack_require__(6);\n\t\n\tObject.defineProperty(exports, 'getSingleSelector', {\n\t enumerable: true,\n\t get: function get() {\n\t return _select2.getSingleSelector;\n\t }\n\t});\n\tObject.defineProperty(exports, 'getMultiSelector', {\n\t enumerable: true,\n\t get: function get() {\n\t return _select2.getMultiSelector;\n\t }\n\t});\n\t\n\tvar _select3 = _interopRequireDefault(_select2);\n\t\n\tvar _optimize2 = __webpack_require__(3);\n\t\n\tvar _optimize3 = _interopRequireDefault(_optimize2);\n\t\n\tvar _common2 = __webpack_require__(2);\n\t\n\tvar _common = _interopRequireWildcard(_common2);\n\t\n\tfunction _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\texports.select = _select3.default;\n\texports.optimize = _optimize3.default;\n\texports.common = _common;\n\texports.default = _select3.default;\n\n/***/ },\n/* 1 */\n/***/ function(module, exports) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; };\n\t\n\tvar _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"]) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); } }; }();\n\t\n\texports.default = adapt;\n\t/**\n\t * # Adapt\n\t *\n\t * Check and extend the environment for universal usage\n\t */\n\t\n\t/**\n\t * Modify the context based on the environment\n\t *\n\t * @param {HTMLELement} element - [description]\n\t * @param {Object} options - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction adapt(element, options) {\n\t\n\t // detect environment setup\n\t if (global.document) {\n\t return false;\n\t }\n\t\n\t var context = options.context;\n\t\n\t\n\t global.document = context || function () {\n\t var root = element;\n\t while (root.parent) {\n\t root = root.parent;\n\t }\n\t return root;\n\t }();\n\t\n\t // https://github.com/fb55/domhandler/blob/master/index.js#L75\n\t var ElementPrototype = Object.getPrototypeOf(global.document);\n\t\n\t // alternative descriptor to access elements with filtering invalid elements (e.g. textnodes)\n\t if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'childTags')) {\n\t Object.defineProperty(ElementPrototype, 'childTags', {\n\t enumerable: true,\n\t get: function get() {\n\t return this.children.filter(function (node) {\n\t // https://github.com/fb55/domelementtype/blob/master/index.js#L12\n\t return node.type === 'tag' || node.type === 'script' || node.type === 'style';\n\t });\n\t }\n\t });\n\t }\n\t\n\t if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'attributes')) {\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes\n\t // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap\n\t Object.defineProperty(ElementPrototype, 'attributes', {\n\t enumerable: true,\n\t get: function get() {\n\t var attribs = this.attribs;\n\t\n\t var attributesNames = Object.keys(attribs);\n\t var NamedNodeMap = attributesNames.reduce(function (attributes, attributeName, index) {\n\t attributes[index] = {\n\t name: attributeName,\n\t value: attribs[attributeName]\n\t };\n\t return attributes;\n\t }, {});\n\t Object.defineProperty(NamedNodeMap, 'length', {\n\t enumerable: false,\n\t configurable: false,\n\t value: attributesNames.length\n\t });\n\t return NamedNodeMap;\n\t }\n\t });\n\t }\n\t\n\t if (!ElementPrototype.getAttribute) {\n\t // https://docs.webplatform.org/wiki/dom/Element/getAttribute\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute\n\t ElementPrototype.getAttribute = function (name) {\n\t return this.attribs[name] || null;\n\t };\n\t }\n\t\n\t if (!ElementPrototype.getElementsByTagName) {\n\t // https://docs.webplatform.org/wiki/dom/Document/getElementsByTagName\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName\n\t ElementPrototype.getElementsByTagName = function (tagName) {\n\t var HTMLCollection = [];\n\t traverseDescendants(this.childTags, function (descendant) {\n\t if (descendant.name === tagName || tagName === '*') {\n\t HTMLCollection.push(descendant);\n\t }\n\t });\n\t return HTMLCollection;\n\t };\n\t }\n\t\n\t if (!ElementPrototype.getElementsByClassName) {\n\t // https://docs.webplatform.org/wiki/dom/Document/getElementsByClassName\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName\n\t ElementPrototype.getElementsByClassName = function (className) {\n\t var names = className.trim().replace(/\\s+/g, ' ').split(' ');\n\t var HTMLCollection = [];\n\t traverseDescendants([this], function (descendant) {\n\t var descendantClassName = descendant.attribs.class;\n\t if (descendantClassName && names.every(function (name) {\n\t return descendantClassName.indexOf(name) > -1;\n\t })) {\n\t HTMLCollection.push(descendant);\n\t }\n\t });\n\t return HTMLCollection;\n\t };\n\t }\n\t\n\t if (!ElementPrototype.querySelectorAll) {\n\t // https://docs.webplatform.org/wiki/css/selectors_api/querySelectorAll\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll\n\t ElementPrototype.querySelectorAll = function (selectors) {\n\t var _this = this;\n\t\n\t selectors = selectors.replace(/(>)(\\S)/g, '$1 $2').trim(); // add space for '>' selector\n\t\n\t // using right to left execution => https://github.com/fb55/css-select#how-does-it-work\n\t var instructions = getInstructions(selectors);\n\t var discover = instructions.shift();\n\t\n\t var total = instructions.length;\n\t return discover(this).filter(function (node) {\n\t var step = 0;\n\t while (step < total) {\n\t node = instructions[step](node, _this);\n\t if (!node) {\n\t // hierarchy doesn't match\n\t return false;\n\t }\n\t step += 1;\n\t }\n\t return true;\n\t });\n\t };\n\t }\n\t\n\t if (!ElementPrototype.contains) {\n\t // https://developer.mozilla.org/en-US/docs/Web/API/Node/contains\n\t ElementPrototype.contains = function (element) {\n\t var inclusive = false;\n\t traverseDescendants([this], function (descendant, done) {\n\t if (descendant === element) {\n\t inclusive = true;\n\t done();\n\t }\n\t });\n\t return inclusive;\n\t };\n\t }\n\t\n\t return true;\n\t}\n\t\n\t/**\n\t * Retrieve transformation steps\n\t *\n\t * @param {Array.} selectors - [description]\n\t * @return {Array.} - [description]\n\t */\n\tfunction getInstructions(selectors) {\n\t return selectors.split(' ').reverse().map(function (selector, step) {\n\t var discover = step === 0;\n\t\n\t var _selector$split = selector.split(':');\n\t\n\t var _selector$split2 = _slicedToArray(_selector$split, 2);\n\t\n\t var type = _selector$split2[0];\n\t var pseudo = _selector$split2[1];\n\t\n\t\n\t var validate = null;\n\t var instruction = null;\n\t\n\t (function () {\n\t switch (true) {\n\t\n\t // child: '>'\n\t case />/.test(type):\n\t instruction = function checkParent(node) {\n\t return function (validate) {\n\t return validate(node.parent) && node.parent;\n\t };\n\t };\n\t break;\n\t\n\t // class: '.'\n\t case /^\\./.test(type):\n\t var names = type.substr(1).split('.');\n\t validate = function validate(node) {\n\t var nodeClassName = node.attribs.class;\n\t return nodeClassName && names.every(function (name) {\n\t return nodeClassName.indexOf(name) > -1;\n\t });\n\t };\n\t instruction = function checkClass(node, root) {\n\t if (discover) {\n\t return node.getElementsByClassName(names.join(' '));\n\t }\n\t return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);\n\t };\n\t break;\n\t\n\t // attribute: '[key=\"value\"]'\n\t case /^\\[/.test(type):\n\t var _type$replace$split = type.replace(/\\[|\\]|\"/g, '').split('=');\n\t\n\t var _type$replace$split2 = _slicedToArray(_type$replace$split, 2);\n\t\n\t var attributeKey = _type$replace$split2[0];\n\t var attributeValue = _type$replace$split2[1];\n\t\n\t validate = function validate(node) {\n\t var hasAttribute = Object.keys(node.attribs).indexOf(attributeKey) > -1;\n\t if (hasAttribute) {\n\t // regard optional attributeValue\n\t if (!attributeValue || node.attribs[attributeKey] === attributeValue) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t };\n\t instruction = function checkAttribute(node, root) {\n\t if (discover) {\n\t var _ret2 = function () {\n\t var NodeList = [];\n\t traverseDescendants([node], function (descendant) {\n\t if (validate(descendant)) {\n\t NodeList.push(descendant);\n\t }\n\t });\n\t return {\n\t v: NodeList\n\t };\n\t }();\n\t\n\t if ((typeof _ret2 === 'undefined' ? 'undefined' : _typeof(_ret2)) === \"object\") return _ret2.v;\n\t }\n\t return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);\n\t };\n\t break;\n\t\n\t // id: '#'\n\t case /^#/.test(type):\n\t var id = type.substr(1);\n\t validate = function validate(node) {\n\t return node.attribs.id === id;\n\t };\n\t instruction = function checkId(node, root) {\n\t if (discover) {\n\t var _ret3 = function () {\n\t var NodeList = [];\n\t traverseDescendants([node], function (descendant, done) {\n\t if (validate(descendant)) {\n\t NodeList.push(descendant);\n\t done();\n\t }\n\t });\n\t return {\n\t v: NodeList\n\t };\n\t }();\n\t\n\t if ((typeof _ret3 === 'undefined' ? 'undefined' : _typeof(_ret3)) === \"object\") return _ret3.v;\n\t }\n\t return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);\n\t };\n\t break;\n\t\n\t // universal: '*'\n\t case /\\*/.test(type):\n\t validate = function validate(node) {\n\t return true;\n\t };\n\t instruction = function checkUniversal(node, root) {\n\t if (discover) {\n\t var _ret4 = function () {\n\t var NodeList = [];\n\t traverseDescendants([node], function (descendant) {\n\t return NodeList.push(descendant);\n\t });\n\t return {\n\t v: NodeList\n\t };\n\t }();\n\t\n\t if ((typeof _ret4 === 'undefined' ? 'undefined' : _typeof(_ret4)) === \"object\") return _ret4.v;\n\t }\n\t return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);\n\t };\n\t break;\n\t\n\t // tag: '...'\n\t default:\n\t validate = function validate(node) {\n\t return node.name === type;\n\t };\n\t instruction = function checkTag(node, root) {\n\t if (discover) {\n\t var _ret5 = function () {\n\t var NodeList = [];\n\t traverseDescendants([node], function (descendant) {\n\t if (validate(descendant)) {\n\t NodeList.push(descendant);\n\t }\n\t });\n\t return {\n\t v: NodeList\n\t };\n\t }();\n\t\n\t if ((typeof _ret5 === 'undefined' ? 'undefined' : _typeof(_ret5)) === \"object\") return _ret5.v;\n\t }\n\t return typeof node === 'function' ? node(validate) : getAncestor(node, root, validate);\n\t };\n\t }\n\t })();\n\t\n\t if (!pseudo) {\n\t return instruction;\n\t }\n\t\n\t var rule = pseudo.match(/-(child|type)\\((\\d+)\\)$/);\n\t var kind = rule[1];\n\t var index = parseInt(rule[2], 10) - 1;\n\t\n\t var validatePseudo = function validatePseudo(node) {\n\t if (node) {\n\t var compareSet = node.parent.childTags;\n\t if (kind === 'type') {\n\t compareSet = compareSet.filter(validate);\n\t }\n\t var nodeIndex = compareSet.findIndex(function (child) {\n\t return child === node;\n\t });\n\t if (nodeIndex === index) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t };\n\t\n\t return function enhanceInstruction(node) {\n\t var match = instruction(node);\n\t if (discover) {\n\t return match.reduce(function (NodeList, matchedNode) {\n\t if (validatePseudo(matchedNode)) {\n\t NodeList.push(matchedNode);\n\t }\n\t return NodeList;\n\t }, []);\n\t }\n\t return validatePseudo(match) && match;\n\t };\n\t });\n\t}\n\t\n\t/**\n\t * Walking recursive to invoke callbacks\n\t *\n\t * @param {Array.} nodes - [description]\n\t * @param {Function} handler - [description]\n\t */\n\tfunction traverseDescendants(nodes, handler) {\n\t nodes.forEach(function (node) {\n\t var progress = true;\n\t handler(node, function () {\n\t return progress = false;\n\t });\n\t if (node.childTags && progress) {\n\t traverseDescendants(node.childTags, handler);\n\t }\n\t });\n\t}\n\t\n\t/**\n\t * Bubble up from bottom to top\n\t *\n\t * @param {HTMLELement} node - [description]\n\t * @param {HTMLELement} root - [description]\n\t * @param {Function} validate - [description]\n\t * @return {HTMLELement} - [description]\n\t */\n\tfunction getAncestor(node, root, validate) {\n\t while (node.parent) {\n\t node = node.parent;\n\t if (validate(node)) {\n\t return node;\n\t }\n\t if (node === root) {\n\t break;\n\t }\n\t }\n\t return null;\n\t}\n\tmodule.exports = exports['default'];\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 2 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.getCommonAncestor = getCommonAncestor;\n\texports.getCommonProperties = getCommonProperties;\n\t/**\n\t * # Common\n\t *\n\t * Group similars\n\t */\n\t\n\t/**\n\t * Find the last common ancestor of elements\n\t *\n\t * @param {Array.} elements - [description]\n\t * @return {HTMLElement} - [description]\n\t */\n\tfunction getCommonAncestor(elements) {\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t var _options$root = options.root;\n\t var root = _options$root === undefined ? document : _options$root;\n\t var _options$skip = options.skip;\n\t var skip = _options$skip === undefined ? null : _options$skip;\n\t var _options$ignore = options.ignore;\n\t var ignore = _options$ignore === undefined ? {} : _options$ignore;\n\t\n\t\n\t var ancestors = [];\n\t\n\t elements.forEach(function (element, index) {\n\t var parents = [];\n\t while (element !== root) {\n\t element = element.parentNode;\n\t parents.unshift(element);\n\t }\n\t ancestors[index] = parents;\n\t });\n\t\n\t ancestors.sort(function (curr, next) {\n\t return curr.length - next.length;\n\t });\n\t\n\t var shallowAncestor = ancestors.shift();\n\t\n\t var ancestor = null;\n\t\n\t var _loop = function _loop() {\n\t var parent = shallowAncestor[i];\n\t var missing = ancestors.some(function (otherParents) {\n\t return !otherParents.some(function (otherParent) {\n\t return otherParent === parent;\n\t });\n\t });\n\t\n\t if (missing) {\n\t // TODO: find similar sub-parents, not the top root, e.g. sharing a class selector\n\t return 'break';\n\t }\n\t\n\t ancestor = parent;\n\t };\n\t\n\t for (var i = 0, l = shallowAncestor.length; i < l; i++) {\n\t var _ret = _loop();\n\t\n\t if (_ret === 'break') break;\n\t }\n\t\n\t return ancestor;\n\t}\n\t\n\t/**\n\t * Get a set of common properties of elements\n\t *\n\t * @param {Array.} elements - [description]\n\t * @return {Object} - [description]\n\t */\n\tfunction getCommonProperties(elements) {\n\t\n\t var commonProperties = {\n\t classes: [],\n\t attributes: {},\n\t tag: null\n\t };\n\t\n\t elements.forEach(function (element) {\n\t var commonClasses = commonProperties.classes;\n\t var commonAttributes = commonProperties.attributes;\n\t var commonTag = commonProperties.tag;\n\t\n\t // ~ classes\n\t\n\t if (commonClasses !== undefined) {\n\t var classes = element.getAttribute('class');\n\t if (classes) {\n\t classes = classes.trim().split(' ');\n\t if (!commonClasses.length) {\n\t commonProperties.classes = classes;\n\t } else {\n\t commonClasses = commonClasses.filter(function (entry) {\n\t return classes.some(function (name) {\n\t return name === entry;\n\t });\n\t });\n\t if (commonClasses.length) {\n\t commonProperties.classes = commonClasses;\n\t } else {\n\t delete commonProperties.classes;\n\t }\n\t }\n\t } else {\n\t // TODO: restructure removal as 2x set / 2x delete, instead of modify always replacing with new collection\n\t delete commonProperties.classes;\n\t }\n\t }\n\t\n\t // ~ attributes\n\t if (commonAttributes !== undefined) {\n\t (function () {\n\t var elementAttributes = element.attributes;\n\t var attributes = Object.keys(elementAttributes).reduce(function (attributes, key) {\n\t var attribute = elementAttributes[key];\n\t var attributeName = attribute.name;\n\t if (attributeName !== 'class') {\n\t attributes[attributeName] = attribute.value;\n\t }\n\t return attributes;\n\t }, {});\n\t\n\t var attributesNames = Object.keys(attributes);\n\t var commonAttributesNames = Object.keys(commonAttributes);\n\t\n\t if (attributesNames.length) {\n\t if (!commonAttributesNames.length) {\n\t commonProperties.attributes = attributes;\n\t } else {\n\t commonAttributes = commonAttributesNames.reduce(function (nextCommonAttributes, name) {\n\t var value = commonAttributes[name];\n\t if (value === attributes[name]) {\n\t nextCommonAttributes[name] = value;\n\t }\n\t return nextCommonAttributes;\n\t }, {});\n\t if (Object.keys(commonAttributes).length) {\n\t commonProperties.attributes = commonAttributes;\n\t } else {\n\t delete commonProperties.attributes;\n\t }\n\t }\n\t } else {\n\t delete commonProperties.attributes;\n\t }\n\t })();\n\t }\n\t\n\t // ~ tag\n\t if (commonTag !== undefined) {\n\t var tag = element.tagName.toLowerCase();\n\t if (!commonTag) {\n\t commonProperties.tag = tag;\n\t } else if (tag !== commonTag) {\n\t delete commonProperties.tag;\n\t }\n\t }\n\t });\n\t\n\t return commonProperties;\n\t}\n\n/***/ },\n/* 3 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = optimize;\n\t\n\tvar _adapt = __webpack_require__(1);\n\t\n\tvar _adapt2 = _interopRequireDefault(_adapt);\n\t\n\tvar _utilities = __webpack_require__(4);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Apply different optimization techniques\n\t *\n\t * @param {string} selector - [description]\n\t * @param {HTMLElement|Array.} element - [description]\n\t * @param {Object} options - [description]\n\t * @return {string} - [description]\n\t */\n\t/**\n\t * # Optimize\n\t *\n\t * 1.) Improve efficiency through shorter selectors by removing redundancy\n\t * 2.) Improve robustness through selector transformation\n\t */\n\t\n\tfunction optimize(selector, elements) {\n\t var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\t\n\t\n\t // convert single entry and NodeList\n\t if (!Array.isArray(elements)) {\n\t elements = !elements.length ? [elements] : (0, _utilities.convertNodeList)(elements);\n\t }\n\t\n\t if (!elements.length || elements.some(function (element) {\n\t return element.nodeType !== 1;\n\t })) {\n\t throw new Error('Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing \"elements\")');\n\t }\n\t\n\t var globalModified = (0, _adapt2.default)(elements[0], options);\n\t\n\t // chunk parts outside of quotes (http://stackoverflow.com/a/25663729)\n\t var path = selector.replace(/> /g, '>').split(/\\s+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)/);\n\t\n\t if (path.length < 3) {\n\t return optimizePart('', selector, '', elements);\n\t }\n\t\n\t var shortened = [path.pop()];\n\t while (path.length > 1) {\n\t var current = path.pop();\n\t var prePart = path.join(' ');\n\t var postPart = shortened.join(' ');\n\t\n\t var pattern = prePart + ' ' + postPart;\n\t var matches = document.querySelectorAll(pattern);\n\t if (matches.length !== elements.length) {\n\t shortened.unshift(optimizePart(prePart, current, postPart, elements));\n\t }\n\t }\n\t shortened.unshift(path[0]);\n\t path = shortened;\n\t\n\t // optimize start + end\n\t path[0] = optimizePart('', path[0], path.slice(1).join(' '), elements);\n\t path[path.length - 1] = optimizePart(path.slice(0, -1).join(' '), path[path.length - 1], '', elements);\n\t\n\t if (globalModified) {\n\t delete global.document;\n\t }\n\t\n\t return path.join(' ').replace(/>/g, '> ').trim();\n\t}\n\t\n\t/**\n\t * Improve a chunk of the selector\n\t *\n\t * @param {string} prePart - [description]\n\t * @param {string} current - [description]\n\t * @param {string} postPart - [description]\n\t * @param {Array.} elements - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction optimizePart(prePart, current, postPart, elements) {\n\t if (prePart.length) prePart = prePart + ' ';\n\t if (postPart.length) postPart = ' ' + postPart;\n\t\n\t // robustness: attribute without value (generalization)\n\t if (/\\[*\\]/.test(current)) {\n\t var key = current.replace(/=.*$/, ']');\n\t var pattern = '' + prePart + key + postPart;\n\t var matches = document.querySelectorAll(pattern);\n\t if (compareResults(matches, elements)) {\n\t current = key;\n\t } else {\n\t // robustness: replace specific key-value with base tag (heuristic)\n\t var references = document.querySelectorAll('' + prePart + key);\n\t\n\t var _loop = function _loop() {\n\t var reference = references[i];\n\t if (elements.some(function (element) {\n\t return reference.contains(element);\n\t })) {\n\t var description = reference.tagName.toLowerCase();\n\t pattern = '' + prePart + description + postPart;\n\t matches = document.querySelectorAll(pattern);\n\t\n\t if (compareResults(matches, elements)) {\n\t current = description;\n\t }\n\t return 'break';\n\t }\n\t };\n\t\n\t for (var i = 0, l = references.length; i < l; i++) {\n\t var pattern;\n\t var matches;\n\t\n\t var _ret = _loop();\n\t\n\t if (_ret === 'break') break;\n\t }\n\t }\n\t }\n\t\n\t // robustness: descendant instead child (heuristic)\n\t if (/>/.test(current)) {\n\t var descendant = current.replace(/>/, '');\n\t var pattern = '' + prePart + descendant + postPart;\n\t var matches = document.querySelectorAll(pattern);\n\t if (compareResults(matches, elements)) {\n\t current = descendant;\n\t }\n\t }\n\t\n\t // robustness: 'nth-of-type' instead 'nth-child' (heuristic)\n\t if (/:nth-child/.test(current)) {\n\t // TODO: consider complete coverage of 'nth-of-type' replacement\n\t var type = current.replace(/nth-child/g, 'nth-of-type');\n\t var pattern = '' + prePart + type + postPart;\n\t var matches = document.querySelectorAll(pattern);\n\t if (compareResults(matches, elements)) {\n\t current = type;\n\t }\n\t }\n\t\n\t // efficiency: combinations of classname (partial permutations)\n\t if (/\\.\\S+\\.\\S+/.test(current)) {\n\t var names = current.trim().split('.').slice(1).map(function (name) {\n\t return '.' + name;\n\t }).sort(function (curr, next) {\n\t return curr.length - next.length;\n\t });\n\t while (names.length) {\n\t var partial = current.replace(names.shift(), '').trim();\n\t var pattern = '' + prePart + partial + postPart;\n\t if (!pattern || partial === '>') {\n\t break;\n\t }\n\t var matches = document.querySelectorAll(pattern);\n\t if (compareResults(matches, elements)) {\n\t current = partial;\n\t }\n\t }\n\t // robustness: degrade complex classname (heuristic)\n\t if (current && current.match(/\\./g).length > 2) {\n\t var _references = document.querySelectorAll('' + prePart + current);\n\t\n\t var _loop2 = function _loop2() {\n\t var reference = _references[i];\n\t if (elements.some(function (element) {\n\t return reference.contains(element);\n\t })) {\n\t // TODO:\n\t // - check using attributes + regard excludes\n\t var description = reference.tagName.toLowerCase();\n\t pattern = '' + prePart + description + postPart;\n\t matches = document.querySelectorAll(pattern);\n\t\n\t if (compareResults(matches, elements)) {\n\t current = description;\n\t }\n\t return 'break';\n\t }\n\t };\n\t\n\t for (var i = 0, l = _references.length; i < l; i++) {\n\t var pattern;\n\t var matches;\n\t\n\t var _ret2 = _loop2();\n\t\n\t if (_ret2 === 'break') break;\n\t }\n\t }\n\t }\n\t\n\t return current;\n\t}\n\t\n\t/**\n\t * Evaluate matches with expected elements\n\t *\n\t * @param {Array.} matches - [description]\n\t * @param {Array.} elements - [description]\n\t * @return {Boolean} - [description]\n\t */\n\tfunction compareResults(matches, elements) {\n\t var length = matches.length;\n\t\n\t return length === elements.length && elements.every(function (element) {\n\t for (var i = 0; i < length; i++) {\n\t if (matches[i] === element) {\n\t return true;\n\t }\n\t }\n\t return false;\n\t });\n\t}\n\tmodule.exports = exports['default'];\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ },\n/* 4 */\n/***/ function(module, exports) {\n\n\t\"use strict\";\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.convertNodeList = convertNodeList;\n\t/**\n\t * # Utilities\n\t *\n\t * Convenience helpers\n\t */\n\t\n\t/**\n\t * Create an array with the DOM nodes of the list\n\t *\n\t * @param {NodeList} nodes - [description]\n\t * @return {Array.} - [description]\n\t */\n\tfunction convertNodeList(nodes) {\n\t var length = nodes.length;\n\t\n\t var arr = new Array(length);\n\t for (var i = 0; i < length; i++) {\n\t arr[i] = nodes[i];\n\t }\n\t return arr;\n\t}\n\n/***/ },\n/* 5 */\n/***/ function(module, exports) {\n\n\t'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\texports.default = match;\n\t/**\n\t * # Match\n\t *\n\t * Retrieves selector\n\t */\n\t\n\tvar defaultIgnore = {\n\t attribute: function attribute(attributeName) {\n\t return ['style', 'data-reactid', 'data-react-checksum'].indexOf(attributeName) > -1;\n\t }\n\t};\n\t\n\t/**\n\t * Get the path of the element\n\t *\n\t * @param {HTMLElement} node - [description]\n\t * @param {Object} options - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction match(node, options) {\n\t var _options$root = options.root;\n\t var root = _options$root === undefined ? document : _options$root;\n\t var _options$skip = options.skip;\n\t var skip = _options$skip === undefined ? null : _options$skip;\n\t var _options$ignore = options.ignore;\n\t var ignore = _options$ignore === undefined ? {} : _options$ignore;\n\t\n\t\n\t var path = [];\n\t var element = node;\n\t var length = path.length;\n\t\n\t var skipCompare = skip && (Array.isArray(skip) ? skip : [skip]).map(function (entry) {\n\t if (typeof entry !== 'function') {\n\t return function (element) {\n\t return element === entry;\n\t };\n\t }\n\t return entry;\n\t });\n\t\n\t var skipChecks = function skipChecks(element) {\n\t return skip && skipCompare.some(function (compare) {\n\t return compare(element);\n\t });\n\t };\n\t\n\t var ignoreClass = false;\n\t\n\t Object.keys(ignore).forEach(function (type) {\n\t if (type === 'class') {\n\t ignoreClass = true;\n\t }\n\t var predicate = ignore[type];\n\t if (typeof predicate === 'function') return;\n\t if (typeof predicate === 'number') {\n\t predicate = predicate.toString();\n\t }\n\t if (typeof predicate === 'string') {\n\t predicate = new RegExp(predicate);\n\t }\n\t // check class-/attributename for regex\n\t ignore[type] = predicate.test.bind(predicate);\n\t });\n\t\n\t if (ignoreClass) {\n\t (function () {\n\t var ignoreAttribute = ignore.attribute;\n\t ignore.attribute = function (name, value, defaultPredicate) {\n\t return ignore.class(value) || ignoreAttribute && ignoreAttribute(name, value, defaultPredicate);\n\t };\n\t })();\n\t }\n\t\n\t while (element !== root) {\n\t\n\t if (skipChecks(element) !== true) {\n\t // global\n\t if (checkId(element, path, ignore)) break;\n\t if (checkClassGlobal(element, path, ignore, root)) break;\n\t if (checkAttributeGlobal(element, path, ignore, root)) break;\n\t if (checkTagGlobal(element, path, ignore, root)) break;\n\t\n\t // local\n\t checkClassLocal(element, path, ignore);\n\t\n\t // define only one selector each iteration\n\t if (path.length === length) {\n\t checkAttributeLocal(element, path, ignore);\n\t }\n\t if (path.length === length) {\n\t checkTagLocal(element, path, ignore);\n\t }\n\t\n\t if (path.length === length) {\n\t checkClassChild(element, path, ignore);\n\t }\n\t if (path.length === length) {\n\t checkAttributeChild(element, path, ignore);\n\t }\n\t if (path.length === length) {\n\t checkTagChild(element, path, ignore);\n\t }\n\t }\n\t\n\t element = element.parentNode;\n\t length = path.length;\n\t }\n\t\n\t if (element === root) {\n\t path.unshift('*');\n\t }\n\t\n\t return path.join(' ');\n\t}\n\t\n\t/**\n\t * Preset 'checkClass' with global data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkClassGlobal(element, path, ignore, root) {\n\t return checkClass(element, path, ignore, root);\n\t}\n\t\n\t/**\n\t * Preset 'checkClass' with local data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkClassLocal(element, path, ignore) {\n\t return checkClass(element, path, ignore, element.parentNode);\n\t}\n\t\n\t/**\n\t * Preset 'checkChild' with class data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkClassChild(element, path, ignore) {\n\t var className = element.getAttribute('class');\n\t if (checkIgnore(ignore.class, className)) {\n\t return false;\n\t }\n\t return checkChild(element, path, '.' + className.trim().replace(/\\s+/g, '.'));\n\t}\n\t\n\t/**\n\t * Preset 'checkAttribute' with global data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkAttributeGlobal(element, path, ignore, root) {\n\t return checkAttribute(element, path, ignore, root);\n\t}\n\t\n\t/**\n\t * Preset 'checkAttribute' with local data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkAttributeLocal(element, path, ignore) {\n\t return checkAttribute(element, path, ignore, element.parentNode);\n\t}\n\t\n\t/**\n\t * Preset 'checkChild' with attribute data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkAttributeChild(element, path, ignore) {\n\t var attributes = element.attributes;\n\t return Object.keys(attributes).some(function (key) {\n\t var attribute = attributes[key];\n\t var attributeName = attribute.name;\n\t var attributeValue = attribute.value;\n\t if (checkIgnore(ignore.attribute, attributeName, attributeValue, defaultIgnore.attribute)) {\n\t return false;\n\t }\n\t var pattern = '[' + attributeName + '=\"' + attributeValue + '\"]';\n\t return checkChild(element, path, pattern);\n\t });\n\t}\n\t\n\t/**\n\t * Preset 'checkTag' with global data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkTagGlobal(element, path, ignore, root) {\n\t return checkTag(element, path, ignore, root);\n\t}\n\t\n\t/**\n\t * Preset 'checkTag' with local data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkTagLocal(element, path, ignore) {\n\t return checkTag(element, path, ignore, element.parentNode);\n\t}\n\t\n\t/**\n\t * Preset 'checkChild' with tag data\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkTagChild(element, path, ignore) {\n\t var tagName = element.tagName.toLowerCase();\n\t if (checkIgnore(ignore.tag, tagName)) {\n\t return false;\n\t }\n\t return checkChild(element, path, tagName);\n\t}\n\t\n\t/**\n\t * Lookup unique identifier\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkId(element, path, ignore) {\n\t var id = element.getAttribute('id');\n\t if (checkIgnore(ignore.id, id)) {\n\t return false;\n\t }\n\t path.unshift('#' + id);\n\t return true;\n\t}\n\t\n\t/**\n\t * Lookup class identifier\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @param {HTMLElement} parent - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkClass(element, path, ignore, parent) {\n\t var className = element.getAttribute('class');\n\t if (checkIgnore(ignore.class, className)) {\n\t return false;\n\t }\n\t var matches = parent.getElementsByClassName(className);\n\t if (matches.length === 1) {\n\t path.unshift('.' + className.trim().replace(/\\s+/g, '.'));\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Lookup attribute identifier\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {Object} ignore - [description]\n\t * @param {HTMLElement} parent - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkAttribute(element, path, ignore, parent) {\n\t var attributes = element.attributes;\n\t return Object.keys(attributes).some(function (key) {\n\t var attribute = attributes[key];\n\t var attributeName = attribute.name;\n\t var attributeValue = attribute.value;\n\t if (checkIgnore(ignore.attribute, attributeName, attributeValue, defaultIgnore.attribute)) {\n\t return false;\n\t }\n\t var pattern = '[' + attributeName + '=\"' + attributeValue + '\"]';\n\t var matches = parent.querySelectorAll(pattern);\n\t if (matches.length === 1) {\n\t path.unshift(pattern);\n\t return true;\n\t }\n\t });\n\t}\n\t\n\t/**\n\t * Lookup tag identifier\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {HTMLElement} parent - [description]\n\t * @param {Object} ignore - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkTag(element, path, ignore, parent) {\n\t var tagName = element.tagName.toLowerCase();\n\t if (checkIgnore(ignore.tag, tagName)) {\n\t return false;\n\t }\n\t var matches = parent.getElementsByTagName(tagName);\n\t if (matches.length === 1) {\n\t path.unshift(tagName);\n\t return true;\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Lookup child identfier\n\t *\n\t * Note: childTags is a custom property to use a view filter for tags on for virutal elements\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Array.} path - [description]\n\t * @param {String} selector - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkChild(element, path, selector) {\n\t var parent = element.parentNode;\n\t var children = parent.childTags || parent.children;\n\t for (var i = 0, l = children.length; i < l; i++) {\n\t if (children[i] === element) {\n\t path.unshift('> ' + selector + ':nth-child(' + (i + 1) + ')');\n\t return true;\n\t }\n\t }\n\t return false;\n\t}\n\t\n\t/**\n\t * Validate with custom and default functions\n\t *\n\t * @param {Function} predicate - [description]\n\t * @param {string} name - [description]\n\t * @param {string} value - [description]\n\t * @param {Function} defaultPredicate - [description]\n\t * @return {boolean} - [description]\n\t */\n\tfunction checkIgnore(predicate, name, value, defaultPredicate) {\n\t if (!name) {\n\t return true;\n\t }\n\t var check = predicate || defaultPredicate;\n\t if (!check) {\n\t return false;\n\t }\n\t return check(name, value || name, defaultPredicate);\n\t}\n\tmodule.exports = exports['default'];\n\n/***/ },\n/* 6 */\n/***/ function(module, exports, __webpack_require__) {\n\n\t/* WEBPACK VAR INJECTION */(function(global) {'use strict';\n\t\n\tObject.defineProperty(exports, \"__esModule\", {\n\t value: true\n\t});\n\t\n\tvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol ? \"symbol\" : typeof obj; }; /**\n\t * # Select\n\t *\n\t * Construct a unique CSS queryselector to access the selected DOM element(s).\n\t * Applies different matching and optimization strategies for efficiency.\n\t */\n\t\n\texports.default = getQuerySelector;\n\texports.getSingleSelector = getSingleSelector;\n\texports.getMultiSelector = getMultiSelector;\n\t\n\tvar _adapt = __webpack_require__(1);\n\t\n\tvar _adapt2 = _interopRequireDefault(_adapt);\n\t\n\tvar _match = __webpack_require__(5);\n\t\n\tvar _match2 = _interopRequireDefault(_match);\n\t\n\tvar _optimize = __webpack_require__(3);\n\t\n\tvar _optimize2 = _interopRequireDefault(_optimize);\n\t\n\tvar _utilities = __webpack_require__(4);\n\t\n\tvar _common = __webpack_require__(2);\n\t\n\tfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\t\n\t/**\n\t * Choose action depending on the input (single/multi)\n\t *\n\t * @param {HTMLElement|Array.} input - [description]\n\t * @param {Object} options - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction getQuerySelector(input) {\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\n\t if (!input.length) {\n\t return getSingleSelector(input, options);\n\t }\n\t return getMultiSelector(input, options);\n\t}\n\t\n\t/**\n\t * Get a selector for the provided element\n\t *\n\t * @param {HTMLElement} element - [description]\n\t * @param {Object} options - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction getSingleSelector(element) {\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\n\t\n\t if (element.nodeType === 3) {\n\t element = element.parentNode;\n\t }\n\t if (element.nodeType !== 1) {\n\t throw new Error('Invalid input - only HTMLElements or representations of them are supported! (not \"' + (typeof element === 'undefined' ? 'undefined' : _typeof(element)) + '\")');\n\t }\n\t\n\t var globalModified = (0, _adapt2.default)(element, options);\n\t\n\t var selector = (0, _match2.default)(element, options);\n\t var optimized = (0, _optimize2.default)(selector, element, options);\n\t\n\t // debug\n\t // console.log(`\n\t // selector: ${selector}\n\t // optimized: ${optimized}\n\t // `)\n\t\n\t if (globalModified) {\n\t delete global.document;\n\t }\n\t\n\t return optimized;\n\t}\n\t\n\t/**\n\t * Get a selector to match multiple descendants from an ancestor\n\t *\n\t * @param {Array.} elements - [description]\n\t * @param {Object} options - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction getMultiSelector(elements) {\n\t var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\t\n\t\n\t if (!Array.isArray(elements)) {\n\t elements = (0, _utilities.convertNodeList)(elements);\n\t }\n\t\n\t if (elements.some(function (element) {\n\t return element.nodeType !== 1;\n\t })) {\n\t throw new Error('Invalid input - only an Array of HTMLElements or representations of them is supported!');\n\t }\n\t\n\t var globalModified = (0, _adapt2.default)(elements[0], options);\n\t\n\t var ancestor = (0, _common.getCommonAncestor)(elements, options);\n\t var ancestorSelector = getSingleSelector(ancestor, options);\n\t\n\t // TODO: consider usage of multiple selectors + parent-child relation + check for part redundancy\n\t var commonSelectors = getCommonSelectors(elements);\n\t var descendantSelector = commonSelectors[0];\n\t\n\t var selector = (0, _optimize2.default)(ancestorSelector + ' ' + descendantSelector, elements, options);\n\t var selectorMatches = (0, _utilities.convertNodeList)(document.querySelectorAll(selector));\n\t\n\t if (!elements.every(function (element) {\n\t return selectorMatches.some(function (entry) {\n\t return entry === element;\n\t });\n\t })) {\n\t // TODO: cluster matches to split into similar groups for sub selections\n\t return console.warn('\\n The selected elements can\\'t be efficiently mapped.\\n Its probably best to use multiple single selectors instead!\\n ', elements);\n\t }\n\t\n\t if (globalModified) {\n\t delete global.document;\n\t }\n\t\n\t return selector;\n\t}\n\t\n\t/**\n\t * Get selectors to describe a set of elements\n\t *\n\t * @param {Array.} elements - [description]\n\t * @return {string} - [description]\n\t */\n\tfunction getCommonSelectors(elements) {\n\t var _getCommonProperties = (0, _common.getCommonProperties)(elements);\n\t\n\t var classes = _getCommonProperties.classes;\n\t var attributes = _getCommonProperties.attributes;\n\t var tag = _getCommonProperties.tag;\n\t\n\t\n\t var selectorPath = [];\n\t\n\t if (tag) {\n\t selectorPath.push(tag);\n\t }\n\t\n\t if (classes) {\n\t var classSelector = classes.map(function (name) {\n\t return '.' + name;\n\t }).join('');\n\t selectorPath.push(classSelector);\n\t }\n\t\n\t if (attributes) {\n\t var attributeSelector = Object.keys(attributes).reduce(function (parts, name) {\n\t parts.push('[' + name + '=\"' + attributes[name] + '\"]');\n\t return parts;\n\t }, []).join('');\n\t selectorPath.push(attributeSelector);\n\t }\n\t\n\t if (selectorPath.length) {\n\t // TODO: check for parent-child relation\n\t }\n\t\n\t return [selectorPath.join('')];\n\t}\n\t/* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }())))\n\n/***/ }\n/******/ ])\n});\n;\n\n\n/** WEBPACK FOOTER **\n ** optimal-select.min.js\n **/"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId])\n \t\t\treturn installedModules[moduleId].exports;\n\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\texports: {},\n \t\t\tid: moduleId,\n \t\t\tloaded: false\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.loaded = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(0);\n\n\n\n/** WEBPACK FOOTER **\n ** webpack/bootstrap 5aff67bacfce974833ae\n **/","export select, { getSingleSelector, getMultiSelector } from './select'\nexport optimize from './optimize'\nexport * as common from './common'\n\nexport default from './select'\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/index.js\n **/","/**\n * # Adapt\n *\n * Check and extend the environment for universal usage\n */\n\n/**\n * Modify the context based on the environment\n *\n * @param {HTMLELement} element - [description]\n * @param {Object} options - [description]\n * @return {boolean} - [description]\n */\nexport default function adapt (element, options) {\n\n // detect environment setup\n if (global.document) {\n return false\n }\n\n const { context } = options\n\n global.document = context || (() => {\n var root = element\n while (root.parent) {\n root = root.parent\n }\n return root\n })()\n\n // https://github.com/fb55/domhandler/blob/master/index.js#L75\n const ElementPrototype = Object.getPrototypeOf(global.document)\n\n // alternative descriptor to access elements with filtering invalid elements (e.g. textnodes)\n if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'childTags')) {\n Object.defineProperty(ElementPrototype, 'childTags', {\n enumerable: true,\n get () {\n return this.children.filter((node) => {\n // https://github.com/fb55/domelementtype/blob/master/index.js#L12\n return node.type === 'tag' || node.type === 'script' || node.type === 'style'\n })\n }\n })\n }\n\n if (!Object.getOwnPropertyDescriptor(ElementPrototype, 'attributes')) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/attributes\n // https://developer.mozilla.org/en-US/docs/Web/API/NamedNodeMap\n Object.defineProperty(ElementPrototype, 'attributes', {\n enumerable: true,\n get () {\n const { attribs } = this\n const attributesNames = Object.keys(attribs)\n const NamedNodeMap = attributesNames.reduce((attributes, attributeName, index) => {\n attributes[index] = {\n name: attributeName,\n value: attribs[attributeName]\n }\n return attributes\n }, { })\n Object.defineProperty(NamedNodeMap, 'length', {\n enumerable: false,\n configurable: false,\n value: attributesNames.length\n })\n return NamedNodeMap\n }\n })\n }\n\n if (!ElementPrototype.getAttribute) {\n // https://docs.webplatform.org/wiki/dom/Element/getAttribute\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getAttribute\n ElementPrototype.getAttribute = function (name) {\n return this.attribs[name] || null\n }\n }\n\n if (!ElementPrototype.getElementsByTagName) {\n // https://docs.webplatform.org/wiki/dom/Document/getElementsByTagName\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByTagName\n ElementPrototype.getElementsByTagName = function (tagName) {\n const HTMLCollection = []\n traverseDescendants(this.childTags, (descendant) => {\n if (descendant.name === tagName || tagName === '*') {\n HTMLCollection.push(descendant)\n }\n })\n return HTMLCollection\n }\n }\n\n if (!ElementPrototype.getElementsByClassName) {\n // https://docs.webplatform.org/wiki/dom/Document/getElementsByClassName\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/getElementsByClassName\n ElementPrototype.getElementsByClassName = function (className) {\n const names = className.trim().replace(/\\s+/g, ' ').split(' ')\n const HTMLCollection = []\n traverseDescendants([this], (descendant) => {\n const descendantClassName = descendant.attribs.class\n if (descendantClassName && names.every((name) => descendantClassName.indexOf(name) > -1)) {\n HTMLCollection.push(descendant)\n }\n })\n return HTMLCollection\n }\n }\n\n if (!ElementPrototype.querySelectorAll) {\n // https://docs.webplatform.org/wiki/css/selectors_api/querySelectorAll\n // https://developer.mozilla.org/en-US/docs/Web/API/Element/querySelectorAll\n ElementPrototype.querySelectorAll = function (selectors) {\n selectors = selectors.replace(/(>)(\\S)/g, '$1 $2').trim() // add space for '>' selector\n\n // using right to left execution => https://github.com/fb55/css-select#how-does-it-work\n const instructions = getInstructions(selectors)\n const discover = instructions.shift()\n\n const total = instructions.length\n return discover(this).filter((node) => {\n var step = 0\n while (step < total) {\n node = instructions[step](node, this)\n if (!node) { // hierarchy doesn't match\n return false\n }\n step += 1\n }\n return true\n })\n }\n }\n\n if (!ElementPrototype.contains) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/contains\n ElementPrototype.contains = function (element) {\n var inclusive = false\n traverseDescendants([this], (descendant, done) => {\n if (descendant === element) {\n inclusive = true\n done()\n }\n })\n return inclusive\n }\n }\n\n return true\n}\n\n/**\n * Retrieve transformation steps\n *\n * @param {Array.} selectors - [description]\n * @return {Array.} - [description]\n */\nfunction getInstructions (selectors) {\n return selectors.split(' ').reverse().map((selector, step) => {\n const discover = step === 0\n const [type, pseudo] = selector.split(':')\n\n var validate = null\n var instruction = null\n\n switch (true) {\n\n // child: '>'\n case />/.test(type):\n instruction = function checkParent (node) {\n return (validate) => validate(node.parent) && node.parent\n }\n break\n\n // class: '.'\n case /^\\./.test(type):\n const names = type.substr(1).split('.')\n validate = (node) => {\n const nodeClassName = node.attribs.class\n return nodeClassName && names.every((name) => nodeClassName.indexOf(name) > -1)\n }\n instruction = function checkClass (node, root) {\n if (discover) {\n return node.getElementsByClassName(names.join(' '))\n }\n return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)\n }\n break\n\n // attribute: '[key=\"value\"]'\n case /^\\[/.test(type):\n const [attributeKey, attributeValue] = type.replace(/\\[|\\]|\"/g, '').split('=')\n validate = (node) => {\n const hasAttribute = Object.keys(node.attribs).indexOf(attributeKey) > -1\n if (hasAttribute) { // regard optional attributeValue\n if (!attributeValue || (node.attribs[attributeKey] === attributeValue)) {\n return true\n }\n }\n return false\n }\n instruction = function checkAttribute (node, root) {\n if (discover) {\n const NodeList = []\n traverseDescendants([node], (descendant) => {\n if (validate(descendant)) {\n NodeList.push(descendant)\n }\n })\n return NodeList\n }\n return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)\n }\n break\n\n // id: '#'\n case /^#/.test(type):\n const id = type.substr(1)\n validate = (node) => {\n return node.attribs.id === id\n }\n instruction = function checkId (node, root) {\n if (discover) {\n const NodeList = []\n traverseDescendants([node], (descendant, done) => {\n if (validate(descendant)) {\n NodeList.push(descendant)\n done()\n }\n })\n return NodeList\n }\n return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)\n }\n break\n\n // universal: '*'\n case /\\*/.test(type):\n validate = (node) => true\n instruction = function checkUniversal (node, root) {\n if (discover) {\n const NodeList = []\n traverseDescendants([node], (descendant) => NodeList.push(descendant))\n return NodeList\n }\n return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)\n }\n break\n\n // tag: '...'\n default:\n validate = (node) => {\n return node.name === type\n }\n instruction = function checkTag (node, root) {\n if (discover) {\n const NodeList = []\n traverseDescendants([node], (descendant) => {\n if (validate(descendant)) {\n NodeList.push(descendant)\n }\n })\n return NodeList\n }\n return (typeof node === 'function') ? node(validate) : getAncestor(node, root, validate)\n }\n }\n\n if (!pseudo) {\n return instruction\n }\n\n const rule = pseudo.match(/-(child|type)\\((\\d+)\\)$/)\n const kind = rule[1]\n const index = parseInt(rule[2], 10) - 1\n\n const validatePseudo = (node) => {\n if (node) {\n var compareSet = node.parent.childTags\n if (kind === 'type') {\n compareSet = compareSet.filter(validate)\n }\n const nodeIndex = compareSet.findIndex((child) => child === node)\n if (nodeIndex === index) {\n return true\n }\n }\n return false\n }\n\n return function enhanceInstruction (node) {\n const match = instruction(node)\n if (discover) {\n return match.reduce((NodeList, matchedNode) => {\n if (validatePseudo(matchedNode)) {\n NodeList.push(matchedNode)\n }\n return NodeList\n }, [])\n }\n return validatePseudo(match) && match\n }\n })\n}\n\n/**\n * Walking recursive to invoke callbacks\n *\n * @param {Array.} nodes - [description]\n * @param {Function} handler - [description]\n */\nfunction traverseDescendants (nodes, handler) {\n nodes.forEach((node) => {\n var progress = true\n handler(node, () => progress = false)\n if (node.childTags && progress) {\n traverseDescendants(node.childTags, handler)\n }\n })\n}\n\n/**\n * Bubble up from bottom to top\n *\n * @param {HTMLELement} node - [description]\n * @param {HTMLELement} root - [description]\n * @param {Function} validate - [description]\n * @return {HTMLELement} - [description]\n */\nfunction getAncestor (node, root, validate) {\n while (node.parent) {\n node = node.parent\n if (validate(node)) {\n return node\n }\n if (node === root) {\n break\n }\n }\n return null\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/adapt.js\n **/","/**\n * # Common\n *\n * Group similars\n */\n\n/**\n * Find the last common ancestor of elements\n *\n * @param {Array.} elements - [description]\n * @return {HTMLElement} - [description]\n */\nexport function getCommonAncestor (elements, options = {}) {\n\n const {\n root = document,\n skip = null,\n ignore = {}\n } = options\n\n const ancestors = []\n\n elements.forEach((element, index) => {\n const parents = []\n while (element !== root) {\n element = element.parentNode\n parents.unshift(element)\n }\n ancestors[index] = parents\n })\n\n ancestors.sort((curr, next) => curr.length - next.length)\n\n const shallowAncestor = ancestors.shift()\n\n var ancestor = null\n\n for (var i = 0, l = shallowAncestor.length; i < l; i++) {\n const parent = shallowAncestor[i]\n const missing = ancestors.some((otherParents) => {\n return !otherParents.some((otherParent) => otherParent === parent)\n })\n\n if (missing) {\n // TODO: find similar sub-parents, not the top root, e.g. sharing a class selector\n break\n }\n\n ancestor = parent\n }\n\n return ancestor\n}\n\n/**\n * Get a set of common properties of elements\n *\n * @param {Array.} elements - [description]\n * @return {Object} - [description]\n */\nexport function getCommonProperties (elements) {\n\n const commonProperties = {\n classes: [],\n attributes: {},\n tag: null\n }\n\n elements.forEach((element) => {\n\n var {\n classes: commonClasses,\n attributes: commonAttributes,\n tag: commonTag\n } = commonProperties\n\n // ~ classes\n if (commonClasses !== undefined) {\n var classes = element.getAttribute('class')\n if (classes) {\n classes = classes.trim().split(' ')\n if (!commonClasses.length) {\n commonProperties.classes = classes\n } else {\n commonClasses = commonClasses.filter((entry) => classes.some((name) => name === entry))\n if (commonClasses.length) {\n commonProperties.classes = commonClasses\n } else {\n delete commonProperties.classes\n }\n }\n } else {\n // TODO: restructure removal as 2x set / 2x delete, instead of modify always replacing with new collection\n delete commonProperties.classes\n }\n }\n\n // ~ attributes\n if (commonAttributes !== undefined) {\n const elementAttributes = element.attributes\n const attributes = Object.keys(elementAttributes).reduce((attributes, key) => {\n const attribute = elementAttributes[key]\n const attributeName = attribute.name\n if (attributeName !== 'class') {\n attributes[attributeName] = attribute.value\n }\n return attributes\n }, {})\n\n const attributesNames = Object.keys(attributes)\n const commonAttributesNames = Object.keys(commonAttributes)\n\n if (attributesNames.length) {\n if (!commonAttributesNames.length) {\n commonProperties.attributes = attributes\n } else {\n commonAttributes = commonAttributesNames.reduce((nextCommonAttributes, name) => {\n const value = commonAttributes[name]\n if (value === attributes[name]) {\n nextCommonAttributes[name] = value\n }\n return nextCommonAttributes\n }, {})\n if (Object.keys(commonAttributes).length) {\n commonProperties.attributes = commonAttributes\n } else {\n delete commonProperties.attributes\n }\n }\n } else {\n delete commonProperties.attributes\n }\n }\n\n // ~ tag\n if (commonTag !== undefined) {\n const tag = element.tagName.toLowerCase()\n if (!commonTag) {\n commonProperties.tag = tag\n } else if (tag !== commonTag) {\n delete commonProperties.tag\n }\n }\n })\n\n return commonProperties\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/common.js\n **/","/**\n * # Optimize\n *\n * 1.) Improve efficiency through shorter selectors by removing redundancy\n * 2.) Improve robustness through selector transformation\n */\n\nimport adapt from './adapt'\nimport { convertNodeList } from './utilities'\n\n/**\n * Apply different optimization techniques\n *\n * @param {string} selector - [description]\n * @param {HTMLElement|Array.} element - [description]\n * @param {Object} options - [description]\n * @return {string} - [description]\n */\nexport default function optimize (selector, elements, options = {}) {\n\n // convert single entry and NodeList\n if (!Array.isArray(elements)) {\n elements = !elements.length ? [elements] : convertNodeList(elements)\n }\n\n if (!elements.length || elements.some((element) => element.nodeType !== 1)) {\n throw new Error(`Invalid input - to compare HTMLElements its necessary to provide a reference of the selected node(s)! (missing \"elements\")`)\n }\n\n const globalModified = adapt(elements[0], options)\n\n // chunk parts outside of quotes (http://stackoverflow.com/a/25663729)\n var path = selector.replace(/> /g, '>').split(/\\s+(?=(?:(?:[^\"]*\"){2})*[^\"]*$)/)\n\n if (path.length < 3) {\n return optimizePart('', selector, '', elements)\n }\n\n const shortened = [path.pop()]\n while (path.length > 1) {\n const current = path.pop()\n const prePart = path.join(' ')\n const postPart = shortened.join(' ')\n\n const pattern = `${prePart} ${postPart}`\n const matches = document.querySelectorAll(pattern)\n if (matches.length !== elements.length) {\n shortened.unshift(optimizePart(prePart, current, postPart, elements))\n }\n }\n shortened.unshift(path[0])\n path = shortened\n\n // optimize start + end\n path[0] = optimizePart('', path[0], path.slice(1).join(' '), elements)\n path[path.length-1] = optimizePart(path.slice(0, -1).join(' '), path[path.length-1], '', elements)\n\n if (globalModified) {\n delete global.document\n }\n\n return path.join(' ').replace(/>/g, '> ').trim()\n}\n\n/**\n * Improve a chunk of the selector\n *\n * @param {string} prePart - [description]\n * @param {string} current - [description]\n * @param {string} postPart - [description]\n * @param {Array.} elements - [description]\n * @return {string} - [description]\n */\nfunction optimizePart (prePart, current, postPart, elements) {\n if (prePart.length) prePart = `${prePart} `\n if (postPart.length) postPart = ` ${postPart}`\n\n // robustness: attribute without value (generalization)\n if (/\\[*\\]/.test(current)) {\n const key = current.replace(/=.*$/, ']')\n var pattern = `${prePart}${key}${postPart}`\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = key\n } else {\n // robustness: replace specific key-value with base tag (heuristic)\n const references = document.querySelectorAll(`${prePart}${key}`)\n for (var i = 0, l = references.length; i < l; i++) {\n const reference = references[i]\n if (elements.some((element) => reference.contains(element))) {\n const description = reference.tagName.toLowerCase()\n var pattern = `${prePart}${description}${postPart}`\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = description\n }\n break\n }\n }\n }\n }\n\n // robustness: descendant instead child (heuristic)\n if (/>/.test(current)) {\n const descendant = current.replace(/>/, '')\n var pattern = `${prePart}${descendant}${postPart}`\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = descendant\n }\n }\n\n // robustness: 'nth-of-type' instead 'nth-child' (heuristic)\n if (/:nth-child/.test(current)) {\n // TODO: consider complete coverage of 'nth-of-type' replacement\n const type = current.replace(/nth-child/g, 'nth-of-type')\n var pattern = `${prePart}${type}${postPart}`\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = type\n }\n }\n\n // efficiency: combinations of classname (partial permutations)\n if (/\\.\\S+\\.\\S+/.test(current)) {\n const names = current.trim().split('.').slice(1).map((name) => `.${name}`)\n .sort((curr, next) => curr.length - next.length)\n while (names.length) {\n var partial = current.replace(names.shift(), '').trim()\n var pattern = `${prePart}${partial}${postPart}`\n if (!pattern || partial === '>') {\n break\n }\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = partial\n }\n }\n // robustness: degrade complex classname (heuristic)\n if (current && current.match(/\\./g).length > 2) {\n const references = document.querySelectorAll(`${prePart}${current}`)\n for (var i = 0, l = references.length; i < l; i++) {\n const reference = references[i]\n if (elements.some((element) => reference.contains(element) )) {\n // TODO:\n // - check using attributes + regard excludes\n const description = reference.tagName.toLowerCase()\n var pattern = `${prePart}${description}${postPart}`\n var matches = document.querySelectorAll(pattern)\n if (compareResults(matches, elements)) {\n current = description\n }\n break\n }\n }\n }\n }\n\n return current\n}\n\n/**\n * Evaluate matches with expected elements\n *\n * @param {Array.} matches - [description]\n * @param {Array.} elements - [description]\n * @return {Boolean} - [description]\n */\nfunction compareResults (matches, elements) {\n const { length } = matches\n return length === elements.length && elements.every((element) => {\n for (var i = 0; i < length; i++) {\n if (matches[i] === element) {\n return true\n }\n }\n return false\n })\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/optimize.js\n **/","/**\n * # Utilities\n *\n * Convenience helpers\n */\n\n/**\n * Create an array with the DOM nodes of the list\n *\n * @param {NodeList} nodes - [description]\n * @return {Array.} - [description]\n */\nexport function convertNodeList (nodes) {\n const { length } = nodes\n const arr = new Array(length)\n for (var i = 0; i < length; i++) {\n arr[i] = nodes[i]\n }\n return arr\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/utilities.js\n **/","/**\n * # Match\n *\n * Retrieves selector\n */\n\nconst defaultIgnore = {\n attribute (attributeName) {\n return [\n 'style',\n 'data-reactid',\n 'data-react-checksum'\n ].indexOf(attributeName) > -1\n }\n}\n\n/**\n * Get the path of the element\n *\n * @param {HTMLElement} node - [description]\n * @param {Object} options - [description]\n * @return {string} - [description]\n */\nexport default function match (node, options) {\n\n const {\n root = document,\n skip = null,\n ignore = {}\n } = options\n\n const path = []\n var element = node\n var length = path.length\n\n const skipCompare = skip && (Array.isArray(skip) ? skip : [skip]).map((entry) => {\n if (typeof entry !== 'function') {\n return (element) => element === entry\n }\n return entry\n })\n\n const skipChecks = (element) => {\n return skip && skipCompare.some((compare) => compare(element))\n }\n\n var ignoreClass = false\n\n Object.keys(ignore).forEach((type) => {\n if (type === 'class') {\n ignoreClass = true\n }\n var predicate = ignore[type]\n if (typeof predicate === 'function') return\n if (typeof predicate === 'number') {\n predicate = predicate.toString()\n }\n if (typeof predicate === 'string') {\n predicate = new RegExp(predicate)\n }\n // check class-/attributename for regex\n ignore[type] = predicate.test.bind(predicate)\n })\n\n if (ignoreClass) {\n const ignoreAttribute = ignore.attribute\n ignore.attribute = (name, value, defaultPredicate) => {\n return ignore.class(value) || ignoreAttribute && ignoreAttribute(name, value, defaultPredicate)\n }\n }\n\n while (element !== root) {\n\n if (skipChecks(element) !== true) {\n // global\n if (checkId(element, path, ignore)) break\n if (checkClassGlobal(element, path, ignore, root)) break\n if (checkAttributeGlobal(element, path, ignore, root)) break\n if (checkTagGlobal(element, path, ignore, root)) break\n\n // local\n checkClassLocal(element, path, ignore)\n\n // define only one selector each iteration\n if (path.length === length) {\n checkAttributeLocal(element, path, ignore)\n }\n if (path.length === length) {\n checkTagLocal(element, path, ignore)\n }\n\n if (path.length === length) {\n checkClassChild(element, path, ignore)\n }\n if (path.length === length) {\n checkAttributeChild(element, path, ignore)\n }\n if (path.length === length) {\n checkTagChild(element, path, ignore)\n }\n }\n\n element = element.parentNode\n length = path.length\n }\n\n if (element === root) {\n path.unshift('*')\n }\n\n return path.join(' ')\n}\n\n\n/**\n * Preset 'checkClass' with global data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkClassGlobal (element, path, ignore, root) {\n return checkClass(element, path, ignore, root)\n}\n\n/**\n * Preset 'checkClass' with local data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkClassLocal (element, path, ignore) {\n return checkClass(element, path, ignore, element.parentNode)\n}\n\n/**\n * Preset 'checkChild' with class data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkClassChild (element, path, ignore) {\n const className = element.getAttribute('class')\n if (checkIgnore(ignore.class, className)) {\n return false\n }\n return checkChild(element, path, `.${className.trim().replace(/\\s+/g, '.')}`)\n}\n\n/**\n * Preset 'checkAttribute' with global data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkAttributeGlobal (element, path, ignore, root) {\n return checkAttribute(element, path, ignore, root)\n}\n\n/**\n * Preset 'checkAttribute' with local data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkAttributeLocal (element, path, ignore) {\n return checkAttribute(element, path, ignore, element.parentNode)\n}\n\n/**\n * Preset 'checkChild' with attribute data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkAttributeChild (element, path, ignore) {\n const attributes = element.attributes\n return Object.keys(attributes).some((key) => {\n const attribute = attributes[key]\n const attributeName = attribute.name\n const attributeValue = attribute.value\n if (checkIgnore(ignore.attribute, attributeName, attributeValue, defaultIgnore.attribute)) {\n return false\n }\n const pattern = `[${attributeName}=\"${attributeValue}\"]`\n return checkChild(element, path, pattern)\n })\n}\n\n/**\n * Preset 'checkTag' with global data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkTagGlobal (element, path, ignore, root) {\n return checkTag(element, path, ignore, root)\n}\n\n/**\n * Preset 'checkTag' with local data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkTagLocal (element, path, ignore) {\n return checkTag(element, path, ignore, element.parentNode)\n}\n\n/**\n * Preset 'checkChild' with tag data\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkTagChild (element, path, ignore) {\n const tagName = element.tagName.toLowerCase()\n if (checkIgnore(ignore.tag, tagName)) {\n return false\n }\n return checkChild(element, path, tagName)\n}\n\n/**\n * Lookup unique identifier\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkId (element, path, ignore) {\n const id = element.getAttribute('id')\n if (checkIgnore(ignore.id, id)) {\n return false\n }\n path.unshift(`#${id}`)\n return true\n}\n\n/**\n * Lookup class identifier\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @param {HTMLElement} parent - [description]\n * @return {boolean} - [description]\n */\nfunction checkClass (element, path, ignore, parent) {\n const className = element.getAttribute('class')\n if (checkIgnore(ignore.class, className)) {\n return false\n }\n const matches = parent.getElementsByClassName(className)\n if (matches.length === 1) {\n path.unshift(`.${className.trim().replace(/\\s+/g, '.')}`)\n return true\n }\n return false\n}\n\n/**\n * Lookup attribute identifier\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {Object} ignore - [description]\n * @param {HTMLElement} parent - [description]\n * @return {boolean} - [description]\n */\nfunction checkAttribute (element, path, ignore, parent) {\n const attributes = element.attributes\n return Object.keys(attributes).some((key) => {\n const attribute = attributes[key]\n const attributeName = attribute.name\n const attributeValue = attribute.value\n if (checkIgnore(ignore.attribute, attributeName, attributeValue, defaultIgnore.attribute)) {\n return false\n }\n const pattern = `[${attributeName}=\"${attributeValue}\"]`\n const matches = parent.querySelectorAll(pattern)\n if (matches.length === 1) {\n path.unshift(pattern)\n return true\n }\n })\n}\n\n/**\n * Lookup tag identifier\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {HTMLElement} parent - [description]\n * @param {Object} ignore - [description]\n * @return {boolean} - [description]\n */\nfunction checkTag (element, path, ignore, parent) {\n const tagName = element.tagName.toLowerCase()\n if (checkIgnore(ignore.tag, tagName)) {\n return false\n }\n const matches = parent.getElementsByTagName(tagName)\n if (matches.length === 1) {\n path.unshift(tagName)\n return true\n }\n return false\n}\n\n/**\n * Lookup child identfier\n *\n * Note: childTags is a custom property to use a view filter for tags on for virutal elements\n *\n * @param {HTMLElement} element - [description]\n * @param {Array.} path - [description]\n * @param {String} selector - [description]\n * @return {boolean} - [description]\n */\nfunction checkChild (element, path, selector) {\n const parent = element.parentNode\n const children = parent.childTags || parent.children\n for (var i = 0, l = children.length; i < l; i++) {\n if (children[i] === element) {\n path.unshift(`> ${selector}:nth-child(${i+1})`)\n return true\n }\n }\n return false\n}\n\n/**\n * Validate with custom and default functions\n *\n * @param {Function} predicate - [description]\n * @param {string} name - [description]\n * @param {string} value - [description]\n * @param {Function} defaultPredicate - [description]\n * @return {boolean} - [description]\n */\nfunction checkIgnore (predicate, name, value, defaultPredicate) {\n if (!name) {\n return true\n }\n const check = predicate || defaultPredicate\n if (!check) {\n return false\n }\n return check(name, value || name, defaultPredicate)\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/match.js\n **/","/**\n * # Select\n *\n * Construct a unique CSS queryselector to access the selected DOM element(s).\n * Applies different matching and optimization strategies for efficiency.\n */\n\nimport adapt from './adapt'\nimport match from './match'\nimport optimize from './optimize'\nimport { convertNodeList } from './utilities'\nimport { getCommonAncestor, getCommonProperties } from './common'\n\n/**\n * Choose action depending on the input (single/multi)\n *\n * @param {HTMLElement|Array.} input - [description]\n * @param {Object} options - [description]\n * @return {string} - [description]\n */\nexport default function getQuerySelector (input, options = {}) {\n if (!input.length) {\n return getSingleSelector(input, options)\n }\n return getMultiSelector(input, options)\n}\n\n/**\n * Get a selector for the provided element\n *\n * @param {HTMLElement} element - [description]\n * @param {Object} options - [description]\n * @return {string} - [description]\n */\nexport function getSingleSelector (element, options = {}) {\n\n if (element.nodeType === 3) {\n element = element.parentNode\n }\n if (element.nodeType !== 1) {\n throw new Error(`Invalid input - only HTMLElements or representations of them are supported! (not \"${typeof element}\")`)\n }\n\n const globalModified = adapt(element, options)\n\n const selector = match(element, options)\n const optimized = optimize(selector, element, options)\n\n // debug\n // console.log(`\n // selector: ${selector}\n // optimized: ${optimized}\n // `)\n\n if (globalModified) {\n delete global.document\n }\n\n return optimized\n}\n\n/**\n * Get a selector to match multiple descendants from an ancestor\n *\n * @param {Array.} elements - [description]\n * @param {Object} options - [description]\n * @return {string} - [description]\n */\nexport function getMultiSelector (elements, options = {}) {\n\n if (!Array.isArray(elements)) {\n elements = convertNodeList(elements)\n }\n\n if (elements.some((element) => element.nodeType !== 1)) {\n throw new Error(`Invalid input - only an Array of HTMLElements or representations of them is supported!`)\n }\n\n const globalModified = adapt(elements[0], options)\n\n const ancestor = getCommonAncestor(elements, options)\n const ancestorSelector = getSingleSelector(ancestor, options)\n\n // TODO: consider usage of multiple selectors + parent-child relation + check for part redundancy\n const commonSelectors = getCommonSelectors(elements)\n const descendantSelector = commonSelectors[0]\n\n const selector = optimize(`${ancestorSelector} ${descendantSelector}`, elements, options)\n const selectorMatches = convertNodeList(document.querySelectorAll(selector))\n\n if (!elements.every((element) => selectorMatches.some((entry) => entry === element) )) {\n // TODO: cluster matches to split into similar groups for sub selections\n return console.warn(`\n The selected elements can\\'t be efficiently mapped.\n Its probably best to use multiple single selectors instead!\n `, elements)\n }\n\n if (globalModified) {\n delete global.document\n }\n\n return selector\n}\n\n/**\n * Get selectors to describe a set of elements\n *\n * @param {Array.} elements - [description]\n * @return {string} - [description]\n */\nfunction getCommonSelectors (elements) {\n\n const { classes, attributes, tag } = getCommonProperties(elements)\n\n const selectorPath = []\n\n if (tag) {\n selectorPath.push(tag)\n }\n\n if (classes) {\n const classSelector = classes.map((name) => `.${name}`).join('')\n selectorPath.push(classSelector)\n }\n\n if (attributes) {\n const attributeSelector = Object.keys(attributes).reduce((parts, name) => {\n parts.push(`[${name}=\"${attributes[name]}\"]`)\n return parts\n }, []).join('')\n selectorPath.push(attributeSelector)\n }\n\n if (selectorPath.length) {\n // TODO: check for parent-child relation\n }\n\n return [\n selectorPath.join('')\n ]\n}\n\n\n\n/** WEBPACK FOOTER **\n ** ./src/select.js\n **/"],"sourceRoot":""}