{"version":3,"file":"useSlot.mjs","sources":["../../../../../../../../node_modules/@mui/material/utils/useSlot.js"],"sourcesContent":["'use client';\n\nimport useForkRef from '@mui/utils/useForkRef';\nimport appendOwnerState from '@mui/utils/appendOwnerState';\nimport resolveComponentProps from '@mui/utils/resolveComponentProps';\nimport mergeSlotProps from '@mui/utils/mergeSlotProps';\n/**\n * An internal function to create a Material UI slot.\n *\n * This is an advanced version of Base UI `useSlotProps` because Material UI allows leaf component to be customized via `component` prop\n * while Base UI does not need to support leaf component customization.\n *\n * @param {string} name: name of the slot\n * @param {object} parameters\n * @returns {[Slot, slotProps]} The slot's React component and the slot's props\n *\n * Note: the returned slot's props\n * - will never contain `component` prop.\n * - might contain `as` prop.\n */\nexport default function useSlot(\n/**\n * The slot's name. All Material UI components should have `root` slot.\n *\n * If the name is `root`, the logic behaves differently from other slots,\n * e.g. the `externalForwardedProps` are spread to `root` slot but not other slots.\n */\nname, parameters) {\n  const {\n    className,\n    elementType: initialElementType,\n    ownerState,\n    externalForwardedProps,\n    internalForwardedProps,\n    shouldForwardComponentProp = false,\n    ...useSlotPropsParams\n  } = parameters;\n  const {\n    component: rootComponent,\n    slots = {\n      [name]: undefined\n    },\n    slotProps = {\n      [name]: undefined\n    },\n    ...other\n  } = externalForwardedProps;\n  const elementType = slots[name] || initialElementType;\n\n  // `slotProps[name]` can be a callback that receives the component's ownerState.\n  // `resolvedComponentsProps` is always a plain object.\n  const resolvedComponentsProps = resolveComponentProps(slotProps[name], ownerState);\n  const {\n    props: {\n      component: slotComponent,\n      ...mergedProps\n    },\n    internalRef\n  } = mergeSlotProps({\n    className,\n    ...useSlotPropsParams,\n    externalForwardedProps: name === 'root' ? other : undefined,\n    externalSlotProps: resolvedComponentsProps\n  });\n  const ref = useForkRef(internalRef, resolvedComponentsProps?.ref, parameters.ref);\n  const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;\n  const props = appendOwnerState(elementType, {\n    ...(name === 'root' && !rootComponent && !slots[name] && internalForwardedProps),\n    ...(name !== 'root' && !slots[name] && internalForwardedProps),\n    ...mergedProps,\n    ...(LeafComponent && !shouldForwardComponentProp && {\n      as: LeafComponent\n    }),\n    ...(LeafComponent && shouldForwardComponentProp && {\n      component: LeafComponent\n    }),\n    ref\n  }, ownerState);\n  return [elementType, props];\n}"],"names":[],"mappings":";;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,SAAS,OAAO;AAC/B;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,EAAE,UAAU,EAAE;AAClB,EAAE,MAAM;AACR,IAAI,SAAS;AACb,IAAI,WAAW,EAAE,kBAAkB;AACnC,IAAI,UAAU;AACd,IAAI,sBAAsB;AAC1B,IAAI,sBAAsB;AAC1B,IAAI,0BAA0B,GAAG,KAAK;AACtC,IAAI,GAAG;AACP,GAAG,GAAG,UAAU;AAChB,EAAE,MAAM;AACR,IAAI,SAAS,EAAE,aAAa;AAC5B,IAAI,KAAK,GAAG;AACZ,MAAM,CAAC,IAAI,GAAG;AACd,KAAK;AACL,IAAI,SAAS,GAAG;AAChB,MAAM,CAAC,IAAI,GAAG;AACd,KAAK;AACL,IAAI,GAAG;AACP,GAAG,GAAG,sBAAsB;AAC5B,EAAE,MAAM,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,kBAAkB;;AAEvD;AACA;AACA,EAAE,MAAM,uBAAuB,GAAG,qBAAqB,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;AACpF,EAAE,MAAM;AACR,IAAI,KAAK,EAAE;AACX,MAAM,SAAS,EAAE,aAAa;AAC9B,MAAM,GAAG;AACT,KAAK;AACL,IAAI;AACJ,GAAG,GAAG,cAAc,CAAC;AACrB,IAAI,SAAS;AACb,IAAI,GAAG,kBAAkB;AACzB,IAAI,sBAAsB,EAAE,IAAI,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS;AAC/D,IAAI,iBAAiB,EAAE;AACvB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