// Metro module 8698 (f8699). import { createWithEqualityFn } from "../../_bundle/identity_700"; import { shallow } from "../../_bundle/Module3802"; import { useDefaultVariantIndex } from "./hooks/useDefaultVariantIndex"; import { getIsVariantProduct } from "./utils/CollectiblesProductUtils"; const withEqualityFn = createWithEqualityFn(() => ({ selectionStates: new Map() }), shallow); export function useSelectedVariantIndex(a0) { let c16733_0 = a0; let r10 = useDefaultVariantIndex(a0); const r13 = withEqualityFn((a0) => c16733_0 != null ? getIsVariantProduct(c16733_0) ? a0.selectionStates.get(c16733_0.storeListingId)?.selectedVariantIndex : null : null); if (r13 != null) { r10 = Math.max(0, r13); } return r10; } export function setSelectedVariantIndex(c16734_0, selectedVariantIndex) { withEqualityFn.setState((state) => { const selectionStates = state.selectionStates; return selectionStates.get(c16734_0.storeListingId)?.selectedVariantIndex !== selectedVariantIndex ? { selectionStates: new Map(state.selectionStates).set(c16734_0.storeListingId, { selectedVariantIndex }) } : state; }); }