| 743 | } |
| 744 | |
| 745 | function createProtectedFragments() { |
| 746 | const fragments: string[] = [] |
| 747 | |
| 748 | return { |
| 749 | protect(value: string): string { |
| 750 | const index = fragments.length |
| 751 | fragments.push(value) |
| 752 | return `\\uE000RAW${index}\\uE000` |
| 753 | }, |
| 754 | restore(value: string): string { |
| 755 | if (!fragments.length) return value |
| 756 | return value.replace(/\\uE000RAW(\d+)\\uE000/g, (match, index: string) => { |
| 757 | const fragment = fragments[Number(index)] |
| 758 | return fragment ?? match |
| 759 | }) |
| 760 | } |
| 761 | } |
| 762 | } |
| 763 | |
| 764 | export function serializeCSS( |
| 765 | style: Record<string, string>, |