{
  "version": 3,
  "sources": ["../../../src/composite/legacy/index.tsx"],
  "sourcesContent": ["/**\n * Composite is a component that may contain navigable items represented by\n * CompositeItem. It's inspired by the WAI-ARIA Composite Role and implements\n * all the keyboard navigation mechanisms to ensure that there's only one\n * tab stop for the whole Composite element. This means that it can behave as\n * a roving tabindex or aria-activedescendant container.\n *\n * This file aims at providing components that are as close as possible to the\n * original `reakit`-based implementation (which was removed from the codebase),\n * although it is recommended that consumers of the package switch to the stable,\n * un-prefixed, `ariakit`-based version of `Composite`.\n *\n * @see https://ariakit.org/components/composite\n */\n\n/**\n * External dependencies\n */\nimport * as Ariakit from '@ariakit/react';\n\n/**\n * WordPress dependencies\n */\nimport { forwardRef } from '@wordpress/element';\nimport { useInstanceId } from '@wordpress/compose';\nimport deprecated from '@wordpress/deprecated';\n\n/**\n * Internal dependencies\n */\nimport { Composite as Current } from '..';\n\n// Legacy composite components can either provide state through a\n// single `state` prop, or via individual props, usually through\n// spreading the state generated by `useCompositeState`.\n// That is, `<Composite* { ...state }>`.\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nfunction mapLegacyStatePropsToComponentProps(legacyProps) {\n  // If a `state` prop is provided, we unpack that; otherwise,\n  // the necessary props are provided directly in `legacyProps`.\n  if (legacyProps.state) {\n    const {\n      state,\n      ...rest\n    } = legacyProps;\n    const {\n      store,\n      ...props\n    } = mapLegacyStatePropsToComponentProps(state);\n    return {\n      ...rest,\n      ...props,\n      store\n    };\n  }\n  return legacyProps;\n}\nconst LEGACY_TO_NEW_DISPLAY_NAME = {\n  __unstableComposite: 'Composite',\n  __unstableCompositeGroup: 'Composite.Group or Composite.Row',\n  __unstableCompositeItem: 'Composite.Item',\n  __unstableUseCompositeState: 'Composite'\n};\nfunction proxyComposite(ProxiedComponent, propMap = {}) {\n  const displayName = ProxiedComponent.displayName ?? '';\n  const Component = legacyProps => {\n    deprecated(`wp.components.${displayName}`, {\n      since: '6.7',\n      alternative: LEGACY_TO_NEW_DISPLAY_NAME.hasOwnProperty(displayName) ? LEGACY_TO_NEW_DISPLAY_NAME[displayName] : undefined\n    });\n    const {\n      store,\n      ...rest\n    } = mapLegacyStatePropsToComponentProps(legacyProps);\n    let props = rest;\n    props = {\n      ...props,\n      id: useInstanceId(store, props.baseId, props.id)\n    };\n    Object.entries(propMap).forEach(([from, to]) => {\n      if (props.hasOwnProperty(from)) {\n        Object.assign(props, {\n          [to]: props[from]\n        });\n        delete props[from];\n      }\n    });\n    delete props.baseId;\n    return /*#__PURE__*/_jsx(ProxiedComponent, {\n      ...props,\n      store: store\n    });\n  };\n  Component.displayName = displayName;\n  return Component;\n}\n\n// The old `CompositeGroup` used to behave more like the current\n// `CompositeRow`, but this has been split into two different\n// components. We handle that difference by checking on the\n// provided role, and returning the appropriate component.\nconst UnproxiedCompositeGroup = forwardRef(({\n  role,\n  ...props\n}, ref) => {\n  const Component = role === 'row' ? Current.Row : Current.Group;\n  return /*#__PURE__*/_jsx(Component, {\n    ref: ref,\n    role: role,\n    ...props\n  });\n});\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport const Composite = proxyComposite(Object.assign(Current, {\n  displayName: '__unstableComposite'\n}), {\n  baseId: 'id'\n});\n/**\n * _Note: please use the `Composite.Row` or `Composite.Group` components instead._\n *\n * @deprecated\n */\nexport const CompositeGroup = proxyComposite(Object.assign(UnproxiedCompositeGroup, {\n  displayName: '__unstableCompositeGroup'\n}));\n/**\n * _Note: please use the `Composite.Item` component instead._\n *\n * @deprecated\n */\nexport const CompositeItem = proxyComposite(Object.assign(Current.Item, {\n  displayName: '__unstableCompositeItem'\n}), {\n  focusable: 'accessibleWhenDisabled'\n});\n\n/**\n * _Note: please use the `Composite` component instead._\n *\n * @deprecated\n */\nexport function useCompositeState(legacyStateOptions = {}) {\n  deprecated(`wp.components.__unstableUseCompositeState`, {\n    since: '6.7',\n    alternative: LEGACY_TO_NEW_DISPLAY_NAME.__unstableUseCompositeState\n  });\n  const {\n    baseId,\n    currentId: defaultActiveId,\n    orientation,\n    rtl = false,\n    loop: focusLoop = false,\n    wrap: focusWrap = false,\n    shift: focusShift = false,\n    unstable_virtual: virtualFocus\n  } = legacyStateOptions;\n  return {\n    baseId: useInstanceId(Composite, 'composite', baseId),\n    store: Ariakit.useCompositeStore({\n      defaultActiveId,\n      rtl,\n      orientation,\n      focusLoop,\n      focusShift,\n      focusWrap,\n      virtualFocus\n    })\n  };\n}"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkBA,cAAyB;AAKzB,qBAA2B;AAC3B,qBAA8B;AAC9B,wBAAuB;AAKvB,eAAqC;AAMrC,yBAA4B;AAC5B,SAAS,oCAAoC,aAAa;AAGxD,MAAI,YAAY,OAAO;AACrB,UAAM;AAAA,MACJ;AAAA,MACA,GAAG;AAAA,IACL,IAAI;AACJ,UAAM;AAAA,MACJ;AAAA,MACA,GAAG;AAAA,IACL,IAAI,oCAAoC,KAAK;AAC7C,WAAO;AAAA,MACL,GAAG;AAAA,MACH,GAAG;AAAA,MACH;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AACA,IAAM,6BAA6B;AAAA,EACjC,qBAAqB;AAAA,EACrB,0BAA0B;AAAA,EAC1B,yBAAyB;AAAA,EACzB,6BAA6B;AAC/B;AACA,SAAS,eAAe,kBAAkB,UAAU,CAAC,GAAG;AACtD,QAAM,cAAc,iBAAiB,eAAe;AACpD,QAAM,YAAY,iBAAe;AAC/B,0BAAAA,SAAW,iBAAiB,WAAW,IAAI;AAAA,MACzC,OAAO;AAAA,MACP,aAAa,2BAA2B,eAAe,WAAW,IAAI,2BAA2B,WAAW,IAAI;AAAA,IAClH,CAAC;AACD,UAAM;AAAA,MACJ;AAAA,MACA,GAAG;AAAA,IACL,IAAI,oCAAoC,WAAW;AACnD,QAAI,QAAQ;AACZ,YAAQ;AAAA,MACN,GAAG;AAAA,MACH,QAAI,8BAAc,OAAO,MAAM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