// Metro module 12604 (f12605). import { getSingleRequirementThreshold } from "../../badges/BadgeDirectoryStore"; import UserStore from "../../../stores/UserStore"; import { GiftingBadgeExperiment } from "./experiments/GiftingBadgeExperiment"; import { GiftingBadgeDesktopExperiment } from "./experiments/GiftingBadgeDesktopExperiment"; import { useStateFromStores } from "../../../_bundle/Module589"; import { useIsDismissibleContentDismissed_UNSAFE } from "../../dismissible_content/DismissibleContentUnsafeUtils"; import { DismissibleContent } from "../../../_bundle/Module1358"; export function getGiftingBadgeProgressPercent(a0, a1, a2) { const singleRequirementThreshold = getSingleRequirementThreshold(a1); const singleRequirementThreshold2 = getSingleRequirementThreshold(a2); return Math.min(Math.max(a2 != null ? singleRequirementThreshold2 > 0 ? a0 / singleRequirementThreshold2 * 100 : 100 : singleRequirementThreshold > 0 ? Math.min(singleRequirementThreshold, a0) / singleRequirementThreshold * 100 : 100, 0), 100); } export function useIsGiftingBadgesDesktopEnabled(a0) { const enabled = GiftingBadgeExperiment.useConfig({ location: a0 }).enabled; return GiftingBadgeDesktopExperiment.useConfig({ location: `${a0}${enabled ? "" : "-DISABLED"}` }).enabled && enabled; } export function getIsGiftingBadgesDesktopEnabled(a0) { return !!GiftingBadgeExperiment.getConfig({ location: a0 }).enabled && GiftingBadgeDesktopExperiment.getConfig({ location: a0 }).enabled; } export function useIsEligibleToShowGiftingBadgeCoachmark({ platform: platform2, location: location2 }) { const enabled = GiftingBadgeExperiment.useConfig({ location: location2 }).enabled; const r1 = platform2 === "web"; let enabled2 = GiftingBadgeDesktopExperiment.useConfig({ location: `${location2}${r1 ? "" : "-DISABLED"}` }).enabled; let r29 = enabled; if (r1) { if (enabled2) { enabled2 = enabled; } r29 = enabled2; } const stateFromStores = useStateFromStores([UserStore], () => { const currentUser = UserStore.getCurrentUser(); let r6 = currentUser == null ? void 0 : currentUser.hasHadPremium(); if (r6 == null) { r6 = false; } return r6; }); const isDismissibleContentDismissed_UNSAFE = useIsDismissibleContentDismissed_UNSAFE(DismissibleContent.NEW_GIFTING_BADGES_COACHMARK); if (r29) { r29 = stateFromStores; } if (r29) { r29 = !isDismissibleContentDismissed_UNSAFE; } return r29; }