{"version":3,"names":["dynamic","omit","mergeRootProps","resolveClassStyle","AvatarRootContext","createAvatar","AvatarRoot","props","c","contextValue","imageLoadingStatus","setImageLoadingStatus","userStyling","userHtmlProps","styledUserProps","merged","Tag","as"],"sources":["avatar-root.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { omit } from \"solid-js\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport {\n\tAvatarRootContext,\n\ttype AvatarRootContextValue,\n\ttype ImageLoadingStatus,\n} from \"../avatar-root-context\";\nimport { createAvatar } from \"../create-avatar.tsx\";\n\nexport interface AvatarRootState {\n\t/** The current image-loading status bubbled up from `<Avatar.Image>`. */\n\timageLoadingStatus: ImageLoadingStatus;\n}\n\nexport interface AvatarRootProps\n\textends BaseUIComponentProps<\"span\", AvatarRootState> {\n\t/** Tag/component to render. Defaults to `\"span\"`. */\n\tas?: ValidComponent;\n}\n\n/**\n * Displays a user's profile picture, initials, or fallback icon.\n * Renders a `<span>` element (or `as` override).\n *\n * Base UI React maps `imageLoadingStatus` to `null` so no `data-*` attribute\n * is emitted for it on the root.\n */\nexport function AvatarRoot(props: AvatarRootProps): JSX.Element {\n\t// Compose the headless primitive — it owns the imageLoadingStatus signal\n\t// that `<Avatar.Image>` writes into from its load/error handlers.\n\tconst c = createAvatar();\n\n\tconst contextValue: AvatarRootContextValue = {\n\t\timageLoadingStatus: c.imageLoadingStatus,\n\t\tsetImageLoadingStatus: c.setImageLoadingStatus,\n\t};\n\n\tconst userStyling = resolveClassStyle(props, () => ({\n\t\timageLoadingStatus: c.imageLoadingStatus(),\n\t}));\n\n\tconst userHtmlProps = omit(props, \"class\", \"style\", \"attrs\", \"as\") as Record<\n\t\tstring,\n\t\tunknown\n\t>;\n\tconst styledUserProps = mergeRootProps(userStyling, userHtmlProps);\n\n\tconst merged = mergeRootProps({}, styledUserProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"span\");\n\treturn (\n\t\t<AvatarRootContext value={contextValue}>\n\t\t\t<Tag {...merged} />\n\t\t</AvatarRootContext>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SACCC,iBAAiB,QAGX,wBAAwB;AAC/B,SAASC,YAAY,QAAQ,sBAAsB;AAanD;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,UAAUA,CAACC,KAAsB,EAAe;EAC/D;EACA;EACA,MAAMC,CAAC,GAAGH,YAAY,CAAC,CAAC;EAExB,MAAMI,YAAoC,GAAG;IAC5CC,kBAAkB,EAAEF,CAAC,CAACE,kBAAkB;IACxCC,qBAAqB,EAAEH,CAAC,CAACG;EAC1B,CAAC;EAED,MAAMC,WAAW,GAAGT,iBAAiB,CAACI,KAAK,EAAE,OAAO;IACnDG,kBAAkB,EAAEF,CAAC,CAACE,kBAAkB,CAAC;EAC1C,CAAC,CAAC,CAAC;EAEH,MAAMG,aAAa,GAAGZ,IAAI,CAACM,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,CAGhE;EACD,MAAMO,eAAe,GAAGZ,cAAc,CAACU,WAAW,EAAEC,aAAa,CAAC;EAElE,MAAME,MAAM,GAAGb,cAAc,CAAC,CAAC,CAAC,EAAEY,eAAe,CAAC;EAElD,MAAME,GAAG,GAAGhB,OAAO,CAAC,MAAMO,KAAK,CAACU,EAAE,IAAI,MAAM,CAAC;EAC7C,OACC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAACR,YAAY,CAAC;AACzC,GAAG,CAAC,GAAG,CAAC,IAAIM,MAAM,CAAC;AACnB,EAAE,EAAE,iBAAiB,CAAC;AAEtB","ignoreList":[]}