{"version":3,"names":["createMemo","omit","untrack","InternalBackdrop","props","style","cutout","clipPath","rect","getBoundingClientRect","left","top","bottom","right","position","inset","rest","handleRef","el","r","ref"],"sources":["internal-backdrop.tsx"],"sourcesContent":["import type { JSX } from \"@solidjs/web\";\n/**\n * Solid port of Base UI React's `InternalBackdrop`\n * (`packages/react/src/utils/InternalBackdrop.tsx`).\n *\n * Full-viewport backdrop for modal popups, with optional `cutout` — a\n * DOM element whose rectangle is cut out of the backdrop via `clip-path`\n * so it remains interactive (useful for letting a trigger stay clickable\n * while the rest of the page is covered).\n *\n * Port notes:\n *  - React's `forwardRef` is replaced with a plain `ref` prop the\n *    consumer hands a callback to (Solid ref syntax).\n *  - `React.HTMLAttributes<HTMLDivElement>` → `JSX.HTMLAttributes<HTMLDivElement>`.\n *  - Style is a Solid `JSX.CSSProperties` literal. React's camelCase\n *    `WebkitUserSelect` becomes the Solid-style `-webkit-user-select`\n *    key because Solid forwards CSS-property keys verbatim.\n */\n\nimport { createMemo, omit, untrack } from \"solid-js\";\n\nexport type InternalBackdropState = Record<string, never>;\n\nexport interface InternalBackdropProps\n\textends JSX.HTMLAttributes<HTMLDivElement> {\n\t/**\n\t * The element to cut out of the backdrop.\n\t * This is useful for allowing certain elements to be interactive while\n\t * the backdrop is present.\n\t */\n\tcutout?: Element | null | undefined;\n\tref?: ((el: HTMLDivElement) => void) | HTMLDivElement | undefined;\n}\n\n/**\n * @internal\n */\nexport function InternalBackdrop(props: InternalBackdropProps): JSX.Element {\n\t// Memoize so the proxy read of `props.cutout` happens inside a tracked\n\t// scope, not synchronously in the component body (which is wrapped in\n\t// Solid 2's `untrack(label)` strict-read shell).\n\tconst style = createMemo<JSX.CSSProperties>(() => {\n\t\tconst cutout = props.cutout;\n\t\tlet clipPath: string | undefined;\n\t\tif (cutout) {\n\t\t\tconst rect = cutout.getBoundingClientRect();\n\t\t\tclipPath = `polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${rect.left}px ${rect.top}px,${rect.left}px ${rect.bottom}px,${rect.right}px ${rect.bottom}px,${rect.right}px ${rect.top}px,${rect.left}px ${rect.top}px)`;\n\t\t}\n\t\treturn {\n\t\t\tposition: \"fixed\",\n\t\t\tinset: 0,\n\t\t\t\"user-select\": \"none\",\n\t\t\t\"-webkit-user-select\": \"none\",\n\t\t\t\"clip-path\": clipPath,\n\t\t};\n\t});\n\n\t// Explicitly strip `cutout` and `ref` before spreading so they don't land\n\t// on the DOM as unknown attributes. `omit` returns a reactive proxy that\n\t// defers reads until Solid's spread-effect runs in a tracked scope,\n\t// avoiding `[STRICT_READ_UNTRACKED]` warnings from synchronous body reads.\n\tconst rest = omit(props, \"cutout\", \"ref\");\n\n\t// Ref forwarder — Solid web's `applyRef` invokes this callback inside\n\t// `runWithOwner` of the InternalBackdrop body, which inherits the\n\t// `strictRead` label. The `props.ref` read is a one-shot snapshot at\n\t// mount; `untrack` keeps it out of the strict-read shell.\n\tconst handleRef = (el: HTMLDivElement): void => {\n\t\tconst r = untrack(() => props.ref);\n\t\tif (typeof r === \"function\") {\n\t\t\t(r as (el: HTMLDivElement) => void)(el);\n\t\t}\n\t\t// Object refs (`{ current }`) aren't part of this hook's contract —\n\t\t// callers always pass a function.\n\t};\n\n\treturn (\n\t\t<div\n\t\t\tref={handleRef}\n\t\t\trole=\"presentation\"\n\t\t\t// Ensures Floating UI's outside press detection runs, as it considers\n\t\t\t// it an element that existed when the popup rendered.\n\t\t\tdata-quoin-inert=\"\"\n\t\t\t{...rest}\n\t\t\tstyle={style()}\n\t\t/>\n\t);\n}\n\nexport namespace InternalBackdrop {\n\texport type State = InternalBackdropState;\n\texport type Props = InternalBackdropProps;\n}\n"],"mappings":"AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,EAAEC,IAAI,EAAEC,OAAO,QAAQ,UAAU;AAepD;AACA;AACA;AACA,OAAO,SAASC,gBAAgBA,CAACC,K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