{"version":3,"names":["dynamic","createMemo","omit","onCleanup","Show","untrack","useBaseUiId","mergeRootProps","resolveClassStyle","useIsoLayoutEffect","useToastRootContext","ToastDescription","props","ctx","id","undefined","content","children","toast","description","shouldRender","value","show","setDescriptionId","descriptionId","userClassStyle","type","userHtmlProps","descriptionProps","data-type","Tag","as"],"sources":["toast-description.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic } from \"@solidjs/web\";\nimport { createMemo, omit, onCleanup, Show, untrack } from \"solid-js\";\nimport { useBaseUiId } from \"../../internals/base-ui-id\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport { useIsoLayoutEffect } from \"../../internals/use-iso-layout-effect\";\nimport { useToastRootContext } from \"../root/toast-root-context\";\n\nexport interface ToastDescriptionState {\n\t/** The toast's `type` slot (forwarded from the toast object). */\n\ttype: string | undefined;\n}\n\nexport interface ToastDescriptionProps\n\textends BaseUIComponentProps<\"p\", ToastDescriptionState> {\n\t/** Tag/component to render. Defaults to `\"p\"`. */\n\tas?: ValidComponent;\n}\n\n/**\n * The toast's description. Renders a `<p>` by default and registers its\n * id with `<Toast.Root>` so the root emits `aria-describedby`.\n */\nexport function ToastDescription(props: ToastDescriptionProps): JSX.Element {\n\tconst ctx = useToastRootContext();\n\n\tconst id = useBaseUiId(\n\t\ttypeof untrack(() => props.id) === \"string\"\n\t\t\t? (untrack(() => props.id) as string)\n\t\t\t: undefined,\n\t);\n\n\tconst content = createMemo((): JSX.Element | string | undefined => {\n\t\tif (props.children != null) return props.children as JSX.Element;\n\t\treturn ctx.toast().description as JSX.Element | string | undefined;\n\t});\n\n\tconst shouldRender = createMemo(() => {\n\t\tconst value = content();\n\t\treturn value != null && value !== \"\";\n\t});\n\n\tuseIsoLayoutEffect(\n\t\t() => shouldRender(),\n\t\t(show) => {\n\t\t\tif (show) ctx.setDescriptionId(id);\n\t\t\telse if (untrack(ctx.descriptionId) === id)\n\t\t\t\tctx.setDescriptionId(undefined);\n\t\t},\n\t);\n\n\tonCleanup(() => {\n\t\tif (untrack(ctx.descriptionId) === id) ctx.setDescriptionId(undefined);\n\t});\n\tconst userClassStyle = resolveClassStyle(props, () => ({\n\t\ttype: ctx.toast().type,\n\t}));\n\n\tconst userHtmlProps = omit(\n\t\tprops,\n\t\t\"as\",\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"children\",\n\t) as Record<string, unknown>;\n\n\t// Plain object — NOT a memo. The bag's getters keep `data-type` / children\n\t// reactive across the spread, so the merge itself reads nothing reactive\n\t// and a memo would add no dependency; worse, reading that memo back in the\n\t// untracked component body trips `[STRICT_READ_UNTRACKED]`. Spread a\n\t// pre-bound variable, not an inline call (`{...mergeRootProps(...)}`), so\n\t// the SSR compiler doesn't take its lazy-thunk path (attribute drop +\n\t// hydration-key shift). See `collapsible-root.tsx`.\n\tconst descriptionProps = mergeRootProps(\n\t\tmergeRootProps(\n\t\t\t{\n\t\t\t\tid,\n\t\t\t\tget \"data-type\"() {\n\t\t\t\t\treturn ctx.toast().type;\n\t\t\t\t},\n\t\t\t\tget children() {\n\t\t\t\t\treturn content();\n\t\t\t\t},\n\t\t\t},\n\t\t\tuserClassStyle,\n\t\t),\n\t\tuserHtmlProps,\n\t);\n\n\tconst Tag = dynamic(() => props.as ?? \"p\");\n\treturn (\n\t\t<Show when={shouldRender()}>\n\t\t\t<Tag {...descriptionProps} />\n\t\t</Show>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,QAAQ,cAAc;AACtC,SAASC,UAAU,EAAEC,IAAI,EAAEC,SAAS,EAAEC,IAAI,EAAEC,OAAO,QAAQ,UAAU;AACrE,SAASC,WAAW,QAAQ,4BAA4B;AACxD,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AAEvE,SAASC,kBAAkB,QAAQ,uCAAuC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