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ACU,KAAK,cACL,EAAsB,EAEhC,MAEQ,KAAK,aAEb,CAGA,CA1FA,CA2FC,CAlGD","file":"/npm/focus-options-polyfill@1.6.0/index.js/+esm","sourceRoot":"","sourcesContent":["/**\n * Bundled by jsDelivr using Rollup v2.79.2 and Terser v5.39.0.\n * Original file: /npm/focus-options-polyfill@1.6.0/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","// focus - focusOptions - preventScroll polyfill\n(function() {\n  if (\n    typeof window === \"undefined\" ||\n    typeof document === \"undefined\" ||\n    typeof HTMLElement === \"undefined\"\n  ) {\n    return;\n  }\n\n  var supportsPreventScrollOption = false;\n  try {\n    var focusElem = document.createElement(\"div\");\n    focusElem.addEventListener(\n      \"focus\",\n      function(event) {\n        event.preventDefault();\n        event.stopPropagation();\n      },\n      true\n    );\n    focusElem.focus(\n      Object.defineProperty({}, \"preventScroll\", {\n        get: function() {\n          // Edge v18 gives a false positive for supporting inputs\n          if (\n            navigator &&\n            typeof navigator.userAgent !== 'undefined' &&\n            navigator.userAgent &&\n            navigator.userAgent.match(/Edge\\/1[7-8]/)) {\n              return supportsPreventScrollOption = false\n          }\n\n          supportsPreventScrollOption = true;\n        }\n      })\n    );\n  } catch (e) {}\n\n  if (\n    HTMLElement.prototype.nativeFocus === undefined &&\n    !supportsPreventScrollOption\n  ) {\n    HTMLElement.prototype.nativeFocus = HTMLElement.prototype.focus;\n\n    var calcScrollableElements = function(element) {\n      var parent = element.parentNode;\n      var scrollableElements = [];\n      var rootScrollingElement =\n        document.scrollingElement || document.documentElement;\n\n      while (parent && parent !== rootScrollingElement) {\n        if (\n          parent.offsetHeight < parent.scrollHeight ||\n          parent.offsetWidth < parent.scrollWidth\n        ) {\n          scrollableElements.push([\n            parent,\n            parent.scrollTop,\n            parent.scrollLeft\n          ]);\n        }\n        parent = parent.parentNode;\n      }\n      parent = rootScrollingElement;\n      scrollableElements.push([parent, parent.scrollTop, parent.scrollLeft]);\n\n      return scrollableElements;\n    };\n\n    var restoreScrollPosition = function(scrollableElements) {\n      for (var i = 0; i < scrollableElements.length; i++) {\n        scrollableElements[i][0].scrollTop = scrollableElements[i][1];\n        scrollableElements[i][0].scrollLeft = scrollableElements[i][2];\n      }\n      scrollableElements = [];\n    };\n\n    var patchedFocus = function(args) {\n      if (args && args.preventScroll) {\n        var evScrollableElements = calcScrollableElements(this);\n        if (typeof setTimeout === 'function') {\n          var thisElem = this;\n          setTimeout(function () {\n            thisElem.nativeFocus();\n            restoreScrollPosition(evScrollableElements);\n          }, 0);\n        } else {\n          this.nativeFocus();\n          restoreScrollPosition(evScrollableElements);\n        }\n      }\n      else {\n        this.nativeFocus();\n      }\n    };\n\n    HTMLElement.prototype.focus = patchedFocus;\n  }\n})();\n"]}