{
  "version": 3,
  "sources": ["../../src/modules/address-render/components/favorite/FavoriteIconButton.tsx", "../../src/modules/address-render/components/lib/FavoriteItemEvent.ts", "../../src/modules/address-render/components/favorite/FavoriteToggleSVG.tsx", "../../src/modules/address-render/components/favorite/lib/PopperId.ts", "../../src/modules/address-render/components/favorite/Popper.tsx", "../../src/modules/address-render/components/favorite/PopperButtonGroup.tsx", "../../src/modules/address-render/components/RenderRowBox.tsx"],
  "sourcesContent": ["import { useResetState } from '@ariestools/sdk-react/hooks'\nimport type { IconButtonProps } from '@mui/material'\nimport { IconButton, styled } from '@mui/material'\nimport type {\n  MouseEvent, PropsWithChildren, TouchEvent,\n} from 'react'\nimport React, { useRef, useState } from 'react'\n\nimport { useEvent } from '#event'\nimport { useShareForwardedRef } from '#shared'\n\nimport type { FavoriteItemEvent } from '../lib/index.ts'\nimport { generateFavoriteEvent } from '../lib/index.ts'\nimport { FavoriteToggleSVG } from './FavoriteToggleSVG.tsx'\nimport { popperId } from './lib/index.ts'\nimport { FavoritePopper } from './Popper.tsx'\n\n/** Props for {@link FavoriteIconButton}. */\nexport interface FavoriteIconButtonProps extends PropsWithChildren, IconButtonProps {\n  favorite?: FavoriteItemEvent['favorite']\n  name?: FavoriteItemEvent['name']\n  value?: string\n  valueType?: FavoriteItemEvent['favoriteType']\n}\n\n/** Icon button that toggles favorites and opens the favorite name popper. */\nexport const FavoriteIconButton = ({\n  ref, children, favorite: favoriteProp, name, valueType, value, ...props\n}: FavoriteIconButtonProps & { ref?: React.RefObject<HTMLButtonElement | null> }) => {\n  const [openPopper, setOpenPopper] = useState(false)\n\n  const [favorite, setFavorite] = useResetState(favoriteProp)\n\n  const sharedRef = useShareForwardedRef(ref)\n  const [buttonRef, dispatch] = useEvent(undefined, sharedRef)\n\n  const onConfirmFavorite = (name?: string, newFavoriteState?: boolean) => {\n    const favoriteEvent = generateFavoriteEvent(!!newFavoriteState, valueType, value, name)\n    dispatch('address', 'favorite', JSON.stringify(favoriteEvent))\n    setFavorite(newFavoriteState)\n    setOpenPopper(false)\n  }\n\n  const starRef = useRef<HTMLSpanElement>(null)\n\n  return (\n    <IconButtonCondensed\n      aria-describedby={popperId}\n      ref={buttonRef}\n      onClick={(event: MouseEvent) => {\n        event.stopPropagation()\n        setOpenPopper(!openPopper)\n      }}\n      onTouchStart={(event: TouchEvent) => {\n        event.stopPropagation()\n        setOpenPopper(!openPopper)\n      }}\n      onMouseDown={(event: MouseEvent) => event.stopPropagation()}\n      sx={{ lineHeight: 0, p: 0.25 }}\n      {...props}\n    >\n      <span ref={starRef}>\n        <FavoriteToggleSVG favorite={favorite} />\n      </span>\n      <FavoritePopper\n        sx={{ zIndex: 1301 }}\n        name={name}\n        favorite={favorite}\n        favoriteRef={starRef}\n        open={openPopper}\n        onConfirmFavorite={onConfirmFavorite}\n        onClickAway={() => setOpenPopper(false)}\n      />\n      {children}\n    </IconButtonCondensed>\n  )\n}\n\nFavoriteIconButton.displayName = 'FavoriteIconButton'\n\nconst IconButtonCondensed = styled(IconButton, { name: 'IconButtonCondensed' })(({ theme }) => ({\n  lineHeight: 0,\n  padding: theme.spacing(0.25),\n}))\n", "/** Event payload for favoriting an address, schema, or hash. */\nexport interface FavoriteItemEvent {\n  favorite?: boolean\n  favoriteType?: FavoriteType\n  favoriteValue?: string\n  name?: string\n}\n\n/** Kind of entity that can be marked as a favorite. */\nexport type FavoriteType = 'address' | 'schema' | 'hash'\n\n/** Builds a {@link FavoriteItemEvent} from favorite state and identity fields. */\nexport const generateFavoriteEvent = (favorite?: boolean, favoriteType?: FavoriteType, favoriteValue?: string, name?: string): FavoriteItemEvent => ({\n  favorite: !!favorite,\n  favoriteType,\n  favoriteValue,\n  name,\n})\n", "import { Star as StarIcon, StarBorder as StarBorderIcon } from '@mui/icons-material'\nimport React from 'react'\n\n/** Star icon that reflects whether an item is favorited. */\nexport const FavoriteToggleSVG: React.FC<{ favorite?: boolean }> = ({ favorite }) => (\n  <>\n    {favorite\n      ? <StarIcon className=\"favorite-icon\" component=\"svg\" color=\"secondary\" fontSize=\"small\" />\n      : <StarBorderIcon className=\"favorite-icon\" fontSize=\"small\" />}\n  </>\n)\n", "/** DOM id for the favorite popper element. */\nexport const popperId = 'favorite-popper'\n", "import type { PopperProps } from '@mui/material'\nimport {\n  Card, CardContent, ClickAwayListener, Fade, Popper, TextField,\n} from '@mui/material'\nimport type { RefObject } from 'react'\nimport React, { useLayoutEffect, useState } from 'react'\n\nimport { popperId } from './lib/index.ts'\nimport { PopperButtonGroup } from './PopperButtonGroup.tsx'\n\n/** Props for {@link FavoritePopper}. */\nexport interface FavoritePopperProps extends PopperProps {\n  favorite?: boolean\n  favoriteRef?: RefObject<HTMLElement | null>\n  name?: string\n  onClickAway?: (event: MouseEvent | TouchEvent) => void\n  onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\n\n/** Popper UI for naming and confirming a favorite item. */\nexport const FavoritePopper = (\n  {\n    ref, name: nameProp, favorite, favoriteRef, onClickAway, onConfirmFavorite, ...props\n  }: FavoritePopperProps,\n) => {\n  const [name, setName] = useState(() => nameProp)\n  const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null)\n\n  useLayoutEffect(() => {\n    // eslint-disable-next-line react-x/set-state-in-effect\n    setAnchorEl(favoriteRef?.current ?? null)\n  }, [favoriteRef])\n\n  return (\n    <ClickAwayListener onClickAway={onClickAway ?? (() => null)}>\n      <Popper\n        id={popperId}\n        anchorEl={anchorEl}\n        onClick={e => e.stopPropagation()}\n        onTouchStart={e => e.stopPropagation()}\n        transition\n        style={{ zIndex: 9999 }}\n        ref={ref}\n        {...props}\n      >\n        {({ TransitionProps }) => (\n          <Fade {...TransitionProps} timeout={350}>\n            <Card>\n              <CardContent sx={{ display: 'flex', gap: 1 }}>\n                <TextField\n                  autoFocus\n                  label=\"Favorite Name\"\n                  placeholder=\"optional\"\n                  size=\"small\"\n                  value={name ?? ''}\n                  onChange={e => setName(e.target.value)}\n                />\n                <PopperButtonGroup favorite={favorite} onConfirmFavorite={onConfirmFavorite} name={name} />\n              </CardContent>\n            </Card>\n          </Fade>\n        )}\n      </Popper>\n    </ClickAwayListener>\n  )\n}\n\nFavoritePopper.displayName = 'FavoritePopper'\n", "import { Delete as DeleteIcon, Star as StarIcon } from '@mui/icons-material'\nimport type { ButtonGroupProps } from '@mui/material'\nimport { Button, ButtonGroup } from '@mui/material'\nimport React from 'react'\n\n/** Props for {@link PopperButtonGroup}. */\nexport interface FavoritePopperProps extends ButtonGroupProps {\n  favorite?: boolean\n  name?: string\n  onConfirmFavorite?: (name?: string, newFavoriteState?: boolean) => void\n}\n\n/** Button group to confirm or remove a favorite from the favorite popper. */\nexport const PopperButtonGroup: React.FC<FavoritePopperProps> = ({\n  name, onConfirmFavorite, favorite, ...props\n}) => {\n  return (\n    <ButtonGroup {...props}>\n      <Button\n        title=\"Save Favorite\"\n        variant=\"contained\"\n        onClick={(e) => {\n          e.stopPropagation()\n          onConfirmFavorite?.(name, true)\n        }}\n      >\n        <StarIcon />\n      </Button>\n      {favorite\n        ? (\n            <Button\n              title=\"Remove Favorite\"\n              variant=\"contained\"\n              onClick={(e) => {\n                e.stopPropagation()\n                onConfirmFavorite?.(name, false)\n              }}\n            >\n              <DeleteIcon />\n            </Button>\n          )\n        : null}\n    </ButtonGroup>\n  )\n}\n", "import type { FlexBoxProps } from '@ariestools/sdk-react/flexbox'\nimport { FlexRow } from '@ariestools/sdk-react/flexbox'\nimport { Identicon } from '@ariestools/sdk-react/identicon'\nimport { ListItemIcon, useTheme } from '@mui/material'\nimport React from 'react'\n\nimport { useEvent } from '#event'\nimport { EllipsizeBox, useShareForwardedRef } from '#shared'\n\nimport { FavoriteIconButton } from './favorite/index.ts'\n\n/** Props for {@link AddressRenderRowBox}. */\nexport interface AddressRenderRowBoxProps extends FlexBoxProps {\n  address?: string | null\n  disableSharedRef?: boolean\n  favorite?: boolean\n  iconOnly?: boolean\n  iconSize?: number\n  icons?: boolean\n  name?: string\n  showFavorite?: boolean\n}\n\n/** Renders an address row with optional identicon, name, and favorite control. */\nexport const AddressRenderRowBox = (\n  {\n    ref, address, children, disableSharedRef, favorite: favoriteProp = false, iconOnly, iconSize = 24, icons, name, showFavorite = false, ...props\n  }: AddressRenderRowBoxProps & { ref?: React.RefObject<HTMLElement | null> },\n) => {\n  const theme = useTheme()\n\n  const sharedRef = useShareForwardedRef(ref)\n  const [elementRef, dispatch] = useEvent(undefined, sharedRef)\n\n  return (\n    <FlexRow\n      ref={elementRef}\n      onClick={() => {\n        if (address) {\n          dispatch('address', 'click', address)\n        }\n      }}\n      {...props}\n      sx={[{\n        gap: 2,\n        justifyContent: 'flex-start',\n      }, ...(Array.isArray(props.sx) ? props.sx : [props.sx])]}\n    >\n      {icons && address\n        ? (\n            <ListItemIcon sx={{ minWidth: 0 }}>\n              <Identicon size={iconSize} value={address} />\n            </ListItemIcon>\n          )\n        : null}\n      {iconOnly\n        ? null\n        : (\n            <EllipsizeBox\n              disableSharedRef={disableSharedRef}\n              ellipsisPosition=\"end\"\n              typographyProps={{ sx: { fontSize: theme.typography.body1.fontSize } }}\n              sx={{ width: '100%' }}\n            >\n              {name ?? address}\n            </EllipsizeBox>\n          )}\n      {children}\n      {showFavorite && address\n        ? <FavoriteIconButton name={name} size=\"small\" value={address} valueType=\"address\" favorite={favoriteProp} />\n        : null}\n    </FlexRow>\n  )\n}\n\nAddressRenderRowBox.displayName = 'AddressRenderRowBox'\n"],
  "mappings": ";AAAA,SAAS,qBAAqB;AAE9B,SAAS,YAAY,cAAc;AAInC,SAAgB,QAAQ,YAAAA,iBAAgB;AAExC,SAAS,gBAAgB;AACzB,SAAS,4BAA4B;;;ACG9B,IAAM,wBAAwB,CAAC,UAAoB,cAA6B,eAAwB,UAAsC;AAAA,EACnJ,UAAU,CAAC,CAAC;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AACF;;;ACjBA,SAAS,QAAQ,UAAU,cAAc,sBAAsB;AAK7D,mBAEM,WAFN;AADK,IAAM,oBAAsD,CAAC,EAAE,SA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