{"version":3,"names":["dynamic","isServer","omit","onCleanup","untrack","useCspDisableStyleElements","useCspNonce","composeRefs","userRef","mergeRootProps","resolveClassStyle","registerDisableScrollbarStyle","createScrollArea","ScrollAreaRootContext","ScrollAreaRoot","props","nonce","disableStyleElements","c","overflowEdgeThreshold","dispose","rootRef","current","userStyling","viewportState","userProps","styledUserProps","rootProps","root","Tag","as","bindRoot","children"],"sources":["scroll-area-root.tsx"],"sourcesContent":["import type { JSX, ValidComponent } from \"@solidjs/web\";\nimport { dynamic, isServer } from \"@solidjs/web\";\nimport { omit, onCleanup, untrack } from \"solid-js\";\nimport {\n\tuseCspDisableStyleElements,\n\tuseCspNonce,\n} from \"../../csp-provider/csp-context.ts\";\nimport { composeRefs, userRef } from \"../../internals/compose-refs\";\nimport { mergeRootProps } from \"../../internals/merge-root-props\";\nimport { resolveClassStyle } from \"../../internals/resolve-class-style\";\nimport { registerDisableScrollbarStyle } from \"../../internals/scroll-area-utils/register-disable-scrollbar-style.ts\";\nimport type { BaseUIComponentProps } from \"../../internals/types\";\nimport {\n\tcreateScrollArea,\n\ttype OverflowEdgeThresholdInput,\n} from \"./create-scroll-area.tsx\";\nimport type {\n\tCoords,\n\tHiddenState,\n\tOverflowEdges,\n\tOverflowEdgeThreshold,\n\tScrollAreaRootState,\n\tSize,\n} from \"./scroll-area-root-context.ts\";\nimport { ScrollAreaRootContext } from \"./scroll-area-root-context.ts\";\n\nexport type {\n\tCoords,\n\tHiddenState,\n\tOverflowEdges,\n\tOverflowEdgeThreshold,\n\tScrollAreaRootState,\n\tSize,\n};\n\nexport interface ScrollAreaRootProps\n\textends BaseUIComponentProps<\"div\", ScrollAreaRootState> {\n\t/** Tag/component to render. Defaults to `\"div\"`. */\n\tas?: ValidComponent;\n\t/**\n\t * Threshold in pixels that must be exceeded before the overflow-edge\n\t * attributes are applied. Accepts a number (applied to all four edges)\n\t * or a partial per-edge object.\n\t * @default 0\n\t */\n\toverflowEdgeThreshold?: OverflowEdgeThresholdInput;\n}\n\n/**\n * Groups all parts of the scroll area. Renders a `<div>` element.\n *\n * Thin structural adapter over {@link createScrollArea} — the root's reactive\n * state, element refs, derived state, and shared pointer/scroll handlers all\n * live in the primitive (which IS the value published to descendants via the\n * root context). This wrapper maps props → options, registers the shared\n * disable-scrollbar `<style>` against the owning document (ref-counted, CSP\n * nonce-carrying), and renders the presentation `<div>` with the api's\n * `root()` slot.\n */\nexport function ScrollAreaRoot(props: ScrollAreaRootProps): JSX.Element {\n\tconst nonce = useCspNonce();\n\tconst disableStyleElements = useCspDisableStyleElements();\n\n\tconst c = createScrollArea({\n\t\toverflowEdgeThreshold: () => props.overflowEdgeThreshold,\n\t});\n\n\t// Register the shared disable-scrollbar stylesheet against the owning\n\t// document. Ref-counted — the first root in the document injects the\n\t// `<style>`, subsequent roots share it, and the last unmount removes it.\n\t// `disableStyleElements` opts out entirely. `disableStyleElements()` /\n\t// `nonce()` are read once at setup; `untrack` keeps those snapshot reads\n\t// out of the component-body strict-read shell. Skipped on the server —\n\t// the registration touches `document` directly (it runs in the component\n\t// body, not an effect), and the disable-scrollbar style is purely a\n\t// client-side scrollbar-suppression concern with nothing to serialize.\n\tuntrack(() => {\n\t\tif (!isServer && !disableStyleElements()) {\n\t\t\tconst dispose = registerDisableScrollbarStyle(c.rootRef.current, nonce());\n\t\t\tonCleanup(dispose);\n\t\t}\n\t});\n\n\tconst userStyling = resolveClassStyle(props, () => c.viewportState());\n\tconst userProps = omit(\n\t\tprops,\n\t\t\"class\",\n\t\t\"style\",\n\t\t\"attrs\",\n\t\t\"as\",\n\t\t\"children\",\n\t\t\"overflowEdgeThreshold\",\n\t);\n\tconst styledUserProps = mergeRootProps(userStyling, userProps);\n\n\t// Bind the slot bag to a `const` before the JSX spread — hydration-critical.\n\t// Spreading an inline call (`{...c.root(...)}`) makes the Solid SSR compiler\n\t// wrap it in a lazy thunk whose server-side resolution diverges from the\n\t// client's, dropping attributes from the SSR markup and shifting hydration\n\t// keys. A pre-bound variable spread is passed straight through. See\n\t// `collapsible-root.tsx` for the full explanation.\n\tconst rootProps = c.root(styledUserProps);\n\n\tconst Tag = dynamic(() => props.as ?? \"div\");\n\treturn (\n\t\t<Tag {...rootProps} ref={composeRefs(c.bindRoot, userRef(props))}>\n\t\t\t<ScrollAreaRootContext value={c}>{props.children}</ScrollAreaRootContext>\n\t\t</Tag>\n\t);\n}\n"],"mappings":"AACA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,cAAc;AAChD,SAASC,IAAI,EAAEC,SAAS,EAAEC,OAAO,QAAQ,UAAU;AACnD,SACCC,0BAA0B,EAC1BC,WAAW,QACL,mCAAmC;AAC1C,SAASC,WAAW,EAAEC,OAAO,QAAQ,8BAA8B;AACnE,SAASC,cAAc,QAAQ,kCAAkC;AACjE,SAASC,iBAAiB,QAAQ,qCAAqC;AACvE,SAASC,6BAA6B,QAAQ,uEAAuE;AAErH,SACCC,gBAAgB,QAEV,0BAA0B;AASjC,SAASC,qBAAqB,QAAQ,+BAA+B;AAwBrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAe;EACvE,MAAMC,KAAK,GAAGV,WAAW,CAAC,CAAC;EAC3B,MAAMW,oBAAoB,GAAGZ,0BAA0B,CAAC,CAAC;EAEzD,MAAMa,CAAC,GAAGN,gBAAgB,CAAC;IAC1BO,qBAAqB,EAAEA,CAAA,KAAMJ,KAAK,CAACI;EACpC,CAAC,CAAC;;EAEF;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACAf,OAAO,CAAC,MAAM;IACb,IAAI,CAACH,QAAQ,IAAI,CAACgB,oBAAoB,CAAC,CAAC,EAAE;MACzC,MAAMG,OAAO,GAAGT,6BAA6B,CAACO,CAAC,CAACG,OAAO,CAACC,OAAO,EAAEN,KAAK,CAAC,CAAC,CAAC;MACzEb,SAAS,CAACiB,OAAO,CAAC;IACnB;EACD,CAAC,CAAC;EAEF,MAAMG,WAAW,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