{"version":3,"file":"index.js","sources":["finder.js","index.js"],"sourcesContent":["import _parser from \"./parser\";\nvar exports = {};\n// Notable changes from Slick.Finder 1.0.x\n// faster bottom -> up expression matching\n// prefers mental sanity over *obsessive compulsive* milliseconds savings\n// uses prototypes instead of objects\n// tries to use matchesSelector smartly, whenever available\n// can populate objects as well as arrays\n// lots of stuff is broken or not implemented\nvar parse = _parser; // utilities\n\nvar index = 0,\n counter = document.__counter = (parseInt(document.__counter || -1, 36) + 1).toString(36),\n key = \"uid:\" + counter;\n\nvar uniqueID = function (n, xml) {\n if (n === window) return \"window\";\n if (n === document) return \"document\";\n if (n === document.documentElement) return \"html\";\n\n if (xml) {\n var uid = n.getAttribute(key);\n\n if (!uid) {\n uid = (index++).toString(36);\n n.setAttribute(key, uid);\n }\n\n return uid;\n } else {\n return n[key] || (n[key] = (index++).toString(36));\n }\n};\n\nvar uniqueIDXML = function (n) {\n return uniqueID(n, true);\n};\n\nvar isArray = Array.isArray || function (object) {\n return Object.prototype.toString.call(object) === \"[object Array]\";\n}; // tests\n\n\nvar uniqueIndex = 0;\nvar HAS = {\n GET_ELEMENT_BY_ID: function (test, id) {\n id = \"slick_\" + uniqueIndex++; // checks if the document has getElementById, and it works\n\n test.innerHTML = \"\";\n return !!this.getElementById(id);\n },\n QUERY_SELECTOR: function (test) {\n // this supposedly fixes a webkit bug with matchesSelector / querySelector & nth-child\n test.innerHTML = \"_\"; // checks if the document has querySelectorAll, and it works\n\n test.innerHTML = \"\";\n return test.querySelectorAll(\".MiX\").length === 1;\n },\n EXPANDOS: function (test, id) {\n id = \"slick_\" + uniqueIndex++; // checks if the document has elements that support expandos\n\n test._custom_property_ = id;\n return test._custom_property_ === id;\n },\n // TODO: use this ?\n // CHECKED_QUERY_SELECTOR: function(test){\n //\n // // checks if the document supports the checked query selector\n // test.innerHTML = ''\n // return test.querySelectorAll(':checked').length === 1\n // },\n // TODO: use this ?\n // EMPTY_ATTRIBUTE_QUERY_SELECTOR: function(test){\n //\n // // checks if the document supports the empty attribute query selector\n // test.innerHTML = ''\n // return test.querySelectorAll('[class*=\"\"]').length === 1\n // },\n MATCHES_SELECTOR: function (test) {\n test.className = \"MiX\"; // checks if the document has matchesSelector, and we can use it.\n\n var matches = test.matchesSelector || test.mozMatchesSelector || test.webkitMatchesSelector; // if matchesSelector trows errors on incorrect syntax we can use it\n\n if (matches) try {\n matches.call(test, \":slick\");\n } catch (e) {\n // just as a safety precaution, also test if it works on mixedcase (like querySelectorAll)\n return matches.call(test, \".MiX\") ? matches : false;\n }\n return false;\n },\n GET_ELEMENTS_BY_CLASS_NAME: function (test) {\n test.innerHTML = \"\";\n if (test.getElementsByClassName(\"b\").length !== 1) return false;\n test.firstChild.className = \"b\";\n if (test.getElementsByClassName(\"b\").length !== 2) return false; // Opera 9.6 getElementsByClassName doesnt detects the class if its not the first one\n\n test.innerHTML = \"\";\n if (test.getElementsByClassName(\"a\").length !== 2) return false; // tests passed\n\n return true;\n },\n // no need to know\n // GET_ELEMENT_BY_ID_NOT_NAME: function(test, id){\n // test.innerHTML = ''\n // return this.getElementById(id) !== test.firstChild\n // },\n // this is always checked for and fixed\n // STAR_GET_ELEMENTS_BY_TAG_NAME: function(test){\n //\n // // IE returns comment nodes for getElementsByTagName('*') for some documents\n // test.appendChild(this.createComment(''))\n // if (test.getElementsByTagName('*').length > 0) return false\n //\n // // IE returns closed nodes (EG:\"\") for getElementsByTagName('*') for some documents\n // test.innerHTML = 'foo'\n // if (test.getElementsByTagName('*').length) return false\n //\n // // tests passed\n // return true\n // },\n // this is always checked for and fixed\n // STAR_QUERY_SELECTOR: function(test){\n //\n // // returns closed nodes (EG:\"\") for querySelector('*') for some documents\n // test.innerHTML = 'foo'\n // return !!(test.querySelectorAll('*').length)\n // },\n GET_ATTRIBUTE: function (test) {\n // tests for working getAttribute implementation\n var shout = \"fus ro dah\";\n test.innerHTML = \"\";\n return test.firstChild.getAttribute(\"class\") === shout;\n }\n}; // Finder\n\nvar Finder = function Finder(document) {\n this.document = document;\n var root = this.root = document.documentElement;\n this.tested = {}; // uniqueID\n\n this.uniqueID = this.has(\"EXPANDOS\") ? uniqueID : uniqueIDXML; // getAttribute\n\n this.getAttribute = this.has(\"GET_ATTRIBUTE\") ? function (node, name) {\n return node.getAttribute(name);\n } : function (node, name) {\n node = node.getAttributeNode(name);\n return node && node.specified ? node.value : null;\n }; // hasAttribute\n\n this.hasAttribute = root.hasAttribute ? function (node, attribute) {\n return node.hasAttribute(attribute);\n } : function (node, attribute) {\n node = node.getAttributeNode(attribute);\n return !!(node && node.specified);\n }; // contains\n\n this.contains = document.contains && root.contains ? function (context, node) {\n return context.contains(node);\n } : root.compareDocumentPosition ? function (context, node) {\n return context === node || !!(context.compareDocumentPosition(node) & 16);\n } : function (context, node) {\n do {\n if (node === context) return true;\n } while (node = node.parentNode);\n\n return false;\n }; // sort\n // credits to Sizzle (http://sizzlejs.com/)\n\n this.sorter = root.compareDocumentPosition ? function (a, b) {\n if (!a.compareDocumentPosition || !b.compareDocumentPosition) return 0;\n return a.compareDocumentPosition(b) & 4 ? -1 : a === b ? 0 : 1;\n } : \"sourceIndex\" in root ? function (a, b) {\n if (!a.sourceIndex || !b.sourceIndex) return 0;\n return a.sourceIndex - b.sourceIndex;\n } : document.createRange ? function (a, b) {\n if (!a.ownerDocument || !b.ownerDocument) return 0;\n var aRange = a.ownerDocument.createRange(),\n bRange = b.ownerDocument.createRange();\n aRange.setStart(a, 0);\n aRange.setEnd(a, 0);\n bRange.setStart(b, 0);\n bRange.setEnd(b, 0);\n return aRange.compareBoundaryPoints(Range.START_TO_END, bRange);\n } : null;\n this.failed = {};\n var nativeMatches = this.has(\"MATCHES_SELECTOR\");\n if (nativeMatches) this.matchesSelector = function (node, expression) {\n if (this.failed[expression]) return null;\n\n try {\n return nativeMatches.call(node, expression);\n } catch (e) {\n if (slick.debug) console.warn(\"matchesSelector failed on \" + expression);\n this.failed[expression] = true;\n return null;\n }\n };\n\n if (this.has(\"QUERY_SELECTOR\")) {\n this.querySelectorAll = function (node, expression) {\n if (this.failed[expression]) return true;\n\n var result, _id, _expression, _combinator, _node; // non-document rooted QSA\n // credits to Andrew Dupont\n\n\n if (node !== this.document) {\n _combinator = expression[0].combinator;\n _id = node.getAttribute(\"id\");\n _expression = expression;\n\n if (!_id) {\n _node = node;\n _id = \"__slick__\";\n\n _node.setAttribute(\"id\", _id);\n }\n\n expression = \"#\" + _id + \" \" + _expression; // these combinators need a parentNode due to how querySelectorAll works, which is:\n // finding all the elements that match the given selector\n // then filtering by the ones that have the specified element as an ancestor\n\n if (_combinator.indexOf(\"~\") > -1 || _combinator.indexOf(\"+\") > -1) {\n node = node.parentNode;\n if (!node) result = true; // if node has no parentNode, we return \"true\" as if it failed, without polluting the failed cache\n }\n }\n\n if (!result) try {\n result = node.querySelectorAll(expression.toString());\n } catch (e) {\n if (slick.debug) console.warn(\"querySelectorAll failed on \" + (_expression || expression));\n result = this.failed[_expression || expression] = true;\n }\n if (_node) _node.removeAttribute(\"id\");\n return result;\n };\n }\n};\n\nFinder.prototype.has = function (FEATURE) {\n var tested = this.tested,\n testedFEATURE = tested[FEATURE];\n if (testedFEATURE != null) return testedFEATURE;\n var root = this.root,\n document = this.document,\n testNode = document.createElement(\"div\");\n testNode.setAttribute(\"style\", \"display: none;\");\n root.appendChild(testNode);\n var TEST = HAS[FEATURE],\n result = false;\n if (TEST) try {\n result = TEST.call(document, testNode);\n } catch (e) {}\n if (slick.debug && !result) console.warn(\"document has no \" + FEATURE);\n root.removeChild(testNode);\n return tested[FEATURE] = result;\n};\n\nvar combinators = {\n \" \": function (node, part, push) {\n var item, items;\n var noId = !part.id,\n noTag = !part.tag,\n noClass = !part.classes;\n\n if (part.id && node.getElementById && this.has(\"GET_ELEMENT_BY_ID\")) {\n item = node.getElementById(part.id); // return only if id is found, else keep checking\n // might be a tad slower on non-existing ids, but less insane\n\n if (item && item.getAttribute(\"id\") === part.id) {\n items = [item];\n noId = true; // if tag is star, no need to check it in match()\n\n if (part.tag === \"*\") noTag = true;\n }\n }\n\n if (!items) {\n if (part.classes && node.getElementsByClassName && this.has(\"GET_ELEMENTS_BY_CLASS_NAME\")) {\n items = node.getElementsByClassName(part.classList);\n noClass = true; // if tag is star, no need to check it in match()\n\n if (part.tag === \"*\") noTag = true;\n } else {\n items = node.getElementsByTagName(part.tag); // if tag is star, need to check it in match because it could select junk, boho\n\n if (part.tag !== \"*\") noTag = true;\n }\n\n if (!items || !items.length) return false;\n }\n\n for (var i = 0; item = items[i++];) if (noTag && noId && noClass && !part.attributes && !part.pseudos || this.match(item, part, noTag, noId, noClass)) push(item);\n\n return true;\n },\n \">\": function (node, part, push) {\n // direct children\n if (node = node.firstChild) do {\n if (node.nodeType == 1 && this.match(node, part)) push(node);\n } while (node = node.nextSibling);\n },\n \"+\": function (node, part, push) {\n // next sibling\n while (node = node.nextSibling) if (node.nodeType == 1) {\n if (this.match(node, part)) push(node);\n break;\n }\n },\n \"^\": function (node, part, push) {\n // first child\n node = node.firstChild;\n\n if (node) {\n if (node.nodeType === 1) {\n if (this.match(node, part)) push(node);\n } else {\n combinators[\"+\"].call(this, node, part, push);\n }\n }\n },\n \"~\": function (node, part, push) {\n // next siblings\n while (node = node.nextSibling) {\n if (node.nodeType === 1 && this.match(node, part)) push(node);\n }\n },\n \"++\": function (node, part, push) {\n // next sibling and previous sibling\n combinators[\"+\"].call(this, node, part, push);\n combinators[\"!+\"].call(this, node, part, push);\n },\n \"~~\": function (node, part, push) {\n // next siblings and previous siblings\n combinators[\"~\"].call(this, node, part, push);\n combinators[\"!~\"].call(this, node, part, push);\n },\n \"!\": function (node, part, push) {\n // all parent nodes up to document\n while (node = node.parentNode) if (node !== this.document && this.match(node, part)) push(node);\n },\n \"!>\": function (node, part, push) {\n // direct parent (one level)\n node = node.parentNode;\n if (node !== this.document && this.match(node, part)) push(node);\n },\n \"!+\": function (node, part, push) {\n // previous sibling\n while (node = node.previousSibling) if (node.nodeType == 1) {\n if (this.match(node, part)) push(node);\n break;\n }\n },\n \"!^\": function (node, part, push) {\n // last child\n node = node.lastChild;\n\n if (node) {\n if (node.nodeType == 1) {\n if (this.match(node, part)) push(node);\n } else {\n combinators[\"!+\"].call(this, node, part, push);\n }\n }\n },\n \"!~\": function (node, part, push) {\n // previous siblings\n while (node = node.previousSibling) {\n if (node.nodeType === 1 && this.match(node, part)) push(node);\n }\n }\n};\n\nFinder.prototype.search = function (context, expression, found) {\n if (!context) context = this.document;else if (!context.nodeType && context.document) context = context.document;\n var expressions = parse(expression); // no expressions were parsed. todo: is this really necessary?\n\n if (!expressions || !expressions.length) throw new Error(\"invalid expression\");\n if (!found) found = [];\n var uniques,\n push = isArray(found) ? function (node) {\n found[found.length] = node;\n } : function (node) {\n found[found.length++] = node;\n }; // if there is more than one expression we need to check for duplicates when we push to found\n // this simply saves the old push and wraps it around an uid dupe check.\n\n if (expressions.length > 1) {\n uniques = {};\n var plush = push;\n\n push = function (node) {\n var uid = uniqueID(node);\n\n if (!uniques[uid]) {\n uniques[uid] = true;\n plush(node);\n }\n };\n } // walker\n\n\n var node, nodes, part;\n\n main: for (var i = 0; expression = expressions[i++];) {\n // querySelector\n // TODO: more functional tests\n // if there is querySelectorAll (and the expression does not fail) use it.\n if (!slick.noQSA && this.querySelectorAll) {\n nodes = this.querySelectorAll(context, expression);\n\n if (nodes !== true) {\n if (nodes && nodes.length) for (var j = 0; node = nodes[j++];) if (node.nodeName > \"@\") {\n push(node);\n }\n continue main;\n }\n } // if there is only one part in the expression we don't need to check each part for duplicates.\n // todo: this might be too naive. while solid, there can be expression sequences that do not\n // produce duplicates. \"body div\" for instance, can never give you each div more than once.\n // \"body div a\" on the other hand might.\n\n\n if (expression.length === 1) {\n part = expression[0];\n combinators[part.combinator].call(this, context, part, push);\n } else {\n var cs = [context],\n c,\n f,\n u,\n p = function (node) {\n var uid = uniqueID(node);\n\n if (!u[uid]) {\n u[uid] = true;\n f[f.length] = node;\n }\n }; // loop the expression parts\n\n\n for (var j = 0; part = expression[j++];) {\n f = [];\n u = {}; // loop the contexts\n\n for (var k = 0; c = cs[k++];) combinators[part.combinator].call(this, c, part, p); // nothing was found, the expression failed, continue to the next expression.\n\n\n if (!f.length) continue main;\n cs = f; // set the contexts for future parts (if any)\n }\n\n if (i === 0) found = f; // first expression. directly set found.\n else for (var l = 0; l < f.length; l++) push(f[l]); // any other expression needs to push to found.\n }\n }\n\n if (uniques && found && found.length > 1) this.sort(found);\n return found;\n};\n\nFinder.prototype.sort = function (nodes) {\n return this.sorter ? Array.prototype.sort.call(nodes, this.sorter) : nodes;\n}; // TODO: most of these pseudo selectors include and qsa doesnt. fixme.\n\n\nvar pseudos = {\n // TODO: returns different results than qsa empty.\n \"empty\": function () {\n return !(this && this.nodeType === 1) && !(this.innerText || this.textContent || \"\").length;\n },\n \"not\": function (expression) {\n return !slick.matches(this, expression);\n },\n \"contains\": function (text) {\n return (this.innerText || this.textContent || \"\").indexOf(text) > -1;\n },\n \"first-child\": function () {\n var node = this;\n\n while (node = node.previousSibling) if (node.nodeType == 1) return false;\n\n return true;\n },\n \"last-child\": function () {\n var node = this;\n\n while (node = node.nextSibling) if (node.nodeType == 1) return false;\n\n return true;\n },\n \"only-child\": function () {\n var prev = this;\n\n while (prev = prev.previousSibling) if (prev.nodeType == 1) return false;\n\n var next = this;\n\n while (next = next.nextSibling) if (next.nodeType == 1) return false;\n\n return true;\n },\n \"first-of-type\": function () {\n var node = this,\n nodeName = node.nodeName;\n\n while (node = node.previousSibling) if (node.nodeName == nodeName) return false;\n\n return true;\n },\n \"last-of-type\": function () {\n var node = this,\n nodeName = node.nodeName;\n\n while (node = node.nextSibling) if (node.nodeName == nodeName) return false;\n\n return true;\n },\n \"only-of-type\": function () {\n var prev = this,\n nodeName = this.nodeName;\n\n while (prev = prev.previousSibling) if (prev.nodeName == nodeName) return false;\n\n var next = this;\n\n while (next = next.nextSibling) if (next.nodeName == nodeName) return false;\n\n return true;\n },\n \"enabled\": function () {\n return !this.disabled;\n },\n \"disabled\": function () {\n return this.disabled;\n },\n \"checked\": function () {\n return this.checked || this.selected;\n },\n \"selected\": function () {\n return this.selected;\n },\n \"focus\": function () {\n var doc = this.ownerDocument;\n return doc.activeElement === this && (this.href || this.type || slick.hasAttribute(this, \"tabindex\"));\n },\n \"root\": function () {\n return this === this.ownerDocument.documentElement;\n }\n};\n\nFinder.prototype.match = function (node, bit, noTag, noId, noClass) {\n // TODO: more functional tests ?\n if (!slick.noQSA && this.matchesSelector) {\n var matches = this.matchesSelector(node, bit);\n if (matches !== null) return matches;\n } // normal matching\n\n\n if (!noTag && bit.tag) {\n var nodeName = node.nodeName.toLowerCase();\n\n if (bit.tag === \"*\") {\n if (nodeName < \"@\") return false;\n } else if (nodeName != bit.tag) {\n return false;\n }\n }\n\n if (!noId && bit.id && node.getAttribute(\"id\") !== bit.id) return false;\n var i, part;\n\n if (!noClass && bit.classes) {\n var className = this.getAttribute(node, \"class\");\n if (!className) return false;\n\n for (part in bit.classes) if (!RegExp(\"(^|\\\\s)\" + bit.classes[part] + \"(\\\\s|$)\").test(className)) return false;\n }\n\n var name, value;\n if (bit.attributes) for (i = 0; part = bit.attributes[i++];) {\n var operator = part.operator,\n escaped = part.escapedValue;\n name = part.name;\n value = part.value;\n\n if (!operator) {\n if (!this.hasAttribute(node, name)) return false;\n } else {\n var actual = this.getAttribute(node, name);\n if (actual == null) return false;\n\n switch (operator) {\n case \"^=\":\n if (!RegExp(\"^\" + escaped).test(actual)) return false;\n break;\n\n case \"$=\":\n if (!RegExp(escaped + \"$\").test(actual)) return false;\n break;\n\n case \"~=\":\n if (!RegExp(\"(^|\\\\s)\" + escaped + \"(\\\\s|$)\").test(actual)) return false;\n break;\n\n case \"|=\":\n if (!RegExp(\"^\" + escaped + \"(-|$)\").test(actual)) return false;\n break;\n\n case \"=\":\n if (actual !== value) return false;\n break;\n\n case \"*=\":\n if (actual.indexOf(value) === -1) return false;\n break;\n\n default:\n return false;\n }\n }\n }\n if (bit.pseudos) for (i = 0; part = bit.pseudos[i++];) {\n name = part.name;\n value = part.value;\n if (pseudos[name]) return pseudos[name].call(node, value);\n\n if (value != null) {\n if (this.getAttribute(node, name) !== value) return false;\n } else {\n if (!this.hasAttribute(node, name)) return false;\n }\n }\n return true;\n};\n\nFinder.prototype.matches = function (node, expression) {\n var expressions = parse(expression);\n\n if (expressions.length === 1 && expressions[0].length === 1) {\n // simplest match\n return this.match(node, expressions[0][0]);\n } // TODO: more functional tests ?\n\n\n if (!slick.noQSA && this.matchesSelector) {\n var matches = this.matchesSelector(node, expressions);\n if (matches !== null) return matches;\n }\n\n var nodes = this.search(this.document, expression, {\n length: 0\n });\n\n for (var i = 0, res; res = nodes[i++];) if (node === res) return true;\n\n return false;\n};\n\nvar finders = {};\n\nvar finder = function (context) {\n var doc = context || document;\n if (doc.ownerDocument) doc = doc.ownerDocument;else if (doc.document) doc = doc.document;\n if (doc.nodeType !== 9) throw new TypeError(\"invalid document\");\n var uid = uniqueID(doc);\n return finders[uid] || (finders[uid] = new Finder(doc));\n}; // ... API ...\n\n\nvar slick = function (expression, context) {\n return slick.search(expression, context);\n};\n\nslick.search = function (expression, context, found) {\n return finder(context).search(context, expression, found);\n};\n\nslick.find = function (expression, context) {\n return finder(context).search(context, expression)[0] || null;\n};\n\nslick.getAttribute = function (node, name) {\n return finder(node).getAttribute(node, name);\n};\n\nslick.hasAttribute = function (node, name) {\n return finder(node).hasAttribute(node, name);\n};\n\nslick.contains = function (context, node) {\n return finder(context).contains(context, node);\n};\n\nslick.matches = function (node, expression) {\n return finder(node).matches(node, expression);\n};\n\nslick.sort = function (nodes) {\n if (nodes && nodes.length > 1) finder(nodes[0]).sort(nodes);\n return nodes;\n};\n\nslick.parse = parse; // slick.debug = true\n// slick.noQSA = true\n\nexports = slick;\nexport default exports;","import _finder from \"./finder\";\nimport _parser from \"./parser\";\n\nvar _global = typeof globalThis !== \"undefined\" ? globalThis : typeof self !== \"undefined\" ? self : global;\n\nvar exports = {};\nexports = \"document\" in _global ? _finder : {\n parse: _parser\n};\nexport default exports;"],"names":["exports","parse","_parser","index","counter","document","__counter","parseInt","toString","key","uniqueID","n","xml","window","documentElement","uid","getAttribute","setAttribute","uniqueIDXML","isArray","Array","object","Object","prototype","call","uniqueIndex","HAS","GET_ELEMENT_BY_ID","test","id","innerHTML","this","getElementById","QUERY_SELECTOR","querySelectorAll","length","EXPANDOS","_custom_property_","MATCHES_SELECTOR","className","matches","matchesSelector","mozMatchesSelector","webkitMatchesSelector","e","GET_ELEMENTS_BY_CLASS_NAME","getElementsByClassName","firstChild","GET_ATTRIBUTE","shout","Finder","root","tested","has","node","name","getAttributeNode","specified","value","hasAttribute","attribute","contains","context","compareDocumentPosition","parentNode","sorter","a","b","sourceIndex","createRange","ownerDocument","aRange","bRange","setStart","setEnd","compareBoundaryPoints","Range","START_TO_END","failed","nativeMatches","expression","slick","debug","console","warn","result","_id","_expression","_combinator","_node","combinator","indexOf","removeAttribute","FEATURE","testedFEATURE","testNode","createElement","appendChild","TEST","removeChild","combinators"," ","part","push","item","items","noId","noTag","tag","noClass","classes","classList","getElementsByTagName","i","attributes","pseudos","match",">","nodeType","nextSibling","+","^","~","++","~~","!","!>","!+","previousSibling","!^","lastChild","!~","search","found","expressions","Error","uniques","plush","nodes","main","noQSA","j","nodeName","cs","c","f","u","p","k","l","sort","empty","innerText","textContent","not","text","first-child","last-child","only-child","prev","next","first-of-type","last-of-type","only-of-type","enabled","disabled","checked","selected","focus","doc","activeElement","href","type","bit","toLowerCase","RegExp","operator","escaped","escapedValue","actual","res","finders","finder","TypeError","find","_global","globalThis","self","global","_finder"],"mappings":"2BACA,IAAIA,EAAU,GAQd,IAAIC,EAAQC,EAEZ,IAAIC,EAAQ,EACRC,EAAUC,SAASC,WAAaC,SAASF,SAASC,YAAc,EAAG,IAAM,GAAGE,SAAS,IACrFC,EAAM,OAASL,EAEnB,IAAIM,SAAW,SAAUC,EAAGC,GAC1B,GAAID,IAAME,OAAQ,MAAO,SACzB,GAAIF,IAAMN,SAAU,MAAO,WAC3B,G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