{
  "version": 3,
  "sources": ["../src/radio-group.tsx", "../src/radio.tsx"],
  "sourcesContent": ["import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { Primitive } from '@radix-ui/react-primitive';\nimport * as RovingFocusGroup from '@radix-ui/react-roving-focus';\nimport { createRovingFocusGroupScope } from '@radix-ui/react-roving-focus';\nimport { useControllableState } from '@radix-ui/react-use-controllable-state';\nimport { useDirection } from '@radix-ui/react-direction';\nimport {\n  type Radio,\n  RadioProvider,\n  RadioTrigger,\n  RadioBubbleInput,\n  RadioIndicator,\n  createRadioScope,\n  useRadioContext,\n} from './radio';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst ARROW_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight'];\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroup\n * -----------------------------------------------------------------------------------------------*/\nconst RADIO_GROUP_NAME = 'RadioGroup';\n\ntype ScopedProps<P> = P & { __scopeRadioGroup?: Scope };\nconst [createRadioGroupContext, createRadioGroupScope] = createContextScope(RADIO_GROUP_NAME, [\n  createRovingFocusGroupScope,\n  createRadioScope,\n]);\nconst useRovingFocusGroupScope = createRovingFocusGroupScope();\nconst useRadioScope = createRadioScope();\n\ntype RadioGroupContextValue = {\n  name?: string;\n  form?: string;\n  required: boolean;\n  disabled: boolean;\n  value: string | null;\n  onValueChange(value: string): void;\n};\n\nconst [RadioGroupProvider, useRadioGroupContext] =\n  createRadioGroupContext<RadioGroupContextValue>(RADIO_GROUP_NAME);\n\ntype RadioGroupElement = React.ComponentRef<typeof Primitive.div>;\ntype RovingFocusGroupProps = React.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;\ntype PrimitiveDivProps = React.ComponentPropsWithoutRef<typeof Primitive.div>;\ninterface RadioGroupProps extends PrimitiveDivProps {\n  name?: RadioGroupContextValue['name'];\n  form?: React.ComponentPropsWithoutRef<typeof Radio>['form'];\n  required?: React.ComponentPropsWithoutRef<typeof Radio>['required'];\n  disabled?: React.ComponentPropsWithoutRef<typeof Radio>['disabled'];\n  dir?: RovingFocusGroupProps['dir'];\n  orientation?: RovingFocusGroupProps['orientation'];\n  loop?: RovingFocusGroupProps['loop'];\n  defaultValue?: string;\n  value?: string | null;\n  onValueChange?: RadioGroupContextValue['onValueChange'];\n}\n\nconst RadioGroup = /* @__PURE__ */ React.forwardRef<RadioGroupElement, RadioGroupProps>(\n  function RadioGroup(props: ScopedProps<RadioGroupProps>, forwardedRef) {\n    const {\n      __scopeRadioGroup,\n      name,\n      form,\n      defaultValue,\n      value: valueProp,\n      required = false,\n      disabled = false,\n      orientation,\n      dir,\n      loop = true,\n      onValueChange,\n      ...groupProps\n    } = props;\n    const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n    const direction = useDirection(dir);\n    const [value, setValue] = useControllableState({\n      prop: valueProp,\n      defaultProp: defaultValue ?? null,\n      onChange: onValueChange as (value: string | null) => void,\n      caller: RADIO_GROUP_NAME,\n    });\n    const [control, setControl] = React.useState<RadioGroupElement | null>(null);\n    const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n    const initialValueRef = React.useRef(value);\n    React.useEffect(() => {\n      const associatedForm = form\n        ? control?.ownerDocument.getElementById(form)\n        : control?.closest('form');\n      if (associatedForm instanceof HTMLFormElement) {\n        const reset = () => setValue(initialValueRef.current);\n        associatedForm.addEventListener('reset', reset);\n        return () => associatedForm.removeEventListener('reset', reset);\n      }\n    }, [control, form, setValue]);\n\n    return (\n      <RadioGroupProvider\n        scope={__scopeRadioGroup}\n        name={name}\n        form={form}\n        required={required}\n        disabled={disabled}\n        value={value}\n        onValueChange={setValue}\n      >\n        <RovingFocusGroup.Root\n          asChild\n          {...rovingFocusGroupScope}\n          orientation={orientation}\n          dir={direction}\n          loop={loop}\n        >\n          <Primitive.div\n            role=\"radiogroup\"\n            aria-required={required}\n            aria-orientation={orientation}\n            data-disabled={disabled ? '' : undefined}\n            dir={direction}\n            {...groupProps}\n            ref={composedRefs}\n          />\n        </RovingFocusGroup.Root>\n      </RadioGroupProvider>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemProvider\n * -----------------------------------------------------------------------------------------------*/\nconst ITEM_PROVIDER_NAME = 'RadioGroupItemProvider';\nconst ITEM_TRIGGER_NAME = 'RadioGroupItemTrigger';\n\ninterface RadioGroupItemProviderProps {\n  value: string;\n  disabled?: boolean;\n  children?: React.ReactNode;\n}\n\nfunction RadioGroupItemProvider(props: ScopedProps<RadioGroupItemProviderProps>) {\n  const {\n    __scopeRadioGroup,\n    value,\n    disabled,\n    children,\n    // @ts-expect-error\n    internal_do_not_use_render,\n  } = props;\n  const context = useRadioGroupContext(ITEM_PROVIDER_NAME, __scopeRadioGroup);\n  const radioScope = useRadioScope(__scopeRadioGroup);\n  const isDisabled = context.disabled || disabled;\n\n  return (\n    <RadioProvider\n      {...radioScope}\n      checked={context.value === value}\n      disabled={isDisabled}\n      required={context.required}\n      name={context.name}\n      form={context.form}\n      value={value}\n      onCheck={() => context.onValueChange(value)}\n      // @ts-expect-error\n      internal_do_not_use_render={internal_do_not_use_render}\n    >\n      {children}\n    </RadioProvider>\n  );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemTrigger\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemTriggerElement = React.ComponentRef<typeof RadioTrigger>;\ninterface RadioGroupItemTriggerProps extends React.ComponentPropsWithoutRef<typeof RadioTrigger> {}\n\nconst RadioGroupItemTrigger = /* @__PURE__ */ React.forwardRef<\n  RadioGroupItemTriggerElement,\n  RadioGroupItemTriggerProps\n>(function RadioGroupItemTrigger(props: ScopedProps<RadioGroupItemTriggerProps>, forwardedRef) {\n  const { __scopeRadioGroup, ...triggerProps } = props;\n  const rovingFocusGroupScope = useRovingFocusGroupScope(__scopeRadioGroup);\n  const radioScope = useRadioScope(__scopeRadioGroup);\n  const { checked, disabled } = useRadioContext(ITEM_TRIGGER_NAME, radioScope.__scopeRadio);\n  const ref = React.useRef<RadioGroupItemTriggerElement>(null);\n  const composedRefs = useComposedRefs(forwardedRef, ref);\n  const isArrowKeyPressedRef = React.useRef(false);\n\n  React.useEffect(() => {\n    const handleKeyDown = (event: KeyboardEvent) => {\n      if (ARROW_KEYS.includes(event.key)) {\n        isArrowKeyPressedRef.current = true;\n      }\n    };\n    const handleKeyUp = () => (isArrowKeyPressedRef.current = false);\n    document.addEventListener('keydown', handleKeyDown);\n    document.addEventListener('keyup', handleKeyUp);\n    return () => {\n      document.removeEventListener('keydown', handleKeyDown);\n      document.removeEventListener('keyup', handleKeyUp);\n    };\n  }, []);\n\n  return (\n    <RovingFocusGroup.Item\n      asChild\n      {...rovingFocusGroupScope}\n      focusable={!disabled}\n      active={checked}\n    >\n      <RadioTrigger\n        {...radioScope}\n        {...triggerProps}\n        ref={composedRefs}\n        onKeyDown={composeEventHandlers(triggerProps.onKeyDown, (event) => {\n          // According to WAI ARIA, radio groups don't activate items on enter\n          // keypress\n          if (event.key === 'Enter') event.preventDefault();\n        })}\n        onFocus={composeEventHandlers(triggerProps.onFocus, () => {\n          /**\n           * Our `RovingFocusGroup` will focus the radio when navigating with\n           * arrow keys and we need to \"check\" it in that case. We click it to\n           * \"check\" it (instead of updating `context.value`) so that the radio\n           * change event fires.\n           */\n          if (isArrowKeyPressedRef.current) {\n            ref.current?.click();\n          }\n        })}\n      />\n    </RovingFocusGroup.Item>\n  );\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItem\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemElement = React.ComponentRef<typeof Radio>;\ntype RadioProps = React.ComponentPropsWithoutRef<typeof Radio>;\ninterface RadioGroupItemProps extends Omit<RadioProps, 'onCheck' | 'name'> {\n  value: string;\n}\n\nconst RadioGroupItem = /* @__PURE__ */ React.forwardRef<RadioGroupItemElement, RadioGroupItemProps>(\n  function RadioGroupItem(props: ScopedProps<RadioGroupItemProps>, forwardedRef) {\n    const { __scopeRadioGroup, value, disabled, ...itemProps } = props;\n\n    return (\n      <RadioGroupItemProvider\n        __scopeRadioGroup={__scopeRadioGroup}\n        value={value}\n        disabled={disabled}\n        // @ts-expect-error\n        internal_do_not_use_render={({ isFormControl }: { isFormControl: boolean }) => (\n          <>\n            <RadioGroupItemTrigger\n              {...itemProps}\n              ref={forwardedRef}\n              // @ts-expect-error\n              __scopeRadioGroup={__scopeRadioGroup}\n            />\n            {isFormControl && (\n              <RadioGroupItemBubbleInput\n                // @ts-expect-error\n                __scopeRadioGroup={__scopeRadioGroup}\n              />\n            )}\n          </>\n        )}\n      />\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupItemBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupItemBubbleInputElement = React.ComponentRef<typeof RadioBubbleInput>;\ninterface RadioGroupItemBubbleInputProps extends React.ComponentPropsWithoutRef<\n  typeof RadioBubbleInput\n> {}\n\nconst RadioGroupItemBubbleInput = /* @__PURE__ */ React.forwardRef<\n  RadioGroupItemBubbleInputElement,\n  RadioGroupItemBubbleInputProps\n>(function RadioGroupItemBubbleInput(\n  props: ScopedProps<RadioGroupItemBubbleInputProps>,\n  forwardedRef,\n) {\n  const { __scopeRadioGroup, ...bubbleProps } = props;\n  const radioScope = useRadioScope(__scopeRadioGroup);\n  return <RadioBubbleInput {...radioScope} {...bubbleProps} ref={forwardedRef} />;\n});\n\n/* -------------------------------------------------------------------------------------------------\n * RadioGroupIndicator\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioGroupIndicatorElement = React.ComponentRef<typeof RadioIndicator>;\ntype RadioIndicatorProps = React.ComponentPropsWithoutRef<typeof RadioIndicator>;\ninterface RadioGroupIndicatorProps extends RadioIndicatorProps {}\n\nconst RadioGroupIndicator = /* @__PURE__ */ React.forwardRef<\n  RadioGroupIndicatorElement,\n  RadioGroupIndicatorProps\n>(\n  // blank line to reduce diff noise\n  function RadioGroupIndicator(props: ScopedProps<RadioGroupIndicatorProps>, forwardedRef) {\n    const { __scopeRadioGroup, ...indicatorProps } = props;\n    const radioScope = useRadioScope(__scopeRadioGroup);\n    return <RadioIndicator {...radioScope} {...indicatorProps} ref={forwardedRef} />;\n  },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nexport {\n  createRadioGroupScope,\n  //\n  RadioGroup,\n  RadioGroupItem,\n  RadioGroupItemProvider,\n  RadioGroupItemTrigger,\n  RadioGroupItemBubbleInput,\n  RadioGroupIndicator,\n  //\n  RadioGroup as Root,\n  RadioGroupItem as Item,\n  RadioGroupItemProvider as ItemProvider,\n  RadioGroupItemTrigger as ItemTrigger,\n  RadioGroupItemBubbleInput as ItemBubbleInput,\n  RadioGroupIndicator as Indicator,\n};\nexport type {\n  RadioGroupProps,\n  RadioGroupItemProps,\n  RadioGroupItemProviderProps,\n  RadioGroupItemTriggerProps,\n  RadioGroupItemBubbleInputProps,\n  RadioGroupIndicatorProps,\n};\n", "import * as React from 'react';\nimport { composeEventHandlers } from '@radix-ui/primitive';\nimport { useComposedRefs } from '@radix-ui/react-compose-refs';\nimport { createContextScope } from '@radix-ui/react-context';\nimport { useSize } from '@radix-ui/react-use-size';\nimport { Presence } from '@radix-ui/react-presence';\nimport { Primitive } from '@radix-ui/react-primitive';\n\nimport type { Scope } from '@radix-ui/react-context';\n\nconst RADIO_NAME = 'Radio';\n\ntype ScopedProps<P> = P & { __scopeRadio?: Scope };\nconst [createRadioContext, createRadioScope] = createContextScope(RADIO_NAME);\n\ntype RadioContextValue = {\n  checked: boolean;\n  disabled: boolean | undefined;\n  required: boolean | undefined;\n  name: string | undefined;\n  form: string | undefined;\n  value: string | number | readonly string[];\n  control: HTMLButtonElement | null;\n  setControl: React.Dispatch<React.SetStateAction<HTMLButtonElement | null>>;\n  hasConsumerStoppedPropagationRef: React.RefObject<boolean>;\n  userInteractionCount: number;\n  onUserInteraction: () => void;\n  isFormControl: boolean;\n  bubbleInput: HTMLInputElement | null;\n  setBubbleInput: React.Dispatch<React.SetStateAction<HTMLInputElement | null>>;\n  onCheck(): void;\n};\n\nconst [RadioProviderImpl, useRadioContext] = createRadioContext<RadioContextValue>(RADIO_NAME);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioProvider\n * -----------------------------------------------------------------------------------------------*/\n\ninterface RadioProviderProps {\n  checked?: boolean;\n  required?: boolean;\n  disabled?: boolean;\n  name?: string;\n  form?: string;\n  value?: string | number | readonly string[];\n  onCheck?(): void;\n  children?: React.ReactNode;\n}\n\nfunction RadioProvider(props: ScopedProps<RadioProviderProps>) {\n  const {\n    __scopeRadio,\n    checked = false,\n    children,\n    disabled,\n    form,\n    name,\n    onCheck,\n    required,\n    value = 'on',\n    // @ts-expect-error\n    internal_do_not_use_render,\n  } = props;\n\n  const [control, setControl] = React.useState<HTMLButtonElement | null>(null);\n  const [bubbleInput, setBubbleInput] = React.useState<HTMLInputElement | null>(null);\n  const hasConsumerStoppedPropagationRef = React.useRef(false);\n\n  // Incremented on every user interaction with the trigger. The bubble input\n  // compares this against the value it last handled to tell whether a `checked`\n  // change was driven by the user (vs. a controlled/programmatic update). Using\n  // a counter guarantees the marker is updated in the same commit as the\n  // resulting render, so it can never go stale and leak into a later\n  // programmatic update.\n  const [userInteractionCount, onUserInteraction] = React.useReducer(\n    (count: number): number => count + 1,\n    0,\n  );\n\n  const isFormControl = control\n    ? !!form || !!control.closest('form')\n    : // We set this to true by default so that events bubble to forms without JS (SSR)\n      true;\n\n  const context: RadioContextValue = {\n    checked,\n    disabled,\n    required,\n    name,\n    form,\n    value,\n    control,\n    setControl,\n    hasConsumerStoppedPropagationRef,\n    userInteractionCount,\n    onUserInteraction,\n    isFormControl,\n    bubbleInput,\n    setBubbleInput,\n    onCheck: () => onCheck?.(),\n  };\n\n  return (\n    <RadioProviderImpl scope={__scopeRadio} {...context}>\n      {isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children}\n    </RadioProviderImpl>\n  );\n}\n\n/* -------------------------------------------------------------------------------------------------\n * RadioTrigger\n * -----------------------------------------------------------------------------------------------*/\n\nconst TRIGGER_NAME = 'RadioTrigger';\n\ninterface RadioTriggerProps extends Omit<\n  React.ComponentPropsWithoutRef<typeof Primitive.button>,\n  keyof RadioProviderProps\n> {\n  children?: React.ReactNode;\n}\n\nconst RadioTrigger = /* @__PURE__ */ React.forwardRef<HTMLButtonElement, RadioTriggerProps>(\n  function RadioTrigger(\n    { __scopeRadio, onClick, ...radioProps }: ScopedProps<RadioTriggerProps>,\n    forwardedRef,\n  ) {\n    const {\n      checked,\n      disabled,\n      value,\n      setControl,\n      onCheck,\n      hasConsumerStoppedPropagationRef,\n      onUserInteraction,\n      isFormControl,\n      bubbleInput,\n    } = useRadioContext(TRIGGER_NAME, __scopeRadio);\n    const composedRefs = useComposedRefs(forwardedRef, setControl);\n\n    return (\n      <Primitive.button\n        type=\"button\"\n        role=\"radio\"\n        aria-checked={checked}\n        data-state={getState(checked)}\n        data-disabled={disabled ? '' : undefined}\n        disabled={disabled}\n        value={value}\n        {...radioProps}\n        ref={composedRefs}\n        onClick={composeEventHandlers(onClick, (event) => {\n          // radios cannot be unchecked so we only communicate a checked state.\n          // Only mark a user interaction when the click actually changes the\n          // value, otherwise re-selecting the checked radio would leave a stale\n          // interaction marker.\n          if (!checked) {\n            onUserInteraction();\n            onCheck();\n          }\n\n          if (bubbleInput && isFormControl) {\n            hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();\n            // if radio has a bubble input and is a form control, stop propagation\n            // from the button so that we only propagate one click event (from the\n            // input). We propagate changes from an input so that native form\n            // validation works and form events reflect radio updates.\n            if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();\n          }\n        })}\n      />\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * Radio\n * -----------------------------------------------------------------------------------------------*/\n\ntype RadioElement = React.ComponentRef<typeof Primitive.button>;\ntype PrimitiveButtonProps = React.ComponentPropsWithoutRef<typeof Primitive.button>;\ninterface RadioProps extends Omit<PrimitiveButtonProps, 'checked'> {\n  checked?: boolean;\n  required?: boolean;\n  onCheck?(): void;\n}\n\nconst Radio = /* @__PURE__ */ React.forwardRef<RadioElement, RadioProps>(\n  // blank line to reduce diff noise\n  function Radio(props: ScopedProps<RadioProps>, forwardedRef) {\n    const { __scopeRadio, name, checked, required, disabled, value, onCheck, form, ...radioProps } =\n      props;\n\n    return (\n      <RadioProvider\n        __scopeRadio={__scopeRadio}\n        checked={checked}\n        disabled={disabled}\n        required={required}\n        onCheck={onCheck}\n        name={name}\n        form={form}\n        value={value}\n        // @ts-expect-error\n        internal_do_not_use_render={({ isFormControl }: RadioContextValue) => (\n          <>\n            <RadioTrigger\n              {...radioProps}\n              ref={forwardedRef}\n              // @ts-expect-error\n              __scopeRadio={__scopeRadio}\n            />\n            {isFormControl && (\n              <RadioBubbleInput\n                // @ts-expect-error\n                __scopeRadio={__scopeRadio}\n              />\n            )}\n          </>\n        )}\n      />\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioIndicator\n * -----------------------------------------------------------------------------------------------*/\n\nconst INDICATOR_NAME = 'RadioIndicator';\n\ntype RadioIndicatorElement = React.ComponentRef<typeof Primitive.span>;\ntype PrimitiveSpanProps = React.ComponentPropsWithoutRef<typeof Primitive.span>;\nexport interface RadioIndicatorProps extends PrimitiveSpanProps {\n  /**\n   * Used to force mounting when more control is needed. Useful when\n   * controlling animation with React animation libraries.\n   */\n  forceMount?: true;\n}\n\nconst RadioIndicator = /* @__PURE__ */ React.forwardRef<RadioIndicatorElement, RadioIndicatorProps>(\n  function RadioIndicator(props: ScopedProps<RadioIndicatorProps>, forwardedRef) {\n    const { __scopeRadio, forceMount, ...indicatorProps } = props;\n    const context = useRadioContext(INDICATOR_NAME, __scopeRadio);\n    return (\n      <Presence present={forceMount || context.checked}>\n        <Primitive.span\n          data-state={getState(context.checked)}\n          data-disabled={context.disabled ? '' : undefined}\n          {...indicatorProps}\n          ref={forwardedRef}\n        />\n      </Presence>\n    );\n  },\n);\n\n/* -------------------------------------------------------------------------------------------------\n * RadioBubbleInput\n * -----------------------------------------------------------------------------------------------*/\n\nconst BUBBLE_INPUT_NAME = 'RadioBubbleInput';\n\ntype InputProps = React.ComponentPropsWithoutRef<typeof Primitive.input>;\ninterface RadioBubbleInputProps extends Omit<InputProps, 'checked'> {}\n\nconst RadioBubbleInput = /* @__PURE__ */ React.forwardRef<HTMLInputElement, RadioBubbleInputProps>(\n  function RadioBubbleInput(\n    { __scopeRadio, onClick, ...props }: ScopedProps<RadioBubbleInputProps>,\n    forwardedRef,\n  ) {\n    const {\n      control,\n      checked,\n      required,\n      disabled,\n      name,\n      value,\n      form,\n      bubbleInput,\n      setBubbleInput,\n      hasConsumerStoppedPropagationRef,\n      userInteractionCount,\n    } = useRadioContext(BUBBLE_INPUT_NAME, __scopeRadio);\n\n    const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);\n    const controlSize = useSize(control);\n    // When the checked change is not driven by a user interaction (e.g. a\n    // controlled `checked` update), the `click` event we dispatch to notify\n    // forms must not reach ancestor `onClick` handlers. We can't simply make it\n    // non-bubbling because React derives the radio's `change` event from a\n    // bubbling `click`. Instead we stop propagation of the synthetic click,\n    // which still lets the `change` event reach the form.\n    const shouldStopClickPropagationRef = React.useRef(false);\n    // The `checked` value we last synced to the input, and the interaction\n    // counter we last accounted for. Comparing against these lets us detect a\n    // genuine `checked` change and whether it followed a user interaction, even\n    // on renders caused by clicks that don't change `checked` (e.g. re-selecting\n    // a checked radio, or a controlled value that ignores the change).\n    const prevCheckedRef = React.useRef(checked);\n    const prevUserInteractionCountRef = React.useRef(userInteractionCount);\n\n    // Bubble checked change to parents (e.g form change event)\n    React.useEffect(() => {\n      const input = bubbleInput;\n      if (!input) return;\n\n      const inputProto = window.HTMLInputElement.prototype;\n      const descriptor = Object.getOwnPropertyDescriptor(\n        inputProto,\n        'checked',\n      ) as PropertyDescriptor;\n      const setChecked = descriptor.set;\n\n      const isUserInteraction = userInteractionCount !== prevUserInteractionCountRef.current;\n      prevUserInteractionCountRef.current = userInteractionCount;\n      const checkedChanged = prevCheckedRef.current !== checked;\n      prevCheckedRef.current = checked;\n\n      const bubbles = !(isUserInteraction && hasConsumerStoppedPropagationRef.current);\n      if (checkedChanged && setChecked) {\n        shouldStopClickPropagationRef.current = !isUserInteraction;\n        const event = new Event('click', { bubbles });\n        setChecked.call(input, checked);\n        input.dispatchEvent(event);\n        shouldStopClickPropagationRef.current = false;\n      }\n    }, [bubbleInput, checked, hasConsumerStoppedPropagationRef, userInteractionCount]);\n\n    const defaultCheckedRef = React.useRef(checked);\n    return (\n      <Primitive.input\n        type=\"radio\"\n        aria-hidden\n        defaultChecked={defaultCheckedRef.current}\n        required={required}\n        disabled={disabled}\n        name={name}\n        value={value}\n        form={form}\n        {...props}\n        tabIndex={-1}\n        ref={composedRefs}\n        onClick={composeEventHandlers(onClick, (event) => {\n          // Prevent the synthetic click dispatched on controlled/programmatic\n          // updates from triggering ancestor `onClick` handlers, while still\n          // allowing the resulting `change` event to reach the form.\n          if (shouldStopClickPropagationRef.current) {\n            event.stopPropagation();\n          }\n        })}\n        style={{\n          ...props.style,\n          ...controlSize,\n          position: 'absolute',\n          pointerEvents: 'none',\n          opacity: 0,\n          margin: 0,\n          // We transform because the input is absolutely positioned but we have\n          // rendered it **after** the button. This pulls it back to sit on top\n          // of the button.\n          transform: 'translateX(-100%)',\n        }}\n      />\n    );\n  },\n);\n\n/* ---------------------------------------------------------------------------------------------- */\n\nfunction isFunction(value: unknown): value is (...args: any[]) => any {\n  return typeof value === 'function';\n}\n\nfunction getState(checked: boolean) {\n  return checked ? 'checked' : 'unchecked';\n}\n\nexport {\n  createRadioScope,\n  useRadioContext,\n  //\n  Radio,\n  RadioProvider,\n  RadioTrigger,\n  RadioIndicator,\n  RadioBubbleInput,\n};\nexport type { RadioProps, RadioProviderProps, RadioTriggerProps, RadioBubbleInputProps };\n"],
  "mappings":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,SAAO,gBAAAT,KAAC,oBAAkB,GAAG,YAAa,GAAG,aAAa,KAAK,cAAc;AAC/E,GAPE,4BAOD;AAUD,IAAM,sBAAsC,gBAAM;AAAA;AAAA,EAKhD,gCAASU,qBAAoB,OAA8C,cAAc;AACvF,UAAM,EAAE,mBAAmB,GAAG,eAAe,IAAI;AACjD,UAAM,aAAa,cAAc,iBAAiB;AAClD,WAAO,gBAAAV,KAAC,kBAAgB,GAAG,YAAa,GAAG,gBAAgB,KAAK,cAAc;AAAA,EAChF,GAJA;AAKF;",
  "names": ["React", "composeEventHandlers", "useComposedRefs", "createContextScope", "Primitive", "RadioTrigger", "RadioIndicator", "RadioBubbleInput", "Fragment", "jsx", "jsxs", "createContextScope", "RadioGroup", "useComposedRefs", "Primitive", "RadioGroupItemTrigger", "composeEventHandlers", "RadioGroupItem", "RadioGroupItemBubbleInput", "RadioGroupIndicator"]
}
