import React from 'react'
import { StyleSheet } from 'react-native'
import * as unistyles from '../web/services'
import { error, isServer } from '../web/utils'
import { serialize } from './serialize'
import { DefaultServerUnistylesSettings, type ServerUnistylesSettings } from './types'
export const getServerUnistyles = ({ includeRNWStyles = true }: ServerUnistylesSettings = DefaultServerUnistylesSettings) => {
if (!isServer()) {
throw error('Server styles should only be read on the server')
}
// @ts-ignore
const rnwStyle: string | null = includeRNWStyles ? (StyleSheet?.getSheet().textContent ?? '') : null
const css = unistyles.services.registry.css.getStyles()
const state = unistyles.services.registry.css.getState()
return (
<>
{rnwStyle && }
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Needs the json quotes to be unescaped */}
>
)
}