"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "getSlotsNext", { enumerable: true, get: function() { return getSlotsNext; } }); const _interop_require_wildcard = require("@swc/helpers/_/_interop_require_wildcard"); const _react = /*#__PURE__*/ _interop_require_wildcard._(require("react")); function getSlotsNext(state) { const typedState = state; // eslint-disable-next-line @typescript-eslint/no-deprecated const slots = {}; const slotProps = {}; // eslint-disable-next-line @typescript-eslint/no-deprecated const slotNames = Object.keys(typedState.components); for (const slotName of slotNames){ // eslint-disable-next-line @typescript-eslint/no-deprecated const [slot, props] = getSlotNext(typedState, slotName); // eslint-disable-next-line @typescript-eslint/no-deprecated slots[slotName] = slot; slotProps[slotName] = props; } // eslint-disable-next-line @typescript-eslint/no-deprecated return { slots, slotProps: slotProps }; } /** * @deprecated use slot.always or slot.optional combined with assertSlots instead */ function getSlotNext(state, slotName) { var _state_components, _state_components1; const props = state[slotName]; if (props === undefined) { return [ null, undefined ]; } // TS Error: Property 'as' does not exist on type 'UnknownSlotProps | undefined'.ts(2339) const { as: asProp, ...propsWithoutAs } = props; const slot = ((_state_components = state.components) === null || _state_components === void 0 ? void 0 : _state_components[slotName]) === undefined || // eslint-disable-line @typescript-eslint/no-deprecated // eslint-disable-next-line @typescript-eslint/no-deprecated typeof state.components[slotName] === 'string' ? asProp || ((_state_components1 = state.components) === null || _state_components1 === void 0 ? void 0 : _state_components1[slotName]) || 'div' : state.components[slotName]; const shouldOmitAsProp = typeof slot === 'string' && asProp; const slotProps = shouldOmitAsProp ? propsWithoutAs : props; return [ slot, slotProps ]; }