{"version":3,"names":["createContext","useContext","NOOP_NONCE","undefined","NOOP_DISABLE_STYLE","NOOP_CSP_CONTEXT","nonce","disableStyleElements","CSPContext","useCSPContext","useCspNonce","useCspDisableStyleElements"],"sources":["csp-context.ts"],"sourcesContent":["import { type Accessor, createContext, useContext } from \"solid-js\";\n\n/**\n * The value handed down by `<CSPProvider>` to its descendants.\n *\n * `nonce` is an accessor so a parent that updates `props.nonce` is observed\n * by consumers without them needing to subscribe to an outer signal — this\n * keeps the shape consistent with the other Base UI internal contexts (see\n * `field-context.ts`) and avoids the top-level reactive-read warning in\n * Solid 2.\n *\n * `disableStyleElements` mirrors React Base UI's CSP context flag: when\n * `true`, components skip injecting inline `<style>` tags (e.g. the\n * scroll-area's disable-scrollbar stylesheet). Callers opt in when their\n * CSP forbids inline style elements even with a nonce, and provide the\n * styles through an external stylesheet instead.\n */\nexport interface CSPContextValue {\n\tnonce: Accessor<string | undefined>;\n\tdisableStyleElements: Accessor<boolean>;\n}\n\nconst NOOP_NONCE = (): undefined => undefined;\nconst NOOP_DISABLE_STYLE = (): false => false;\n\nexport const NOOP_CSP_CONTEXT: CSPContextValue = {\n\tnonce: NOOP_NONCE,\n\tdisableStyleElements: NOOP_DISABLE_STYLE,\n};\n\n/**\n * Context carrying the CSP nonce. Provide it with `<CSPContext value={...}>`\n * (Solid 2's context-as-provider pattern — there is no `.Provider`).\n */\nexport const CSPContext = createContext<CSPContextValue>(NOOP_CSP_CONTEXT);\n\n/**\n * Read the current CSP context. When no `<CSPProvider>` is above, returns\n * the noop context whose accessors yield sensible defaults (`undefined`\n * nonce, `false` disable-style-elements).\n */\nexport function useCSPContext(): CSPContextValue {\n\treturn useContext(CSPContext);\n}\n\n/**\n * Convenience helper — read the nonce as an accessor, decoupled from the\n * shape of the context value. Consumers that only need the nonce should\n * prefer this so they aren't re-subscribed when unrelated CSP fields are\n * added to the context in the future.\n */\nexport function useCspNonce(): Accessor<string | undefined> {\n\treturn useCSPContext().nonce;\n}\n\n/**\n * Convenience helper — read the `disableStyleElements` flag as an accessor.\n */\nexport function useCspDisableStyleElements(): Accessor<boolean> {\n\treturn useCSPContext().disableStyleElements;\n}\n"],"mappings":"AAAA,SAAwBA,aAAa,EAAEC,UAAU,QAAQ,UAAU;;AAEnE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,MAAMC,UAAU,GAAGA,CAAA,KAAiBC,SAAS;AAC7C,MAAMC,kBAAkB,GAAGA,CAAA,KAAa,KAAK;AAE7C,OAAO,MAAMC,gBAAiC,GAAG;EAChDC,KAAK,EAAEJ,UAAU;EACjBK,oBAAoB,EAAEH;AACvB,CAAC;;AAED;AACA;AACA;AACA;AACA,OAAO,MAAMI,UAAU,GAAGR,aAAa,CAAkBK,gBAAgB,CAAC;;AAE1E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASI,aAAaA,CAAA,EAAoB;EAChD,OAAOR,UAAU,CAACO,UAAU,CAAC;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,WAAWA,CAAA,EAAiC;EAC3D,OAAOD,aAAa,CAAC,CAAC,CAACH,KAAK;AAC7B;;AAEA;AACA;AACA;AACA,OAAO,SAASK,0BAA0BA,CAAA,EAAsB;EAC/D,OAAOF,aAAa,CAAC,CAAC,CAACF,oBAAoB;AAC5C","ignoreList":[]}