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AW,KAAK,CAAC,SAAS,CAAC,UAAU,WAAW,KAAK,CAAC,MAAM;4BAC5D;wBACF;gBACF;gBACA,WAAW,KAAK,CAAC,SAAS,GAAG;YAC/B;QACF;IACF,GAAG;QAAC;QAAY;QAAK;QAAQ;KAAU;IAEvC,IAAI,KAAK,CAAA,GAAA,+BAAI;IACb,CAAA,GAAA,gDAAqB,EAAE,GAAG,CAAC,OAAO;YAAC;aAAI;IAAG;IAC1C,OAAO;QACL,iBAAiB,CAAA,GAAA,oCAAS,EAAE,WAAW;gBACrC;YACA,oFAAoF;YACpF,6FAA6F;YAC7F,oBAAoB;QACtB;IACF;AACF","sources":["packages/react-aria/src/dnd/useDroppableCollection.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 {\n  clearGlobalDnDState,\n  DIRECTORY_DRAG_TYPE,\n  droppableCollectionMap,\n  getTypes,\n  globalDndState,\n  isInternalDropOperation,\n  setDropCollectionRef\n} from './utils';\nimport {\n  Collection,\n  DropEvent,\n  DropOperation,\n  DroppableCollectionDropEvent,\n  DroppableCollectionProps,\n  DropPosition,\n  DropTarget,\n  DropTargetDelegate,\n  Key,\n  KeyboardDelegate,\n  Node,\n  RefObject\n} from '@react-types/shared';\nimport * as DragManager from './DragManager';\nimport {DroppableCollectionState} from 'react-stately/useDroppableCollectionState';\nimport {HTMLAttributes, useCallback, useEffect, useRef} from 'react';\nimport {mergeProps} from '../utils/mergeProps';\nimport {navigate} from './DropTargetKeyboardNavigation';\nimport {setInteractionModality} from '../interactions/useFocusVisible';\nimport {useAutoScroll} from './useAutoScroll';\nimport {useDrop} from './useDrop';\nimport {useId} from '../utils/useId';\nimport {useLayoutEffect} from '../utils/useLayoutEffect';\nimport {useLocale} from '../i18n/I18nProvider';\n\nexport interface DroppableCollectionOptions extends DroppableCollectionProps {\n  /** A delegate object that implements behavior for keyboard focus movement. */\n  keyboardDelegate: KeyboardDelegate;\n  /** A delegate object that provides drop targets for pointer coordinates within the collection. */\n  dropTargetDelegate: DropTargetDelegate;\n  /** A custom keyboard event handler for drop targets. */\n  onKeyDown?: (e: KeyboardEvent) => void;\n}\n\nexport interface DroppableCollectionResult {\n  /** Props for the collection element. */\n  collectionProps: HTMLAttributes<HTMLElement>;\n}\n\ninterface DroppingState {\n  collection: Collection<Node<unknown>>;\n  focusedKey: Key | null;\n  selectedKeys: Set<Key>;\n  target: DropTarget;\n  draggingKeys: Set<Key | null | undefined>;\n  isInternal: boolean;\n  timeout: ReturnType<typeof setTimeout> | undefined;\n}\n\n/**\n * Handles drop interactions for a collection component, with support for traditional mouse and\n * touch based drag and drop, in addition to full parity for keyboard and screen reader users.\n */\nexport function useDroppableCollection(\n  props: DroppableCollectionOptions,\n  state: DroppableCollectionState,\n  ref: RefObject<HTMLElement | null>\n): DroppableCollectionResult {\n  let localState = useRef<{\n    props: DroppableCollectionOptions;\n    state: DroppableCollectionState;\n    nextTarget: DropTarget | null;\n    dropOperation: DropOperation | null;\n  }>({\n    props,\n    state,\n    nextTarget: null,\n    dropOperation: null\n  }).current;\n  localState.props = props;\n  localState.state = state;\n\n  let defaultOnDrop = useCallback(\n    async (e: DroppableCollectionDropEvent) => {\n      let {\n        onInsert,\n        onRootDrop,\n        onItemDrop,\n        onReorder,\n        onMove,\n        acceptedDragTypes = 'all',\n        shouldAcceptItemDrop\n      } = localState.props;\n\n      let {draggingKeys} = globalDndState;\n      let isInternal = isInternalDropOperation(ref);\n      let {target, dropOperation, items} = e;\n\n      let filteredItems = items;\n      if (acceptedDragTypes !== 'all' || shouldAcceptItemDrop) {\n        filteredItems = items.filter(item => {\n          let itemTypes: Set<string | symbol>;\n          if (item.kind === 'directory') {\n            itemTypes = new Set([DIRECTORY_DRAG_TYPE]);\n          } else {\n            itemTypes = item.kind === 'file' ? new Set([item.type]) : item.types;\n          }\n\n          if (acceptedDragTypes === 'all' || acceptedDragTypes.some(type => itemTypes.has(type))) {\n            // If we are performing a on item drop, check if the item in question accepts the dropped item since the item may have heavier restrictions\n            // than the droppable collection itself\n            if (target.type === 'item' && target.dropPosition === 'on' && shouldAcceptItemDrop) {\n              return shouldAcceptItemDrop(target, itemTypes);\n            }\n            return true;\n          }\n\n          return false;\n        });\n      }\n\n      if (filteredItems.length > 0) {\n        if (target.type === 'root' && onRootDrop) {\n          await onRootDrop({items: filteredItems, dropOperation});\n        }\n\n        if (target.type === 'item') {\n          if (target.dropPosition === 'on' && onItemDrop) {\n            await onItemDrop({items: filteredItems, dropOperation, isInternal, target});\n          }\n\n          if (onMove && isInternal) {\n            await onMove({keys: draggingKeys, dropOperation, target});\n          }\n\n          if (target.dropPosition !== 'on') {\n            if (!isInternal && onInsert) {\n              await onInsert({items: filteredItems, dropOperation, target});\n            }\n\n            if (isInternal && onReorder) {\n              await onReorder({keys: draggingKeys, dropOperation, target});\n            }\n          }\n        }\n      }\n    },\n    [localState, ref]\n  );\n\n  let autoScroll = useAutoScroll(ref);\n  let {dropProps} = useDrop({\n    ref,\n    onDropEnter() {\n      if (localState.nextTarget != null) {\n        state.setTarget(localState.nextTarget);\n      }\n    },\n    onDropMove(e) {\n      if (localState.nextTarget != null) {\n        state.setTarget(localState.nextTarget);\n      }\n      autoScroll.move(e.x, e.y);\n    },\n    getDropOperationForPoint(types, allowedOperations, x, y) {\n      let {draggingKeys, dropCollectionRef} = globalDndState;\n      let isInternal = isInternalDropOperation(ref);\n      let isValidDropTarget = target =>\n        state.getDropOperation({target, types, allowedOperations, isInternal, draggingKeys}) !==\n        'cancel';\n      let target = props.dropTargetDelegate.getDropTargetFromPoint(x, y, isValidDropTarget);\n      if (!target) {\n        localState.dropOperation = 'cancel';\n        localState.nextTarget = null;\n        return 'cancel';\n      }\n\n      localState.dropOperation = state.getDropOperation({\n        target,\n        types,\n        allowedOperations,\n        isInternal,\n        draggingKeys\n      });\n\n      // If the target doesn't accept the drop, see if the root accepts it instead.\n      if (localState.dropOperation === 'cancel') {\n        let rootTarget: DropTarget = {type: 'root'};\n        let dropOperation = state.getDropOperation({\n          target: rootTarget,\n          types,\n          allowedOperations,\n          isInternal,\n          draggingKeys\n        });\n        if (dropOperation !== 'cancel') {\n          target = rootTarget;\n          localState.dropOperation = dropOperation;\n        }\n      }\n\n      // Only set dropCollectionRef if there is a valid drop target since we cleanup dropCollectionRef in onDropExit\n      // which only runs when leaving a valid drop target or if the dropEffect become none (mouse dnd only).\n      if (\n        target &&\n        localState.dropOperation !== 'cancel' &&\n        ref?.current !== dropCollectionRef?.current\n      ) {\n        setDropCollectionRef(ref);\n      }\n      localState.nextTarget = localState.dropOperation === 'cancel' ? null : target;\n      return localState.dropOperation;\n    },\n    onDropExit() {\n      setDropCollectionRef(undefined);\n      state.setTarget(null);\n      autoScroll.stop();\n    },\n    onDropActivate(e) {\n      if (state.target?.type === 'item' && typeof props.onDropActivate === 'function') {\n        props.onDropActivate({\n          type: 'dropactivate',\n          x: e.x, // todo\n          y: e.y,\n          target: state.target\n        });\n      }\n    },\n    onDrop(e) {\n      setDropCollectionRef(ref);\n      if (state.target) {\n        onDrop(e, state.target);\n      }\n\n      // If there wasn't a collection being tracked as a dragged collection, then we are in a case where a non RSP drag is dropped on a\n      // RSP collection and thus we don't need to preserve the global DnD state for onDragEnd\n      let {draggingCollectionRef} = globalDndState;\n      if (draggingCollectionRef == null) {\n        clearGlobalDnDState();\n      }\n    }\n  });\n\n  let droppingState = useRef<DroppingState>(null);\n  let updateFocusAfterDrop = useCallback(() => {\n    let {state} = localState;\n    if (droppingState.current) {\n      let {\n        target,\n        collection: prevCollection,\n        selectedKeys: prevSelectedKeys,\n        focusedKey: prevFocusedKey,\n        isInternal,\n        draggingKeys\n      } = droppingState.current;\n\n      // If an insert occurs during a drop, we want to immediately select these items to give\n      // feedback to the user that a drop occurred. Only do this if the selection didn't change\n      // since the drop started so we don't override if the user or application did something.\n      if (\n        state.collection.size > prevCollection.size &&\n        state.selectionManager.isSelectionEqual(prevSelectedKeys)\n      ) {\n        let newKeys = new Set<Key>();\n        let key = state.collection.getFirstKey();\n        while (key != null) {\n          let item = state.collection.getItem(key);\n          if (item?.type === 'item' && !prevCollection.getItem(item.key)) {\n            newKeys.add(item.key);\n          }\n\n          if (\n            item?.hasChildNodes &&\n            state.collection.getItem(item.lastChildKey!)?.type === 'item'\n          ) {\n            key = item.firstChildKey!;\n          } else {\n            key = state.collection.getKeyAfter(key);\n          }\n        }\n\n        state.selectionManager.setSelectedKeys(newKeys);\n\n        // If the focused item didn't change since the drop occurred, also focus the first\n        // inserted item. If selection is disabled, then also show the focus ring so there\n        // is some indication that items were added.\n        if (state.selectionManager.focusedKey === prevFocusedKey) {\n          let first: Key | null | undefined = newKeys.keys().next().value;\n          if (first != null) {\n            let item = state.collection.getItem(first);\n            let dropTarget = droppingState.current.target;\n            let isParentRowExpanded = state.collection['expandedKeys']\n              ? state.collection['expandedKeys'].has(item?.parentKey)\n              : false;\n            // If this is a cell, focus the parent row.\n            // eslint-disable-next-line max-depth\n            if (\n              item &&\n              (item?.type === 'cell' ||\n                (dropTarget.type === 'item' &&\n                  dropTarget.dropPosition === 'on' &&\n                  !isParentRowExpanded))\n            ) {\n              first = item.parentKey;\n            }\n\n            // eslint-disable-next-line max-depth\n            if (first != null) {\n              state.selectionManager.setFocusedKey(first);\n            }\n\n            // eslint-disable-next-line max-depth\n            if (state.selectionManager.selectionMode === 'none') {\n              setInteractionModality('keyboard');\n            }\n          }\n        }\n      } else if (\n        prevFocusedKey != null &&\n        state.selectionManager.focusedKey === prevFocusedKey &&\n        isInternal &&\n        target.type === 'item' &&\n        target.dropPosition !== 'on' &&\n        draggingKeys.has(state.collection.getItem(prevFocusedKey)?.parentKey)\n      ) {\n        // Focus row instead of cell when reordering.\n        state.selectionManager.setFocusedKey(\n          state.collection.getItem(prevFocusedKey)?.parentKey ?? null\n        );\n        setInteractionModality('keyboard');\n      } else if (\n        state.selectionManager.focusedKey === prevFocusedKey &&\n        target.type === 'item' &&\n        target.dropPosition === 'on' &&\n        state.collection.getItem(target.key) != null\n      ) {\n        // If focus didn't move already (e.g. due to an insert), and the user dropped on an item,\n        // focus that item and show the focus ring to give the user feedback that the drop occurred.\n        // Also show the focus ring if the focused key is not selected, e.g. in case of a reorder.\n        state.selectionManager.setFocusedKey(target.key);\n        setInteractionModality('keyboard');\n      } else if (\n        state.selectionManager.focusedKey != null &&\n        !state.selectionManager.isSelected(state.selectionManager.focusedKey)\n      ) {\n        setInteractionModality('keyboard');\n      }\n\n      state.selectionManager.setFocused(true);\n    }\n  }, [localState]);\n\n  let onDrop = useCallback(\n    (e: DropEvent, target: DropTarget) => {\n      let {state} = localState;\n\n      // Save some state of the collection/selection before the drop occurs so we can compare later.\n      droppingState.current = {\n        timeout: undefined,\n        focusedKey: state.selectionManager.focusedKey,\n        collection: state.collection,\n        selectedKeys: state.selectionManager.selectedKeys,\n        draggingKeys: globalDndState.draggingKeys,\n        isInternal: isInternalDropOperation(ref),\n        target\n      };\n\n      let onDropFn = localState.props.onDrop || defaultOnDrop;\n      onDropFn({\n        type: 'drop',\n        x: e.x, // todo\n        y: e.y,\n        target,\n        items: e.items,\n        dropOperation: e.dropOperation\n      });\n\n      // Wait for a short time period after the onDrop is called to allow the data to be read asynchronously\n      // and for React to re-render. If the collection didn't already change during this time (handled below),\n      // update the focused key here.\n      droppingState.current.timeout = setTimeout(() => {\n        updateFocusAfterDrop();\n        droppingState.current = null;\n      }, 50);\n    },\n    [localState, defaultOnDrop, ref, updateFocusAfterDrop]\n  );\n\n  useEffect(() => {\n    return () => {\n      if (droppingState.current) {\n        clearTimeout(droppingState.current.timeout);\n      }\n    };\n  }, []);\n\n  useLayoutEffect(() => {\n    // If the collection changed after a drop, update the focused key.\n    if (droppingState.current && state.collection !== droppingState.current.collection) {\n      updateFocusAfterDrop();\n    }\n  });\n\n  let {direction} = useLocale();\n  useEffect(() => {\n    if (!ref.current) {\n      return;\n    }\n\n    let getNextTarget = (\n      target: DropTarget | null | undefined,\n      wrap = true,\n      key: 'left' | 'right' | 'up' | 'down' = 'down'\n    ) => {\n      return navigate(\n        localState.props.keyboardDelegate,\n        localState.state.collection,\n        target,\n        key,\n        direction === 'rtl',\n        wrap\n      );\n    };\n\n    let getPreviousTarget = (target: DropTarget | null | undefined, wrap = true) => {\n      return getNextTarget(target, wrap, 'up');\n    };\n\n    let nextValidTarget = (\n      target: DropTarget | null | undefined,\n      types: Set<string>,\n      allowedDropOperations: DropOperation[],\n      getNextTarget: (target: DropTarget | null | undefined, wrap: boolean) => DropTarget | null,\n      wrap = true\n    ): DropTarget | null => {\n      let seenRoot = 0;\n      let operation: DropOperation;\n      let {draggingKeys} = globalDndState;\n      let isInternal = isInternalDropOperation(ref);\n      do {\n        let nextTarget = getNextTarget(target, wrap);\n        if (!nextTarget) {\n          return null;\n        }\n        target = nextTarget;\n        operation = localState.state.getDropOperation({\n          target: nextTarget,\n          types,\n          allowedOperations: allowedDropOperations,\n          isInternal,\n          draggingKeys\n        });\n        if (target.type === 'root') {\n          seenRoot++;\n        }\n      } while (operation === 'cancel' && !localState.state.isDropTarget(target) && seenRoot < 2);\n\n      if (operation === 'cancel') {\n        return null;\n      }\n\n      return target;\n    };\n\n    return DragManager.registerDropTarget({\n      element: ref.current,\n      preventFocusOnDrop: true,\n      getDropOperation(types, allowedOperations) {\n        if (localState.state.target) {\n          let {draggingKeys} = globalDndState;\n          let isInternal = isInternalDropOperation(ref);\n          return localState.state.getDropOperation({\n            target: localState.state.target,\n            types,\n            allowedOperations,\n            isInternal,\n            draggingKeys\n          });\n        }\n\n        // Check if any of the targets accept the drop.\n        // TODO: should we have a faster way of doing this or e.g. for pagination?\n        let target = nextValidTarget(null, types, allowedOperations, getNextTarget);\n        return target ? 'move' : 'cancel';\n      },\n      onDropEnter(e, drag) {\n        let types = getTypes(drag.items);\n        let selectionManager = localState.state.selectionManager;\n        let target: DropTarget | null = null;\n        // Update the drop collection ref tracker for useDroppableItem's getDropOperation isInternal check\n        setDropCollectionRef(ref);\n\n        // When entering the droppable collection for the first time, the default drop target\n        // is after the focused key.\n        let key: Key | null | undefined = selectionManager.focusedKey;\n        let dropPosition: DropPosition = 'after';\n\n        // If the focused key is a cell, get the parent item instead.\n        // For now, we assume that individual cells cannot be dropped on.\n        let item = key != null ? localState.state.collection.getItem(key) : null;\n        if (item?.type === 'cell') {\n          key = item.parentKey;\n        }\n\n        // If the focused item is also selected, the default drop target is after the last selected item.\n        // But if the focused key is the first selected item, then default to before the first selected item.\n        // This is to make reordering lists slightly easier. If you select top down, we assume you want to\n        // move the items down. If you select bottom up, we assume you want to move the items up.\n        if (key != null && selectionManager.isSelected(key)) {\n          if (selectionManager.selectedKeys.size > 1 && selectionManager.firstSelectedKey === key) {\n            dropPosition = 'before';\n          } else {\n            key = selectionManager.lastSelectedKey;\n          }\n        }\n\n        if (key != null) {\n          target = {\n            type: 'item',\n            key,\n            dropPosition\n          };\n\n          let {draggingKeys} = globalDndState;\n          let isInternal = isInternalDropOperation(ref);\n          // If the default target is not valid, find the next one that is.\n          if (\n            localState.state.getDropOperation({\n              target,\n              types,\n              allowedOperations: drag.allowedDropOperations,\n              isInternal,\n              draggingKeys\n            }) === 'cancel'\n          ) {\n            target =\n              nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false) ??\n              nextValidTarget(target, types, drag.allowedDropOperations, getPreviousTarget, false);\n          }\n        }\n\n        // If no focused key, then start from the root.\n        if (!target) {\n          target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n        }\n\n        localState.state.setTarget(target);\n      },\n      onDropExit() {\n        setDropCollectionRef(undefined);\n        localState.state.setTarget(null);\n      },\n      onDropTargetEnter(target) {\n        localState.state.setTarget(target);\n      },\n      onDropActivate(e, target) {\n        if (\n          target?.type === 'item' &&\n          target?.dropPosition === 'on' &&\n          typeof localState.props.onDropActivate === 'function'\n        ) {\n          localState.props.onDropActivate({\n            type: 'dropactivate',\n            x: e.x, // todo\n            y: e.y,\n            target\n          });\n        }\n      },\n      onDrop(e, target) {\n        setDropCollectionRef(ref);\n        if (localState.state.target) {\n          onDrop(e, target || localState.state.target);\n        }\n      },\n      onKeyDown(e, drag) {\n        let {keyboardDelegate} = localState.props;\n        let types = getTypes(drag.items);\n        switch (e.key) {\n          case 'ArrowDown': {\n            if (keyboardDelegate.getKeyBelow) {\n              let target = nextValidTarget(\n                localState.state.target,\n                types,\n                drag.allowedDropOperations,\n                (target, wrap) => getNextTarget(target, wrap, 'down')\n              );\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'ArrowUp': {\n            if (keyboardDelegate.getKeyAbove) {\n              let target = nextValidTarget(\n                localState.state.target,\n                types,\n                drag.allowedDropOperations,\n                (target, wrap) => getNextTarget(target, wrap, 'up')\n              );\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'ArrowLeft': {\n            if (keyboardDelegate.getKeyLeftOf) {\n              let target = nextValidTarget(\n                localState.state.target,\n                types,\n                drag.allowedDropOperations,\n                (target, wrap) => getNextTarget(target, wrap, 'left')\n              );\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'ArrowRight': {\n            if (keyboardDelegate.getKeyRightOf) {\n              let target = nextValidTarget(\n                localState.state.target,\n                types,\n                drag.allowedDropOperations,\n                (target, wrap) => getNextTarget(target, wrap, 'right')\n              );\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'Home': {\n            if (keyboardDelegate.getFirstKey) {\n              let target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'End': {\n            if (keyboardDelegate.getLastKey) {\n              let target = nextValidTarget(\n                null,\n                types,\n                drag.allowedDropOperations,\n                getPreviousTarget\n              );\n              localState.state.setTarget(target);\n            }\n            break;\n          }\n          case 'PageDown': {\n            if (keyboardDelegate.getKeyPageBelow) {\n              let target = localState.state.target;\n              if (!target) {\n                target = nextValidTarget(null, types, drag.allowedDropOperations, getNextTarget);\n              } else {\n                // If on the root, go to the item a page below the top. Otherwise a page below the current item.\n                let targetKey = keyboardDelegate.getFirstKey?.();\n                if (target.type === 'item') {\n                  targetKey = target.key;\n                }\n                let nextKey: Key | null = null;\n                if (targetKey != null) {\n                  nextKey = keyboardDelegate.getKeyPageBelow(targetKey);\n                }\n                let dropPosition = target.type === 'item' ? target.dropPosition : 'after';\n\n                // If there is no next key, or we are starting on the last key, jump to the last possible position.\n                if (\n                  nextKey == null ||\n                  (target.type === 'item' && target.key === keyboardDelegate.getLastKey?.())\n                ) {\n                  nextKey = keyboardDelegate.getLastKey?.() ?? null;\n                  dropPosition = 'after';\n                }\n\n                if (nextKey == null) {\n                  break;\n                }\n                target = {\n                  type: 'item',\n                  key: nextKey,\n                  dropPosition\n                };\n\n                // If the target does not accept the drop, find the next valid target.\n                // If no next valid target, find the previous valid target.\n                let {draggingCollectionRef, draggingKeys} = globalDndState;\n                let isInternal = draggingCollectionRef?.current === ref?.current;\n                let operation = localState.state.getDropOperation({\n                  target,\n                  types,\n                  allowedOperations: drag.allowedDropOperations,\n                  isInternal,\n                  draggingKeys\n                });\n                if (operation === 'cancel') {\n                  target =\n                    nextValidTarget(\n                      target,\n                      types,\n                      drag.allowedDropOperations,\n                      getNextTarget,\n                      false\n                    ) ??\n                    nextValidTarget(\n                      target,\n                      types,\n                      drag.allowedDropOperations,\n                      getPreviousTarget,\n                      false\n                    );\n                }\n              }\n\n              localState.state.setTarget(target ?? localState.state.target);\n            }\n            break;\n          }\n          case 'PageUp': {\n            if (!keyboardDelegate.getKeyPageAbove) {\n              break;\n            }\n\n            let target = localState.state.target;\n            if (!target) {\n              target = nextValidTarget(null, types, drag.allowedDropOperations, getPreviousTarget);\n            } else if (target.type === 'item') {\n              // If at the top already, switch to the root. Otherwise navigate a page up.\n              if (target.key === keyboardDelegate.getFirstKey?.()) {\n                target = {\n                  type: 'root'\n                };\n              } else {\n                let nextKey: Key | null | undefined = keyboardDelegate.getKeyPageAbove(target.key);\n                let dropPosition = target.dropPosition;\n                if (nextKey == null) {\n                  nextKey = keyboardDelegate.getFirstKey?.();\n                  dropPosition = 'before';\n                }\n\n                if (nextKey == null) {\n                  break;\n                }\n                target = {\n                  type: 'item',\n                  key: nextKey,\n                  dropPosition\n                };\n              }\n\n              // If the target does not accept the drop, find the previous valid target.\n              // If no next valid target, find the next valid target.\n              let {draggingKeys} = globalDndState;\n              let isInternal = isInternalDropOperation(ref);\n              let operation = localState.state.getDropOperation({\n                target,\n                types,\n                allowedOperations: drag.allowedDropOperations,\n                isInternal,\n                draggingKeys\n              });\n              if (operation === 'cancel') {\n                target =\n                  nextValidTarget(\n                    target,\n                    types,\n                    drag.allowedDropOperations,\n                    getPreviousTarget,\n                    false\n                  ) ??\n                  nextValidTarget(target, types, drag.allowedDropOperations, getNextTarget, false);\n              }\n            }\n\n            localState.state.setTarget(target ?? localState.state.target);\n            break;\n          }\n        }\n        localState.props.onKeyDown?.(e);\n      }\n    });\n  }, [localState, ref, onDrop, direction]);\n\n  let id = useId();\n  droppableCollectionMap.set(state, {id, ref});\n  return {\n    collectionProps: mergeProps(dropProps, {\n      id,\n      // Remove description from collection element. If dropping on the entire collection,\n      // there should be a drop indicator that has this description, so no need to double announce.\n      'aria-describedby': null\n    })\n  };\n}\n"],"names":[],"version":3,"file":"useDroppableCollection.cjs.map"}