{"version":3,"file":"useSlot-BoBbpkcH.js","sources":["../../../node_modules/@mui/material/utils/useSlot.js"],"sourcesContent":["'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"className\", \"elementType\", \"ownerState\", \"externalForwardedProps\", \"getSlotOwnerState\", \"internalForwardedProps\"],\n _excluded2 = [\"component\", \"slots\", \"slotProps\"],\n _excluded3 = [\"component\"];\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 getSlotOwnerState,\n internalForwardedProps\n } = parameters,\n useSlotPropsParams = _objectWithoutPropertiesLoose(parameters, _excluded);\n const {\n component: rootComponent,\n slots = {\n [name]: undefined\n },\n slotProps = {\n [name]: undefined\n }\n } = externalForwardedProps,\n other = _objectWithoutPropertiesLoose(externalForwardedProps, _excluded2);\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 _mergeSlotProps = mergeSlotProps(_extends({\n className\n }, useSlotPropsParams, {\n externalForwardedProps: name === 'root' ? other : undefined,\n externalSlotProps: resolvedComponentsProps\n })),\n {\n props: {\n component: slotComponent\n },\n internalRef\n } = _mergeSlotProps,\n mergedProps = _objectWithoutPropertiesLoose(_mergeSlotProps.props, _excluded3);\n const ref = useForkRef(internalRef, resolvedComponentsProps == null ? void 0 : resolvedComponentsProps.ref, parameters.ref);\n const slotOwnerState = getSlotOwnerState ? getSlotOwnerState(mergedProps) : {};\n const finalOwnerState = _extends({}, ownerState, slotOwnerState);\n const LeafComponent = name === 'root' ? slotComponent || rootComponent : slotComponent;\n const props = appendOwnerState(elementType, _extends({}, name === 'root' && !rootComponent && !slots[name] && internalForwardedProps, name !== 'root' && !slots[name] && internalForwardedProps, mergedProps, LeafComponent && {\n as: LeafComponent\n }, {\n ref\n }), finalOwnerState);\n Object.keys(slotOwnerState).forEach(propName => {\n delete props[propName];\n });\n return [elementType, props];\n}"],"names":["_excluded","_excluded2","_excluded3","useSlot","name","parameters","className","initialElementType","ownerState","externalForwardedProps","getSlotOwnerState","internalForwardedProps","useSlotPropsParams","_objectWithoutPropertiesLoose","rootComponent","slots","slotProps","other","elementType","resolvedComponentsProps","resolveComponentProps","_mergeSlotProps","mergeSlotProps","_extends","slotComponent","internalRef","mergedProps","ref","useForkRef","slotOwnerState","finalOwnerState","LeafComponent","props","appendOwnerState","propName"],"mappings":"wKAIA,MAAMA,EAAY,CAAC,YAAa,cAAe,aAAc,yBAA0B,oBAAqB,wBAAwB,EAClIC,EAAa,CAAC,YAAa,QAAS,WAAW,EAC/CC,EAAa,CAAC,WAAW,EAmBZ,SAASC,EAOxBC,EAAMC,EAAY,CAChB,KAAM,CACF,UAAAC,EACA,YAAaC,EACb,WAAAC,EACA,uBAAAC,EACA,kBAAAC,EACA,uBAAAC,CACN,EAAQN,EACJO,EAAqBC,EAA8BR,EAAYL,CAAS,EACpE,CACF,UAAWc,EACX,MAAAC,EAAQ,CACN,CAACX,CAAI,EAAG,MACT,EACD,U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