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sources":["packages/react-aria/src/virtualizer/utils.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {Direction} from '@react-types/shared';\n\nexport type RTLOffsetType =\n  | 'negative'\n  | 'positive-descending'\n  | 'positive-ascending';\n\nlet cachedRTLResult: RTLOffsetType | null = null;\n\n\n// Original licensing for the following methods can be found in the\n// NOTICE file in the root directory of this source tree.\n// See https://github.com/bvaughn/react-window/blob/master/src/createGridComponent.js\n\n// According to the spec, scrollLeft should be negative for RTL aligned elements.\n// Chrome does not seem to adhere; its scrollLeft values are positive (measured relative to the left).\n// Safari's elastic bounce makes detecting this even more complicated wrt potential false positives.\n// The safest way to check this is to intentionally set a negative offset,\n// and then verify that the subsequent \"scroll\" event matches the negative offset.\n// If it does not match, then we can assume a non-standard RTL scroll implementation.\nexport function getRTLOffsetType(recalculate: boolean = false): RTLOffsetType {\n  if (cachedRTLResult === null || recalculate) {\n    const outerDiv = document.createElement('div');\n    const outerStyle = outerDiv.style;\n    outerStyle.width = '50px';\n    outerStyle.height = '50px';\n    outerStyle.overflow = 'scroll';\n    outerStyle.direction = 'rtl';\n\n    const innerDiv = document.createElement('div');\n    const innerStyle = innerDiv.style;\n    innerStyle.width = '100px';\n    innerStyle.height = '100px';\n\n    outerDiv.appendChild(innerDiv);\n\n    document.body.appendChild(outerDiv);\n\n    if (outerDiv.scrollLeft > 0) {\n      cachedRTLResult = 'positive-descending';\n    } else {\n      outerDiv.scrollLeft = 1;\n      if (outerDiv.scrollLeft === 0) {\n        cachedRTLResult = 'negative';\n      } else {\n        cachedRTLResult = 'positive-ascending';\n      }\n    }\n\n    document.body.removeChild(outerDiv);\n\n    return cachedRTLResult;\n  }\n\n  return cachedRTLResult;\n}\n\nexport function getScrollLeft(node: Element, direction: Direction): number {\n  let {scrollLeft} = node;\n\n  // scrollLeft in rtl locales differs across browsers, so normalize.\n  // See comment by getRTLOffsetType below for details.\n  if (direction === 'rtl') {\n    let {scrollWidth, clientWidth} = node;\n    switch (getRTLOffsetType()) {\n      case 'negative':\n        scrollLeft = -scrollLeft;\n        break;\n      case 'positive-descending':\n        scrollLeft = scrollWidth - clientWidth - scrollLeft;\n        break;\n    }\n  }\n\n  return scrollLeft;\n}\n\nexport function setScrollLeft(node: Element, direction: Direction, scrollLeft: number): void {\n  if (direction === 'rtl') {\n    switch (getRTLOffsetType()) {\n      case 'negative':\n        scrollLeft = -scrollLeft;\n        break;\n      case 'positive-ascending':\n        break;\n      default: {\n        const {clientWidth, scrollWidth} = node;\n        scrollLeft = scrollWidth - clientWidth - scrollLeft;\n        break;\n      }\n    }\n  }\n\n  node.scrollLeft = scrollLeft;\n}\n"],"names":[],"version":3,"file":"utils.mjs.map"}