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CAAC,sBAAsB,GAAG,GAAG,WAAW,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB;QAC5I,OACE,OAAO,WAAW,IAAI;QAGxB,OAAO,IAAI,CAAA,GAAA,oCAAS,EAAE,iBAAiB,OAAO,GAAG,GAAG,MAAM,OAAO,YAAY,EAAE;IACjF;AACF;AAEA,SAAS,8BAAW,UAA+B,EAAE,SAAqC;IACxF,MAAM,SAAoB,EAAE;IAC5B,KAAK,MAAM,QAAQ,WACjB,IAAI,UAAU,OACZ,OAAO,IAAI,CAAC;IAGhB,OAAO;AACT","sources":["packages/react-stately/src/layout/ListLayout.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 {Collection, DropTarget, DropTargetDelegate, ItemDropTarget, Key, Node, Orientation} from '@react-types/shared';\nimport {getChildNodes} from '../collections/getChildNodes';\nimport {InvalidationContext} from '../virtualizer/types';\nimport {Layout} from '../virtualizer/Layout';\nimport {LayoutInfo} from '../virtualizer/LayoutInfo';\nimport {Rect} from '../virtualizer/Rect';\nimport {Size} from '../virtualizer/Size';\n\nexport interface ListLayoutOptions {\n  /**\n   * The primary orientation of the items. Usually this is the direction that the collection scrolls.\n   * @default 'vertical'\n   */\n  orientation?: Orientation,\n  /**\n   * The fixed size of a row in px with respect to the applied orientation.\n   * @default 48\n   */\n  rowSize?: number,\n  /** The estimated size of a row in px with respect to the applied orientation, when row sizes are variable. */\n  estimatedRowSize?: number,\n  /**\n   * The fixed size of a section header in px with respect to the applied orientation.\n   * @default 48\n   */\n  headingSize?: number,\n  /** The estimated size of a section header in px with respect to the applied orientation, when heading sizes are variable. */\n  estimatedHeadingSize?: number,\n  /**\n   * The fixed size of a loader element in px with respect to the applied orientation. This loader is specifically for\n   * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n   * @default 48\n   */\n  loaderSize?: number,\n  /**\n   * The thickness of the drop indicator.\n   * @default 2\n   */\n  dropIndicatorThickness?: number,\n  /**\n   * The gap between items.\n   * @default 0\n   */\n  gap?: number,\n  /**\n   * The padding around the list.\n   * @default 0\n   */\n  padding?: number,\n  /**\n   * The fixed height of a row in px.\n   * @default 48\n   * @deprecated Use `rowSize` instead.\n   */\n  rowHeight?: number,\n  /** The estimated height of a row, when row heights are variable.\n   * @deprecated Use `estimatedRowSize` instead.\n   */\n  estimatedRowHeight?: number,\n  /**\n   * The fixed height of a section header in px.\n   * @default 48\n   * @deprecated Use `headingSize` instead.\n   */\n  headingHeight?: number,\n  /** The estimated height of a section header, when the height is variable.\n   * @deprecated Use `estimatedHeadingSize` instead.\n   */\n  estimatedHeadingHeight?: number,\n  /**\n   * The fixed height of a loader element in px. This loader is specifically for\n   * \"load more\" elements rendered when loading more rows at the root level or inside nested row/sections.\n   * @default 48\n   * @deprecated Use `loaderSize` instead.\n   */\n  loaderHeight?: number\n}\n\n// A wrapper around LayoutInfo that supports hierarchy\nexport interface LayoutNode {\n  node?: Node<unknown>,\n  layoutInfo: LayoutInfo,\n  children?: LayoutNode[],\n  validRect: Rect,\n  index?: number\n}\n\nconst DEFAULT_HEIGHT = 48;\n\n/**\n * ListLayout is a virtualizer Layout implementation\n * that arranges its items in a stack along its applied orientation.\n * It supports both fixed and variable size items.\n */\nexport class ListLayout<T, O extends ListLayoutOptions = ListLayoutOptions> extends Layout<Node<T>, O> implements DropTargetDelegate {\n  protected rowSize: number | null;\n  protected orientation: Orientation;\n  protected estimatedRowSize: number | null;\n  protected headingSize: number | null;\n  protected estimatedHeadingSize: number | null;\n  protected loaderSize: number | null;\n  protected dropIndicatorThickness: number;\n  protected gap: number;\n  protected padding: number;\n  protected layoutNodes: Map<Key, LayoutNode>;\n  protected contentSize: Size;\n  protected lastCollection: Collection<Node<T>> | null;\n  protected rootNodes: LayoutNode[];\n  private invalidateEverything: boolean;\n  /** The rectangle containing currently valid layout infos. */\n  protected validRect: Rect;\n  /** The rectangle of requested layout infos so far. */\n  protected requestedRect: Rect;\n\n  /**\n   * Creates a new ListLayout with options. See the list of properties below for a description\n   * of the options that can be provided.\n   */\n  constructor(options: ListLayoutOptions = {}) {\n    super();\n    this.rowSize = options?.rowSize ?? options?.rowHeight ?? null;\n    this.orientation = options.orientation ?? 'vertical';\n    this.estimatedRowSize = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? null;\n    this.headingSize = options?.headingSize ?? options?.headingHeight ?? null;\n    this.estimatedHeadingSize = options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? null;\n    this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? null;\n    this.dropIndicatorThickness = options.dropIndicatorThickness || 2;\n    this.gap = options.gap || 0;\n    this.padding = options.padding || 0;\n    this.layoutNodes = new Map();\n    this.rootNodes = [];\n    this.lastCollection = null;\n    this.invalidateEverything = false;\n    this.validRect = new Rect();\n    this.requestedRect = new Rect();\n    this.contentSize = new Size();\n  }\n\n  // Backward compatibility for subclassing.\n  protected get collection(): Collection<Node<T>> {\n    return this.virtualizer!.collection;\n  }\n\n  /** @deprecated Use `rowSize` instead. */\n  protected get rowHeight(): number | null {\n    return this.rowSize;\n  }\n\n  /** @deprecated Use `estimatedRowSize` instead. */\n  protected get estimatedRowHeight(): number | null {\n    return this.estimatedRowSize;\n  }\n\n  /** @deprecated Use `headingSize` instead. */\n  protected get headingHeight(): number | null {\n    return this.headingSize;\n\n  }\n  /** @deprecated Use `estimatedHeadingSize` instead. */\n  protected get estimatedHeadingHeight(): number | null {\n    return this.estimatedHeadingSize;\n  }\n\n  /** @deprecated Use `loaderSize` instead. */\n  protected get loaderHeight(): number | null {\n    return this.loaderSize;\n  }\n\n  getLayoutInfo(key: Key): LayoutInfo | null {\n    this.ensureLayoutInfo(key);\n    return this.layoutNodes.get(key)?.layoutInfo || null;\n  }\n\n  getVisibleLayoutInfos(rect: Rect): LayoutInfo[] {\n    let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n    let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n    // Adjust rect to keep number of visible rows consistent.\n    // (only if height > 1 or width > 1 for getDropTargetFromPoint)\n    if (rect[heightProperty] > 1) {\n      let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n      // Clone only before mutating\n      rect = rect.copy();\n      let offset = Math.floor(rect[offsetProperty] / rowHeight) * rowHeight;\n      let height = rect[heightProperty] + rect[offsetProperty] - offset;\n      rect[offsetProperty] = offset;\n      rect[heightProperty] = Math.ceil(height / rowHeight) * rowHeight;\n    }\n\n    // If layout hasn't yet been done for the requested rect, union the\n    // new rect with the existing valid rect, and recompute.\n    this.layoutIfNeeded(rect);\n\n    let res: LayoutInfo[] = [];\n\n    let addNodes = (nodes: LayoutNode[]) => {\n      for (let node of nodes) {\n        if (this.isVisible(node, rect)) {\n          res.push(node.layoutInfo);\n\n          if (node.children) {\n            addNodes(node.children);\n          }\n        }\n      }\n    };\n\n    addNodes(this.rootNodes);\n    return res;\n  }\n\n  protected layoutIfNeeded(rect: Rect): void {\n    if (!this.lastCollection) {\n      return;\n    }\n\n    if (!this.requestedRect.containsRect(rect)) {\n      this.requestedRect = this.requestedRect.union(rect);\n      this.rootNodes = this.buildCollection();\n    }\n\n    // Ensure all of the persisted keys are available.\n    for (let key of this.virtualizer!.persistedKeys) {\n      if (this.ensureLayoutInfo(key)) {\n        return;\n      }\n    }\n  }\n\n  private ensureLayoutInfo(key: Key) {\n    // If the layout info wasn't found, it might be outside the bounds of the area that we've\n    // computed layout for so far. This can happen when accessing a random key, e.g pressing Home/End.\n    // Compute the full layout and try again.\n    if (!this.layoutNodes.has(key) && this.requestedRect.area < this.contentSize.area && this.lastCollection) {\n      this.requestedRect = new Rect(0, 0, Infinity, Infinity);\n      this.rootNodes = this.buildCollection();\n      this.requestedRect = new Rect(0, 0, this.contentSize.width, this.contentSize.height);\n      return true;\n    }\n\n    return false;\n  }\n\n  protected isVisible(node: LayoutNode, rect: Rect): boolean {\n    return node.layoutInfo.rect.intersects(rect) || node.layoutInfo.isSticky || node.layoutInfo.type === 'header' || node.layoutInfo.type === 'loader' || this.virtualizer!.isPersistedKey(node.layoutInfo.key);\n  }\n\n  protected shouldInvalidateEverything(invalidationContext: InvalidationContext<O>): boolean {\n    // Invalidate cache if the size of the collection changed.\n    // In this case, we need to recalculate the entire layout.\n    // Also invalidate if fixed sizes/gaps change.\n    let options = invalidationContext.layoutOptions;\n    return invalidationContext.sizeChanged\n      || this.rowSize !== (options?.rowSize ?? options?.rowHeight ?? this.rowSize)\n      || this.orientation !== (options?.orientation ?? this.orientation)\n      || this.headingSize !== (options?.headingSize ?? options?.headingHeight ?? this.headingSize)\n      || this.loaderSize !== (options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize)\n      || this.gap !== (options?.gap ?? this.gap)\n      || this.padding !== (options?.padding ?? this.padding);\n  }\n\n  shouldInvalidateLayoutOptions(newOptions: O, oldOptions: O): boolean {\n    return (newOptions?.rowSize ?? newOptions?.rowHeight) !== (oldOptions?.rowSize ?? oldOptions?.rowHeight)\n      || newOptions.orientation !== oldOptions.orientation\n      || (newOptions?.estimatedRowSize ?? newOptions?.estimatedRowHeight) !== (oldOptions?.estimatedRowSize ?? oldOptions?.estimatedRowHeight)\n      || (newOptions?.headingSize ?? newOptions?.headingHeight) !== (oldOptions?.headingSize ?? oldOptions?.headingHeight)\n      || (newOptions?.estimatedHeadingSize ?? newOptions?.estimatedHeadingHeight) !== (oldOptions?.estimatedHeadingSize ?? oldOptions?.estimatedHeadingHeight)\n      || (newOptions?.loaderSize ?? newOptions?.loaderHeight) !== (oldOptions?.loaderSize ?? oldOptions?.loaderHeight)\n      || newOptions.dropIndicatorThickness !== oldOptions.dropIndicatorThickness\n      || newOptions.gap !== oldOptions.gap\n      || newOptions.padding !== oldOptions.padding;\n  }\n\n  update(invalidationContext: InvalidationContext<O>): void {\n    let collection = this.virtualizer!.collection;\n\n    // Reset valid rect if we will have to invalidate everything.\n    // Otherwise we can reuse cached layout infos outside the current visible rect.\n    this.invalidateEverything = this.shouldInvalidateEverything(invalidationContext);\n    if (this.invalidateEverything) {\n      this.requestedRect = this.virtualizer!.visibleRect.copy();\n      this.layoutNodes.clear();\n    }\n\n    let options = invalidationContext.layoutOptions;\n    this.rowSize = options?.rowSize ?? options?.rowHeight ?? this.rowSize;\n    this.orientation = options?.orientation ?? this.orientation;\n    this.estimatedRowSize = options?.estimatedRowSize ?? options?.estimatedRowHeight ?? this.estimatedRowSize;\n    this.headingSize = options?.headingSize ?? options?.headingHeight ?? this.headingSize;\n    this.estimatedHeadingSize = options?.estimatedHeadingSize ?? options?.estimatedHeadingHeight ?? this.estimatedHeadingSize;\n    this.loaderSize = options?.loaderSize ?? options?.loaderHeight ?? this.loaderSize;\n    this.dropIndicatorThickness = options?.dropIndicatorThickness ?? this.dropIndicatorThickness;\n    this.gap = options?.gap ?? this.gap;\n    this.padding = options?.padding ?? this.padding;\n\n    this.rootNodes = this.buildCollection();\n\n    // Remove deleted layout nodes\n    if (this.lastCollection && collection !== this.lastCollection) {\n      for (let key of this.lastCollection.getKeys()) {\n        if (!collection.getItem(key)) {\n          let layoutNode = this.layoutNodes.get(key);\n          if (layoutNode) {\n            this.layoutNodes.delete(key);\n          }\n        }\n      }\n    }\n\n    this.lastCollection = collection;\n    this.invalidateEverything = false;\n    this.validRect = this.requestedRect.copy();\n  }\n\n  protected buildCollection(offset: number = this.padding): LayoutNode[] {\n    let collection = this.virtualizer!.collection;\n    let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n    let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n\n    // filter out content nodes since we don't want them to affect the height\n    // Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n    let collectionNodes = toArray(collection, (node) => node.type !== 'content');\n    let loaderNodes = collectionNodes.filter(node => node.type === 'loader');\n    let nodes: LayoutNode[] = [];\n    let isEmptyOrLoading = collection?.size === 0;\n    if (isEmptyOrLoading) {\n      offset = 0;\n    }\n\n    for (let node of collectionNodes) {\n      let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n      // Skip rows before the valid rectangle unless they are already cached.\n      if (node.type === 'item' && offset + rowHeight < this.requestedRect[offsetProperty] && !this.isValid(node, offset)) {\n        offset += rowHeight;\n        continue;\n      }\n\n      let layoutNode = this.orientation === 'horizontal' ? this.buildChild(node, offset, this.padding, null) : this.buildChild(node, this.padding, offset, null);\n      offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n      nodes.push(layoutNode);\n      if (node.type === 'loader') {\n        let index = loaderNodes.indexOf(node);\n        loaderNodes.splice(index, 1);\n      }\n\n      // Build each loader that exists in the collection that is outside the visible rect so that they are persisted\n      // at the proper estimated location. If the node.type is \"section\" then we don't do this shortcut since we have to\n      // build the sections to see how tall they are.\n      if ((node.type === 'item' || node.type === 'loader') && offset > this.requestedRect[maxOffsetProperty]) {\n        let lastProcessedIndex = collectionNodes.indexOf(node);\n        for (let loaderNode of loaderNodes) {\n          let loaderNodeIndex = collectionNodes.indexOf(loaderNode);\n          // Subtract by an additional 1 since we've already added the current item's height to y\n          offset += (loaderNodeIndex - lastProcessedIndex - 1) * rowHeight;\n          let loader = this.orientation === 'horizontal' ? this.buildChild(loaderNode, offset, this.padding, null) : this.buildChild(loaderNode, this.padding, offset, null);\n          nodes.push(loader);\n          offset = loader.layoutInfo.rect[maxOffsetProperty];\n          lastProcessedIndex = loaderNodeIndex;\n        }\n\n        // Account for the rest of the items after the last loader spinner, subtract by 1 since we've processed the current node's height already\n        offset += (collectionNodes.length - lastProcessedIndex - 1) * rowHeight;\n        break;\n      }\n    }\n\n    offset = Math.max(offset - this.gap, 0);\n    offset += isEmptyOrLoading ? 0 : this.padding;\n    this.contentSize = this.orientation === 'horizontal' ? new Size(offset, this.virtualizer!.size.height) : new Size(this.virtualizer!.size.width, offset);\n    return nodes;\n  }\n\n  protected isValid(node: Node<T>, offset: number): boolean {\n    let cached = this.layoutNodes.get(node.key);\n    let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n    return (\n      !this.invalidateEverything &&\n      !!cached &&\n      cached.node === node &&\n      offset === cached.layoutInfo.rect[offsetProperty] &&\n      cached.layoutInfo.rect.intersects(this.validRect) &&\n      cached.validRect.containsRect(cached.layoutInfo.rect.intersection(this.requestedRect))\n    );\n  }\n\n  protected buildChild(node: Node<T>, x: number, y: number, parentKey: Key | null): LayoutNode {\n    if (this.isValid(node, this.orientation === 'horizontal' ? x : y)) {\n      return this.layoutNodes.get(node.key)!;\n    }\n\n    let layoutNode = this.buildNode(node, x, y);\n\n    layoutNode.layoutInfo.parentKey = parentKey ?? null;\n    layoutNode.layoutInfo.allowOverflow = true;\n    this.layoutNodes.set(node.key, layoutNode);\n    return layoutNode;\n  }\n\n  protected buildNode(node: Node<T>, x: number, y: number): LayoutNode {\n    switch (node.type) {\n      case 'section':\n        return this.buildSection(node, x, y);\n      case 'item':\n        return this.buildItem(node, x, y);\n      case 'header':\n        return this.buildSectionHeader(node, x, y);\n      case 'loader':\n        return this.buildLoader(node, x, y);\n      case 'separator':\n        return this.buildItem(node, x, y);\n      default:\n        throw new Error('Unsupported node type: ' + node.type);\n    }\n  }\n\n  protected buildLoader(node: Node<T>, x: number, y: number): LayoutNode {\n    let rect = new Rect(x, y, this.padding, 0);\n    let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n    // Note that if the user provides isLoading to their sentinel during a case where they only want to render the emptyState, this will reserve\n    // room for the loader alongside rendering the emptyState\n    if (this.orientation === 'horizontal') {\n      rect.height = this.virtualizer!.contentSize.height - this.padding - y;\n      rect.width = node.props.isLoading ? this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT : 0;\n    } else {\n      rect.width = this.virtualizer!.contentSize.width - this.padding - x;\n      rect.height = node.props.isLoading ? this.loaderSize ?? this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT : 0;\n    }\n\n    return {\n      layoutInfo,\n      validRect: rect.intersection(this.requestedRect)\n    };\n  }\n\n  protected buildSection(node: Node<T>, x: number, y: number): LayoutNode {\n    let collection = this.virtualizer!.collection;\n    let width = this.virtualizer!.size.width - this.padding - x;\n    let height = this.virtualizer!.size.height - this.padding - y;\n    let rect = this.orientation === 'horizontal' ? new Rect(x, y, 0, height) : new Rect(x, y, width, 0);\n    let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n\n    let offset = this.orientation === 'horizontal' ? x : y;\n    let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n    let maxOffsetProperty = this.orientation === 'horizontal' ? 'maxX' : 'maxY';\n    let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n    let skipped = 0;\n    let children: LayoutNode[] = [];\n    for (let child of getChildNodes(node, collection)) {\n      // skip if it is a content node, Tree specific for now, if we add content nodes to other collection items, we might need to reconsider this\n      if (child.type === 'content') {\n        continue;\n      }\n\n      let rowHeight = (this.rowSize ?? this.estimatedRowSize ?? DEFAULT_HEIGHT) + this.gap;\n\n      // Skip rows before the valid rectangle unless they are already cached.\n      if (offset + rowHeight < this.requestedRect[offsetProperty] && !this.isValid(node, offset)) {\n        offset += rowHeight;\n        skipped++;\n        continue;\n      }\n\n      let layoutNode = this.orientation === 'horizontal' ? this.buildChild(child, offset, y, layoutInfo.key) : this.buildChild(child, x, offset, layoutInfo.key);\n      offset = layoutNode.layoutInfo.rect[maxOffsetProperty] + this.gap;\n      children.push(layoutNode);\n\n      if (offset > this.requestedRect[maxOffsetProperty]) {\n        // Estimate the remaining height for rows that we don't need to layout right now.\n        offset += ([...getChildNodes(node, collection)].length - (children.length + skipped)) * rowHeight;\n        break;\n      }\n    }\n\n    offset -= this.gap;\n    rect[heightProperty] = offset - (this.orientation === 'horizontal' ? x : y);\n\n    return {\n      layoutInfo,\n      children,\n      validRect: layoutInfo.rect.intersection(this.requestedRect),\n      node\n    };\n  }\n\n  protected buildSectionHeader(node: Node<T>, x: number, y: number): LayoutNode {\n    let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n    let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n    let width = this.virtualizer!.size[widthProperty] - this.padding - (this.orientation === 'horizontal' ? y : x);\n    let rectHeight = this.headingSize;\n    let isEstimated = false;\n\n    // If no explicit height is available, use an estimated height.\n    if (rectHeight == null) {\n      // If a previous version of this layout info exists, reuse its height.\n      // Mark as estimated if the size of the overall virtualizer changed,\n      // or the content of the item changed.\n      let previousLayoutNode = this.layoutNodes.get(node.key);\n      let previousLayoutInfo = previousLayoutNode?.layoutInfo;\n      if (previousLayoutInfo) {\n        let curNode = this.virtualizer!.collection.getItem(node.key);\n        let lastNode = this.lastCollection ? this.lastCollection.getItem(node.key) : null;\n        rectHeight = previousLayoutNode!.layoutInfo.rect[heightProperty];\n        isEstimated = width !== previousLayoutInfo.rect[widthProperty] || curNode !== lastNode || previousLayoutInfo.estimatedSize;\n      } else {\n        rectHeight = (node.rendered ? this.estimatedHeadingSize : 0);\n        isEstimated = true;\n      }\n    }\n\n    if (rectHeight == null) {\n      rectHeight = DEFAULT_HEIGHT;\n    }\n\n    let headerRect = this.orientation === 'horizontal' ? new Rect(x, y, rectHeight, width - y)  : new Rect(x, y, width - x, rectHeight);\n    let header = new LayoutInfo('header', node.key, headerRect);\n    header.estimatedSize = isEstimated;\n    return {\n      layoutInfo: header,\n      children: [],\n      validRect: header.rect.intersection(this.requestedRect),\n      node\n    };\n  }\n\n  protected buildItem(node: Node<T>, x: number, y: number): LayoutNode {\n    let widthProperty = this.orientation === 'horizontal' ? 'height' : 'width';\n    let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n\n    let width = this.virtualizer!.size[widthProperty] - this.padding - (this.orientation === 'horizontal' ? y : x);\n    let rectHeight = this.rowSize;\n    let isEstimated = false;\n\n    // If no explicit height is available, use an estimated height.\n    if (rectHeight == null) {\n      // If a previous version of this layout info exists, reuse its height.\n      // Mark as estimated if the size of the overall virtualizer changed,\n      // or the content of the item changed.\n      let previousLayoutNode = this.layoutNodes.get(node.key);\n      if (previousLayoutNode) {\n        rectHeight = previousLayoutNode.layoutInfo.rect[heightProperty];\n        isEstimated = width !== previousLayoutNode.layoutInfo.rect[widthProperty] || node !== previousLayoutNode.node || previousLayoutNode.layoutInfo.estimatedSize;\n      } else {\n        rectHeight = this.estimatedRowSize;\n        isEstimated = true;\n      }\n    }\n\n    if (rectHeight == null) {\n      rectHeight = DEFAULT_HEIGHT;\n    }\n\n    let rect = this.orientation === 'horizontal' ? new Rect(x, y, rectHeight, width) : new Rect(x, y, width, rectHeight);\n    let layoutInfo = new LayoutInfo(node.type, node.key, rect);\n    layoutInfo.estimatedSize = isEstimated;\n    return {\n      layoutInfo,\n      children: [],\n      validRect: layoutInfo.rect.intersection(this.requestedRect),\n      node\n    };\n  }\n\n  updateItemSize(key: Key, size: Size): boolean {\n    let layoutNode = this.layoutNodes.get(key);\n    // If no layoutInfo, item has been deleted/removed.\n    if (!layoutNode) {\n      return false;\n    }\n\n    let collection = this.virtualizer!.collection;\n    let layoutInfo = layoutNode.layoutInfo;\n    let offsetProperty = this.orientation === 'horizontal' ? 'x' : 'y';\n    let heightProperty = this.orientation === 'horizontal' ? 'width' : 'height';\n    layoutInfo.estimatedSize = false;\n    if (layoutInfo.rect[heightProperty] !== size[heightProperty]) {\n      // Copy layout info rather than mutating so that later caches are invalidated.\n      let newLayoutInfo = layoutInfo.copy();\n      newLayoutInfo.rect[heightProperty] = size[heightProperty];\n      layoutNode.layoutInfo = newLayoutInfo;\n\n      // Items after this layoutInfo will need to be repositioned to account for the new height.\n      // Adjust the validRect so that only items above remain valid.\n      this.validRect[heightProperty] = Math.min(this.validRect[heightProperty], layoutInfo.rect[offsetProperty] - this.validRect[offsetProperty]);\n\n      // The requestedRect also needs to be adjusted to account for the height difference.\n      this.requestedRect[heightProperty] += newLayoutInfo.rect[heightProperty] - layoutInfo.rect[heightProperty];\n\n      // Invalidate layout for this layout node and all parents\n      this.updateLayoutNode(key, layoutInfo, newLayoutInfo);\n\n      let node = layoutInfo.parentKey != null ? collection.getItem(layoutInfo.parentKey) : null;\n      while (node) {\n        this.updateLayoutNode(node.key, layoutInfo, newLayoutInfo);\n        node = node.parentKey != null ? collection.getItem(node.parentKey) : null;\n      }\n\n      return true;\n    }\n\n    return false;\n  }\n\n  private updateLayoutNode(key: Key, oldLayoutInfo: LayoutInfo, newLayoutInfo: LayoutInfo) {\n    let n = this.layoutNodes.get(key);\n    if (n) {\n      // Invalidate by intersecting the validRect of this node with the overall validRect.\n      n.validRect = n.validRect.intersection(this.validRect);\n\n      // Replace layout info in LayoutNode\n      if (n.layoutInfo === oldLayoutInfo) {\n        n.layoutInfo = newLayoutInfo;\n      }\n    }\n  }\n\n  getContentSize(): Size {\n    return this.contentSize;\n  }\n\n  getDropTargetFromPoint(x: number, y: number, isValidDropTarget: (target: DropTarget) => boolean): DropTarget | null {\n    x += this.virtualizer!.visibleRect.x;\n    y += this.virtualizer!.visibleRect.y;\n\n    // Find the closest item within on either side of the point using the gap width.\n    let searchRect = new Rect(x, Math.max(0, y - this.gap), 1, Math.max(1, this.gap * 2));\n    let candidates = this.getVisibleLayoutInfos(searchRect);\n    let key: Key | null = null;\n    let minDistance = Infinity;\n    for (let candidate of candidates) {\n      // Ignore items outside the search rect, e.g. persisted keys.\n      if (!candidate.rect.intersects(searchRect)) {\n        continue;\n      }\n\n      let yDist = Math.abs(candidate.rect.y - y);\n      let maxYDist = Math.abs(candidate.rect.maxY - y);\n      let dist = Math.min(yDist, maxYDist);\n      if (dist < minDistance) {\n        minDistance = dist;\n        key = candidate.key;\n      }\n    }\n\n    if (key == null || this.virtualizer!.collection.size === 0) {\n      return {type: 'root'};\n    }\n\n    let layoutInfo = this.getLayoutInfo(key);\n    if (!layoutInfo) {\n      return null;\n    }\n\n    let rect = layoutInfo.rect;\n    let target: DropTarget = {\n      type: 'item',\n      key: layoutInfo.key,\n      dropPosition: 'on'\n    };\n\n    // If dropping on the item isn't accepted, try the target before or after depending on the y position.\n    // Otherwise, if dropping on the item is accepted, still try the before/after positions if within 10px\n    // of the top or bottom of the item.\n    if (!isValidDropTarget(target)) {\n      if (y <= rect.y + rect.height / 2 && isValidDropTarget({...target, dropPosition: 'before'})) {\n        target.dropPosition = 'before';\n      } else if (isValidDropTarget({...target, dropPosition: 'after'})) {\n        target.dropPosition = 'after';\n      }\n    } else if (y <= rect.y + 10 && isValidDropTarget({...target, dropPosition: 'before'})) {\n      target.dropPosition = 'before';\n    } else if (y >= rect.maxY - 10 && isValidDropTarget({...target, dropPosition: 'after'})) {\n      target.dropPosition = 'after';\n    }\n\n    return target;\n  }\n\n  getDropTargetLayoutInfo(target: ItemDropTarget): LayoutInfo {\n    let layoutInfo = this.getLayoutInfo(target.key)!;\n    let rect: Rect;\n    if (target.dropPosition === 'before') {\n      rect = this.orientation === 'horizontal' ?\n        new Rect(Math.max(0, layoutInfo.rect.x - this.dropIndicatorThickness / 2), layoutInfo.rect.y, this.dropIndicatorThickness, layoutInfo.rect.height)\n        : new Rect(layoutInfo.rect.x, Math.max(0, layoutInfo.rect.y - this.dropIndicatorThickness / 2), layoutInfo.rect.width, this.dropIndicatorThickness);\n    } else if (target.dropPosition === 'after') {\n      // Render after last visible descendant of the drop target.\n      let targetNode = this.collection.getItem(target.key);\n      if (targetNode) {\n        let targetLevel = targetNode.level ?? 0;\n        let currentKey = this.collection.getKeyAfter(target.key);\n\n        while (currentKey != null) {\n          let node = this.collection.getItem(currentKey);\n          if (!node || node.level <= targetLevel) {\n            break;\n          }\n\n          layoutInfo = this.getLayoutInfo(currentKey) || layoutInfo;\n          currentKey = this.collection.getKeyAfter(currentKey);\n        }\n      }\n      rect = this.orientation === 'horizontal' ?\n        new Rect(layoutInfo.rect.maxX - this.dropIndicatorThickness / 2, layoutInfo.rect.y, this.dropIndicatorThickness, layoutInfo.rect.height)\n        : new Rect(layoutInfo.rect.x, layoutInfo.rect.maxY - this.dropIndicatorThickness / 2, layoutInfo.rect.width, this.dropIndicatorThickness);\n    } else {\n      rect = layoutInfo.rect;\n    }\n\n    return new LayoutInfo('dropIndicator', target.key + ':' + target.dropPosition, rect);\n  }\n}\n\nfunction toArray<T>(collection: Collection<Node<T>>, predicate: (node: Node<T>) => boolean): Node<T>[] {\n  const result: Node<T>[] = [];\n  for (const node of collection) {\n    if (predicate(node)) {\n      result.push(node);\n    }\n  }\n  return result;\n}\n"],"names":[],"version":3,"file":"ListLayout.cjs.map"}