{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/toConsumableArray\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nimport $tyW6A$react, { useMemo as $tyW6A$useMemo, useRef as $tyW6A$useRef } from \"react\";\nimport $tyW6A$swchelperssrc_define_propertymjs from \"@swc/helpers/src/_define_property.mjs\";\nfunction $c1d7fb2ec91bae71$var$Item(props) {\n  return null;\n}\n$c1d7fb2ec91bae71$var$Item.getCollectionNode = function* getCollectionNode(props, context) {\n  var childItems = props.childItems,\n    title = props.title,\n    children = props.children;\n  var rendered = props.title || props.children;\n  var textValue = props.textValue || (typeof rendered === \"string\" ? rendered : \"\") || props[\"aria-label\"] || \"\";\n  if (!textValue && !(context === null || context === void 0 ? void 0 : context.suppressTextValueWarning)) console.warn(\"<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.\");\n  yield {\n    type: \"item\",\n    props: props,\n    rendered: rendered,\n    textValue: textValue,\n    \"aria-label\": props[\"aria-label\"],\n    hasChildNodes: $c1d7fb2ec91bae71$var$hasChildItems(props),\n    childNodes: function* childNodes() {\n      if (childItems) for (var child of childItems) yield {\n        type: \"item\",\n        value: child\n      };else if (title) {\n        var items = [];\n        (0, $tyW6A$react).Children.forEach(children, function (child) {\n          items.push({\n            type: \"item\",\n            element: child\n          });\n        });\n        yield* items;\n      }\n    }\n  };\n};\nfunction $c1d7fb2ec91bae71$var$hasChildItems(props) {\n  if (props.hasChildItems != null) return props.hasChildItems;\n  if (props.childItems) return true;\n  if (props.title && (0, $tyW6A$react).Children.count(props.children) > 0) return true;\n  return false;\n}\nvar $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 = $c1d7fb2ec91bae71$var$Item;\nfunction $9fc4852771d079eb$var$Section(props) {\n  return null;\n}\n$9fc4852771d079eb$var$Section.getCollectionNode = function* getCollectionNode(props) {\n  var children = props.children,\n    title = props.title,\n    items = props.items;\n  yield {\n    type: \"section\",\n    props: props,\n    hasChildNodes: true,\n    rendered: title,\n    \"aria-label\": props[\"aria-label\"],\n    childNodes: function* childNodes() {\n      if (typeof children === \"function\") {\n        if (!items) throw new Error(\"props.children was a function but props.items is missing\");\n        for (var item of items) yield {\n          type: \"item\",\n          value: item,\n          renderer: children\n        };\n      } else {\n        var items1 = [];\n        (0, $tyW6A$react).Children.forEach(children, function (child) {\n          items1.push({\n            type: \"item\",\n            element: child\n          });\n        });\n        yield* items1;\n      }\n    }\n  };\n};\nvar $9fc4852771d079eb$export$6e2c8f0811a474ce = $9fc4852771d079eb$var$Section;\nvar $eb2240fc39a57fa5$export$bf788dd355e3a401 = function () {\n  function $eb2240fc39a57fa5$export$bf788dd355e3a401() {\n    _classCallCheck(this, $eb2240fc39a57fa5$export$bf788dd355e3a401);\n    (0, $tyW6A$swchelperssrc_define_propertymjs)(this, \"cache\", new WeakMap());\n  }\n  _createClass($eb2240fc39a57fa5$export$bf788dd355e3a401, [{\n    key: \"build\",\n    value: function build(props, context) {\n      var _this = this;\n      this.context = context;\n      return $eb2240fc39a57fa5$var$iterable(function () {\n        return _this.iterateCollection(props);\n      });\n    }\n  }, {\n    key: \"iterateCollection\",\n    value: function* iterateCollection(props) {\n      var children = props.children,\n        items = props.items;\n      if (typeof children === \"function\") {\n        if (!items) throw new Error(\"props.children was a function but props.items is missing\");\n        for (var item of props.items) yield* this.getFullNode({\n          value: item\n        }, {\n          renderer: children\n        });\n      } else {\n        var items1 = [];\n        (0, $tyW6A$react).Children.forEach(children, function (child) {\n          items1.push(child);\n        });\n        var index = 0;\n        for (var item1 of items1) {\n          var nodes = this.getFullNode({\n            element: item1,\n            index: index\n          }, {});\n          for (var node of nodes) {\n            index++;\n            yield node;\n          }\n        }\n      }\n    }\n  }, {\n    key: \"getKey\",\n    value: function getKey(item, partialNode, state, parentKey) {\n      if (item.key != null) return item.key;\n      if (partialNode.type === \"cell\" && partialNode.key != null) return \"\" + parentKey + partialNode.key;\n      var v = partialNode.value;\n      if (v != null) {\n        var _v_key;\n        var key = (_v_key = v.key) !== null && _v_key !== void 0 ? _v_key : v.id;\n        if (key == null) throw new Error(\"No key found for item\");\n        return key;\n      }\n      return parentKey ? parentKey + \".\" + partialNode.index : \"$.\" + partialNode.index;\n    }\n  }, {\n    key: \"getChildState\",\n    value: function getChildState(state, partialNode) {\n      return {\n        renderer: partialNode.renderer || state.renderer\n      };\n    }\n  }, {\n    key: \"getFullNode\",\n    value: function* getFullNode(partialNode, state, parentKey, parentNode) {\n      var element = partialNode.element;\n      if (!element && partialNode.value && state && state.renderer) {\n        var cached = this.cache.get(partialNode.value);\n        if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {\n          cached.index = partialNode.index;\n          cached.parentKey = parentNode ? parentNode.key : null;\n          yield cached;\n          return;\n        }\n        element = state.renderer(partialNode.value);\n      }\n      if ((0, $tyW6A$react).isValidElement(element)) {\n        var type = element.type;\n        if (typeof type !== \"function\" && typeof type.getCollectionNode !== \"function\") {\n          var name = typeof element.type === \"function\" ? element.type.name : element.type;\n          throw new Error(\"Unknown element <\" + name + \"> in collection.\");\n        }\n        var childNodes = type.getCollectionNode(element.props, this.context);\n        var index = partialNode.index;\n        var result = childNodes.next();\n        while (!result.done && result.value) {\n          var childNode = result.value;\n          partialNode.index = index;\n          var nodeKey = childNode.key;\n          if (!nodeKey) nodeKey = childNode.element ? null : this.getKey(element, partialNode, state, parentKey);\n          var nodes = this.getFullNode(_objectSpread(_objectSpread({}, childNode), {}, {\n            key: nodeKey,\n            index: index,\n            wrapper: $eb2240fc39a57fa5$var$compose(partialNode.wrapper, childNode.wrapper)\n          }), this.getChildState(state, childNode), parentKey ? \"\" + parentKey + element.key : element.key, parentNode);\n          var children = _toConsumableArray(nodes);\n          for (var node of children) {\n            node.value = childNode.value || partialNode.value;\n            if (node.value) this.cache.set(node.value, node);\n            if (partialNode.type && node.type !== partialNode.type) throw new Error(\"Unsupported type <\" + $eb2240fc39a57fa5$var$capitalize(node.type) + \"> in <\" + $eb2240fc39a57fa5$var$capitalize(parentNode.type) + \">. Only <\" + $eb2240fc39a57fa5$var$capitalize(partialNode.type) + \"> is supported.\");\n            index++;\n            yield node;\n          }\n          result = childNodes.next(children);\n        }\n        return;\n      }\n      if (partialNode.key == null) return;\n      var builder = this;\n      var node1 = {\n        type: partialNode.type,\n        props: partialNode.props,\n        key: partialNode.key,\n        parentKey: parentNode ? parentNode.key : null,\n        value: partialNode.value,\n        level: parentNode ? parentNode.level + 1 : 0,\n        index: partialNode.index,\n        rendered: partialNode.rendered,\n        textValue: partialNode.textValue,\n        \"aria-label\": partialNode[\"aria-label\"],\n        wrapper: partialNode.wrapper,\n        shouldInvalidate: partialNode.shouldInvalidate,\n        hasChildNodes: partialNode.hasChildNodes,\n        childNodes: $eb2240fc39a57fa5$var$iterable(function* () {\n          if (!partialNode.hasChildNodes) return;\n          var index = 0;\n          for (var child of partialNode.childNodes()) {\n            if (child.key != null) child.key = \"\" + node1.key + child.key;\n            child.index = index;\n            var _nodes = builder.getFullNode(child, builder.getChildState(state, child), node1.key, node1);\n            for (var _node of _nodes) {\n              index++;\n              yield _node;\n            }\n          }\n        })\n      };\n      yield node1;\n    }\n  }]);\n  return $eb2240fc39a57fa5$export$bf788dd355e3a401;\n}();\nfunction $eb2240fc39a57fa5$var$iterable(iterator) {\n  var cache = [];\n  var iterable = null;\n  return _defineProperty({}, Symbol.iterator, function* () {\n    for (var item of cache) yield item;\n    if (!iterable) iterable = iterator();\n    for (var item1 of iterable) {\n      cache.push(item1);\n      yield item1;\n    }\n  });\n}\nfunction $eb2240fc39a57fa5$var$compose(outer, inner) {\n  if (outer && inner) return function (element) {\n    return outer(inner(element));\n  };\n  if (outer) return outer;\n  if (inner) return inner;\n}\nfunction $eb2240fc39a57fa5$var$capitalize(str) {\n  return str[0].toUpperCase() + str.slice(1);\n}\nfunction $7613b1592d41b092$export$6cd28814d92fa9c9(props, factory, context) {\n  var invalidators = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : [];\n  var builder = (0, $tyW6A$useMemo)(function () {\n    return new (0, $eb2240fc39a57fa5$export$bf788dd355e3a401)();\n  }, []);\n  var prev = (0, $tyW6A$useRef)(null);\n  return (0, $tyW6A$useMemo)(function () {\n    var nodes = builder.build(props, context);\n    prev.current = factory(nodes, prev.current);\n    return prev.current;\n  }, [builder, props.children, props.items, context].concat(_toConsumableArray(invalidators)));\n}\nvar $453cc9f0df89c0a5$var$cache = new WeakMap();\nfunction $453cc9f0df89c0a5$export$77d5aafae4e095b2(collection) {\n  var count = $453cc9f0df89c0a5$var$cache.get(collection);\n  if (count != null) return count;\n  count = 0;\n  for (var item of collection) if (item.type === \"section\") count += $453cc9f0df89c0a5$export$77d5aafae4e095b2(item.childNodes);else count++;\n  $453cc9f0df89c0a5$var$cache.set(collection, count);\n  return count;\n}\nexport { $c1d7fb2ec91bae71$export$6d08773d2e66f8f2 as Item, $9fc4852771d079eb$export$6e2c8f0811a474ce as Section, $7613b1592d41b092$export$6cd28814d92fa9c9 as useCollection, $453cc9f0df89c0a5$export$77d5aafae4e095b2 as getItemCount };","map":{"version":3,"sources":["packages/@react-stately/collections/src/Item.ts","packages/@react-stately/collections/src/Section.ts","packages/@react-stately/collections/src/useCollection.ts","packages/@react-stately/collections/src/CollectionBuilder.ts","packages/@react-stately/collections/src/getItemCount.ts"],"names":[],"mappings":";;;;;;;;AAgBA,SAAS,0BAAA,CAAQ,KAAmB,EAAgB;EAClD,OAAO,IAAI;AACb;AAEA,0BAAA,CAAK,iBAAiB,GAAG,UAAU,iBAAA,CAAqB,KAAmB,EAAE,OAAY,EAA6B;EACpH,IAAK,UAAA,GAA+B,KAAA,CAAhC,UAAA;IAAa,KAAA,GAAmB,KAAA,CAArB,KAAA;IAAS,QAAA,GAAY,KAAA,CAAd,QAAA;EAEtB,IAAI,QAAA,GAAW,KAAA,CAAM,KAAK,IAAI,KAAA,CAAM,QAAQ;EAC5C,IAAI,SAAA,GAAY,KAAA,CAAM,SAAS,KAAK,OAAO,QAAA,KAAa,QAAA,GAAW,QAAA,GAAW,EAAE,CAAA,IAAK,KAAK,CAAC,YAAA,CAAa,IAAI,EAAA;EAG5G,IAAI,CAAC,SAAA,IAAa,EAAC,OAAA,KAAA,IAAA,IAAA,OAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAS,wBAAwB,CAAA,EAClD,OAAA,CAAQ,IAAI,CAAC,wHAAA,CAAA;EAGf,MAAM;IACJ,IAAA,EAAM,MAAA;IACN,KAAA,EAAO,KAAA;cACP,QAAA;eACA,SAAA;IACA,YAAA,EAAc,KAAK,CAAC,YAAA,CAAa;IACjC,aAAA,EAAe,mCAAA,CAAc,KAAA,CAAA;IAC5B,UAAA,YAAA,WAAA,EAAa;MACZ,IAAI,UAAA,EACF,KAAK,IAAI,KAAA,IAAS,UAAA,EAChB,MAAM;QACJ,IAAA,EAAM,MAAA;QACN,KAAA,EAAO;MACT,CAAA,CAAA,KAEG,IAAI,KAAA,EAAO;QAChB,IAAI,KAAA,GAA0B,EAAE;QAChC,CAAA,CAAA,EAAA,YAAK,EAAC,QAAQ,CAAC,OAAO,CAAC,QAAA,EAAU,UAAA,KAAA,EAAS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B,OAAO,CAAA,CAAA,EAAA,cAAO,EAAC,YAAM;IACnB,IAAI,KAAA,GAAQ,OAAA,CAAQ,KAAK,CAAC,KAAA,EAAO,OAAA,CAAA;IACjC,IAAA,CAAK,OAAO,GAAG,OAAA,CAAQ,KAAA,EAAO,IAAA,CAAK,OAAO,CAAA;IAC1C,OAAO,IAAA,CAAK,OAAO;EAGrB,CAAA,GAAI,OAAA,EAAS,KAAA,CAAM,QAAQ,EAAE,KAAA,CAAM,KAAK,EAAE,OAAA,EAAA,MAAA,CAAA,kBAAA,CAAY,YAAA,EAAa,CAAA;AACrE;AEfA,IAAM,2BAAA,GAAQ,IAAI,OAAA,CAAA,CAAA;AAEX,SAAS,yCAAA,CAAgB,UAA6B,EAAU;EACrE,IAAI,KAAA,GAAQ,2BAAA,CAAM,GAAG,CAAC,UAAA,CAAA;EACtB,IAAI,KAAA,IAAS,IAAI,EACf,OAAO,KAAA;EAGT,KAAA,GAAQ,CAAA;EACR,KAAK,IAAI,IAAA,IAAQ,UAAA,EACf,IAAI,IAAA,CAAK,IAAI,KAAK,SAAA,EAChB,KAAA,IAAS,yCAAA,CAAa,IAAA,CAAK,UAAU,CAAA,CAAA,KAErC,KAAA,EAAA;EAIJ,2BAAA,CAAM,GAAG,CAAC,UAAA,EAAY,KAAA,CAAA;EACtB,OAAO,KAAA;AACT","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 {ItemElement, ItemProps} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {ReactElement} from 'react';\n\nfunction Item<T>(props: ItemProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n  return null;\n}\n\nItem.getCollectionNode = function* getCollectionNode<T>(props: ItemProps<T>, context: any): Generator<PartialNode<T>> {\n  let {childItems, title, children} = props;\n\n  let rendered = props.title || props.children;\n  let textValue = props.textValue || (typeof rendered === 'string' ? rendered : '') || props['aria-label'] || '';\n\n  // suppressTextValueWarning is used in components like Tabs, which don't have type to select support.\n  if (!textValue && !context?.suppressTextValueWarning) {\n    console.warn('<Item> with non-plain text contents is unsupported by type to select for accessibility. Please add a `textValue` prop.');\n  }\n\n  yield {\n    type: 'item',\n    props: props,\n    rendered,\n    textValue,\n    'aria-label': props['aria-label'],\n    hasChildNodes: hasChildItems(props),\n    *childNodes() {\n      if (childItems) {\n        for (let child of childItems) {\n          yield {\n            type: 'item',\n            value: child\n          };\n        }\n      } else if (title) {\n        let items: PartialNode<T>[] = [];\n        React.Children.forEach(children, child => {\n          items.push({\n            type: 'item',\n            element: child as ItemElement<T>\n          });\n        });\n\n        yield* items;\n      }\n    }\n  };\n};\n\nfunction hasChildItems<T>(props: ItemProps<T>) {\n  if (props.hasChildItems != null) {\n    return props.hasChildItems;\n  }\n\n  if (props.childItems) {\n    return true;\n  }\n\n  if (props.title && React.Children.count(props.children) > 0) {\n    return true;\n  }\n\n  return false;\n}\n\n// We don't want getCollectionNode to show up in the type definition\nlet _Item = Item as <T>(props: ItemProps<T>) => JSX.Element;\nexport {_Item as Item};\n","/*\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 {PartialNode} from './types';\nimport React, {ReactElement} from 'react';\nimport {SectionProps} from '@react-types/shared';\n\nfunction Section<T>(props: SectionProps<T>): ReactElement { // eslint-disable-line @typescript-eslint/no-unused-vars\n  return null;\n}\n\nSection.getCollectionNode = function* getCollectionNode<T>(props: SectionProps<T>): Generator<PartialNode<T>> {\n  let {children, title, items} = props;\n  yield {\n    type: 'section',\n    props: props,\n    hasChildNodes: true,\n    rendered: title,\n    'aria-label': props['aria-label'],\n    *childNodes() {\n      if (typeof children === 'function') {\n        if (!items) {\n          throw new Error('props.children was a function but props.items is missing');\n        }\n    \n        for (let item of items) {\n          yield {\n            type: 'item',\n            value: item,\n            renderer: children\n          };\n        }\n      } else {\n        let items: PartialNode<T>[] = [];\n        React.Children.forEach(children, child => {\n          items.push({\n            type: 'item',\n            element: child\n          });\n        });\n\n        yield* items;\n      }\n    }\n  };\n};\n\n// We don't want getCollectionNode to show up in the type definition\nlet _Section = Section as <T>(props: SectionProps<T>) => JSX.Element;\nexport {_Section as Section};\n","/*\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, CollectionBase, Node} from '@react-types/shared';\nimport {CollectionBuilder} from './CollectionBuilder';\nimport {useMemo, useRef} from 'react';\n\ntype CollectionFactory<T, C extends Collection<Node<T>>> = (node: Iterable<Node<T>>, prev: C | null) => C;\n\nexport function useCollection<T extends object, C extends Collection<Node<T>> = Collection<Node<T>>>(props: CollectionBase<T>, factory: CollectionFactory<T, C>, context?: unknown, invalidators: Array<any> = []): C {\n  let builder = useMemo(() => new CollectionBuilder<T>(), []);\n\n  let prev = useRef<C>(null);\n  return useMemo(() => {\n    let nodes = builder.build(props, context);\n    prev.current = factory(nodes, prev.current);\n    return prev.current;\n  // Don't invalidate when any prop changes, just the two we care about.\n  // eslint-disable-next-line react-hooks/exhaustive-deps\n  }, [builder, props.children, props.items, context, ...invalidators]);\n}\n","/*\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 {CollectionBase, CollectionElement, Node} from '@react-types/shared';\nimport {PartialNode} from './types';\nimport React, {Key, ReactElement} from 'react';\n\ninterface CollectionBuilderState {\n  renderer?: (value: any) => ReactElement\n}\n\nexport class CollectionBuilder<T extends object> {\n  private context?: unknown;\n  private cache: WeakMap<T, Node<T>> = new WeakMap();\n\n  build(props: CollectionBase<T>, context?: unknown) {\n    this.context = context;\n    return iterable(() => this.iterateCollection(props));\n  }\n\n  private *iterateCollection(props: CollectionBase<T>) {\n    let {children, items} = props;\n\n    if (typeof children === 'function') {\n      if (!items) {\n        throw new Error('props.children was a function but props.items is missing');\n      }\n\n      for (let item of props.items) {\n        yield* this.getFullNode({\n          value: item\n        }, {renderer: children});\n      }\n    } else {\n      let items: CollectionElement<T>[] = [];\n      React.Children.forEach(children, child => {\n        items.push(child);\n      });\n\n      let index = 0;\n      for (let item of items) {\n        let nodes = this.getFullNode({\n          element: item,\n          index: index\n        }, {});\n\n        for (let node of nodes) {\n          index++;\n          yield node;\n        }\n      }\n    }\n  }\n\n  private getKey(item: CollectionElement<T>, partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key): Key {\n    if (item.key != null) {\n      return item.key;\n    }\n\n    if (partialNode.type === 'cell' && partialNode.key != null) {\n      return `${parentKey}${partialNode.key}`;\n    }\n\n    let v = partialNode.value as any;\n    if (v != null) {\n      let key = v.key ?? v.id;\n      if (key == null) {\n        throw new Error('No key found for item');\n      }\n\n      return key;\n    }\n\n    return parentKey ? `${parentKey}.${partialNode.index}` : `$.${partialNode.index}`;\n  }\n\n  private getChildState(state: CollectionBuilderState, partialNode: PartialNode<T>) {\n    return {\n      renderer: partialNode.renderer || state.renderer\n    };\n  }\n\n  private *getFullNode(partialNode: PartialNode<T>, state: CollectionBuilderState, parentKey?: Key, parentNode?: Node<T>): Generator<Node<T>> {\n    // If there's a value instead of an element on the node, and a parent renderer function is available,\n    // use it to render an element for the value.\n    let element = partialNode.element;\n    if (!element && partialNode.value && state && state.renderer) {\n      let cached = this.cache.get(partialNode.value);\n      if (cached && (!cached.shouldInvalidate || !cached.shouldInvalidate(this.context))) {\n        cached.index = partialNode.index;\n        cached.parentKey = parentNode ? parentNode.key : null;\n        yield cached;\n        return;\n      }\n\n      element = state.renderer(partialNode.value);\n    }\n\n    // If there's an element with a getCollectionNode function on its type, then it's a supported component.\n    // Call this function to get a partial node, and recursively build a full node from there.\n    if (React.isValidElement(element)) {\n      let type = element.type as any;\n      if (typeof type !== 'function' && typeof type.getCollectionNode !== 'function') {\n        let name = typeof element.type === 'function' ? element.type.name : element.type;\n        throw new Error(`Unknown element <${name}> in collection.`);\n      }\n\n      let childNodes = type.getCollectionNode(element.props, this.context) as Generator<PartialNode<T>, void, Node<T>[]>;\n      let index = partialNode.index;\n      let result = childNodes.next();\n      while (!result.done && result.value) {\n        let childNode = result.value;\n\n        partialNode.index = index;\n\n        let nodeKey = childNode.key;\n        if (!nodeKey) {\n          nodeKey = childNode.element ? null : this.getKey(element as CollectionElement<T>, partialNode, state, parentKey);\n        }\n\n        let nodes = this.getFullNode({\n          ...childNode,\n          key: nodeKey,\n          index,\n          wrapper: compose(partialNode.wrapper, childNode.wrapper)\n        }, this.getChildState(state, childNode), parentKey ? `${parentKey}${element.key}` : element.key, parentNode);\n\n        let children = [...nodes];\n        for (let node of children) {\n          // Cache the node based on its value\n          node.value = childNode.value || partialNode.value;\n          if (node.value) {\n            this.cache.set(node.value, node);\n          }\n\n          // The partial node may have specified a type for the child in order to specify a constraint.\n          // Verify that the full node that was built recursively matches this type.\n          if (partialNode.type && node.type !== partialNode.type) {\n            throw new Error(`Unsupported type <${capitalize(node.type)}> in <${capitalize(parentNode.type)}>. Only <${capitalize(partialNode.type)}> is supported.`);\n          }\n\n          index++;\n          yield node;\n        }\n\n        result = childNodes.next(children);\n      }\n\n      return;\n    }\n\n    // Ignore invalid elements\n    if (partialNode.key == null) {\n      return;\n    }\n\n    // Create full node\n    let builder = this;\n    let node: Node<T> = {\n      type: partialNode.type,\n      props: partialNode.props,\n      key: partialNode.key,\n      parentKey: parentNode ? parentNode.key : null,\n      value: partialNode.value,\n      level: parentNode ? parentNode.level + 1 : 0,\n      index: partialNode.index,\n      rendered: partialNode.rendered,\n      textValue: partialNode.textValue,\n      'aria-label': partialNode['aria-label'],\n      wrapper: partialNode.wrapper,\n      shouldInvalidate: partialNode.shouldInvalidate,\n      hasChildNodes: partialNode.hasChildNodes,\n      childNodes: iterable(function *() {\n        if (!partialNode.hasChildNodes) {\n          return;\n        }\n\n        let index = 0;\n        for (let child of partialNode.childNodes()) {\n          // Ensure child keys are globally unique by prepending the parent node's key\n          if (child.key != null) {\n            // TODO: Remove this line entirely and enforce that users always provide unique keys.\n            // Currently this line will have issues when a parent has a key `a` and a child with key `bc`\n            // but another parent has key `ab` and its child has a key `c`. The combined keys would result in both\n            // children having a key of `abc`.\n            child.key = `${node.key}${child.key}`;\n          }\n\n          child.index = index;\n          let nodes = builder.getFullNode(child, builder.getChildState(state, child), node.key, node);\n          for (let node of nodes) {\n            index++;\n            yield node;\n          }\n        }\n      })\n    };\n\n    yield node;\n  }\n}\n\n// Wraps an iterator function as an iterable object, and caches the results.\nfunction iterable<T>(iterator: () => IterableIterator<Node<T>>): Iterable<Node<T>> {\n  let cache = [];\n  let iterable = null;\n  return {\n    *[Symbol.iterator]() {\n      for (let item of cache) {\n        yield item;\n      }\n\n      if (!iterable) {\n        iterable = iterator();\n      }\n\n      for (let item of iterable) {\n        cache.push(item);\n        yield item;\n      }\n    }\n  };\n}\n\ntype Wrapper = (element: ReactElement) => ReactElement;\nfunction compose(outer: Wrapper | void, inner: Wrapper | void): Wrapper {\n  if (outer && inner) {\n    return (element) => outer(inner(element));\n  }\n\n  if (outer) {\n    return outer;\n  }\n\n  if (inner) {\n    return inner;\n  }\n}\n\nfunction capitalize(str: string) {\n  return str[0].toUpperCase() + str.slice(1);\n}\n","/*\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 {Node} from '@react-types/shared';\n\nconst cache = new WeakMap<Iterable<unknown>, number>();\n\nexport function getItemCount<T>(collection: Iterable<Node<T>>): number {\n  let count = cache.get(collection);\n  if (count != null) {\n    return count;\n  }\n\n  count = 0;\n  for (let item of collection) {\n    if (item.type === 'section') {\n      count += getItemCount(item.childNodes);\n    } else {\n      count++;\n    }\n  }\n\n  cache.set(collection, count);\n  return count;\n}\n"]},"metadata":{},"sourceType":"module"}