@tenphi/tasty 0.0.0-snapshot.a85ade8 → 0.0.0-snapshot.a8a2a5d

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. package/README.md +418 -381
  2. package/dist/babel-types-BOABQvEI.d.ts +16 -0
  3. package/dist/chunks/async-storage-CzSKAyrI.js +36 -0
  4. package/dist/chunks/async-storage-CzSKAyrI.js.map +1 -0
  5. package/dist/chunks/build-config-DQkT3Wru.js +59 -0
  6. package/dist/chunks/build-config-DQkT3Wru.js.map +1 -0
  7. package/dist/{collector-C6TtL8HJ.js → chunks/collector-Df9zcabl.js} +11 -129
  8. package/dist/chunks/collector-Df9zcabl.js.map +1 -0
  9. package/dist/chunks/config-engine-C7OUmM1J.js +269 -0
  10. package/dist/chunks/config-engine-C7OUmM1J.js.map +1 -0
  11. package/dist/chunks/config-file-BX3F_61U.js +24 -0
  12. package/dist/chunks/config-file-BX3F_61U.js.map +1 -0
  13. package/dist/chunks/css-definitions-BkdTqT7G.js +896 -0
  14. package/dist/chunks/css-definitions-BkdTqT7G.js.map +1 -0
  15. package/dist/chunks/css-resources-C0zT36nQ.js +141 -0
  16. package/dist/chunks/css-resources-C0zT36nQ.js.map +1 -0
  17. package/dist/chunks/debug-CwGMB2RI.js +501 -0
  18. package/dist/chunks/debug-CwGMB2RI.js.map +1 -0
  19. package/dist/chunks/dsl-BAwiOznp.js +1442 -0
  20. package/dist/chunks/dsl-BAwiOznp.js.map +1 -0
  21. package/dist/chunks/hydration-DEmoq1sQ.js +39 -0
  22. package/dist/chunks/hydration-DEmoq1sQ.js.map +1 -0
  23. package/dist/chunks/react-runtime-B8YqpFx7.js +678 -0
  24. package/dist/chunks/react-runtime-B8YqpFx7.js.map +1 -0
  25. package/dist/chunks/runtime-engine-CHNH2nGy.js +2418 -0
  26. package/dist/chunks/runtime-engine-CHNH2nGy.js.map +1 -0
  27. package/dist/chunks/runtime-state-BxLKsQzs.js +150 -0
  28. package/dist/chunks/runtime-state-BxLKsQzs.js.map +1 -0
  29. package/dist/{merge-styles-DuoZEsm9.js → chunks/shared-utils-CYgOs2mp.js} +58 -57
  30. package/dist/chunks/shared-utils-CYgOs2mp.js.map +1 -0
  31. package/dist/chunks/style-engine-DkKH-TqL.js +5573 -0
  32. package/dist/chunks/style-engine-DkKH-TqL.js.map +1 -0
  33. package/dist/{css-writer-Bgowobbx.js → chunks/zero-engine-C-0ar_PT.js} +67 -149
  34. package/dist/chunks/zero-engine-C-0ar_PT.js.map +1 -0
  35. package/dist/{collector-BTVXj2hS.d.ts → collector-BN6hCWIx.d.ts} +3 -6
  36. package/dist/{config-LfIDmVHx.d.ts → config-Chmu-PnP.d.ts} +49 -63
  37. package/dist/core/index.d.ts +5 -5
  38. package/dist/core/index.js +9 -6
  39. package/dist/hydrate-CTh8SGd9.d.ts +20 -0
  40. package/dist/{index-Bm9ltvdH.d.ts → index-szujmf6W.d.ts} +263 -348
  41. package/dist/index.d.ts +5 -5
  42. package/dist/index.js +11 -922
  43. package/dist/merge-styles-Cx25bpax.d.ts +4 -0
  44. package/dist/ssr/astro-client.d.ts +1 -1
  45. package/dist/ssr/astro-client.js +2 -16
  46. package/dist/ssr/astro-client.js.map +1 -1
  47. package/dist/ssr/astro-middleware-extract-static.d.ts +1 -4
  48. package/dist/ssr/astro-middleware-extract-static.js +1 -2
  49. package/dist/ssr/astro-middleware-extract.d.ts +1 -4
  50. package/dist/ssr/astro-middleware-extract.js +1 -2
  51. package/dist/ssr/astro-middleware-static.d.ts +1 -4
  52. package/dist/ssr/astro-middleware-static.js +2 -14
  53. package/dist/ssr/astro-middleware-static.js.map +1 -1
  54. package/dist/ssr/astro-middleware.d.ts +1 -4
  55. package/dist/ssr/astro-middleware.js +2 -15
  56. package/dist/ssr/astro-middleware.js.map +1 -1
  57. package/dist/ssr/astro.d.ts +17 -19
  58. package/dist/ssr/astro.js +218 -1
  59. package/dist/ssr/astro.js.map +1 -0
  60. package/dist/ssr/client.d.ts +2 -0
  61. package/dist/ssr/client.js +1 -0
  62. package/dist/ssr/index.d.ts +5 -27
  63. package/dist/ssr/index.js +6 -7
  64. package/dist/ssr/index.js.map +1 -1
  65. package/dist/ssr/next-config.d.ts +63 -0
  66. package/dist/ssr/next-config.js +122 -0
  67. package/dist/ssr/next-config.js.map +1 -0
  68. package/dist/ssr/next.d.ts +9 -10
  69. package/dist/ssr/next.js +30 -45
  70. package/dist/ssr/next.js.map +1 -1
  71. package/dist/static/index.d.ts +8 -13
  72. package/dist/static/index.js +6 -26
  73. package/dist/static/index.js.map +1 -1
  74. package/dist/static/inject.d.ts +1 -4
  75. package/dist/static/inject.js +1 -2
  76. package/dist/{index-BmogEzTo.d.ts → types-DbMN-Yyn.d.ts} +1013 -1043
  77. package/dist/zero/babel.d.ts +71 -2
  78. package/dist/zero/babel.js +84 -150
  79. package/dist/zero/babel.js.map +1 -1
  80. package/dist/zero/index.d.ts +61 -12
  81. package/dist/zero/index.js +24 -2
  82. package/dist/zero/index.js.map +1 -0
  83. package/dist/zero/next.d.ts +5 -7
  84. package/dist/zero/next.js +4 -40
  85. package/dist/zero/next.js.map +1 -1
  86. package/docs/README.md +4 -1
  87. package/docs/adoption.md +25 -17
  88. package/docs/ai-agents.md +69 -34
  89. package/docs/comparison.md +9 -8
  90. package/docs/configuration.md +204 -70
  91. package/docs/debug.md +18 -7
  92. package/docs/design-system.md +129 -15
  93. package/docs/dsl.md +327 -117
  94. package/docs/getting-started.md +81 -22
  95. package/docs/injector.md +41 -40
  96. package/docs/llms.txt +31 -0
  97. package/docs/methodology.md +48 -23
  98. package/docs/migration-v3.md +3 -3
  99. package/docs/pipeline.md +55 -28
  100. package/docs/plugins.md +22 -42
  101. package/docs/react-api.md +76 -11
  102. package/docs/runtime-benchmarks.md +257 -47
  103. package/docs/ssr.md +226 -80
  104. package/docs/styles.md +169 -33
  105. package/docs/tasty-static.md +176 -58
  106. package/harness/dev.harnesspm/rules/usage.md +12 -0
  107. package/harness/dev.harnesspm/scripts/render.mjs +320 -0
  108. package/harness/dev.harnesspm/scripts/styles.mjs +299 -0
  109. package/harness/plugin.json +20 -0
  110. package/package.json +116 -48
  111. package/tasty.config.ts +1 -0
  112. package/dist/astro-ib7E7V4Y.js +0 -307
  113. package/dist/astro-ib7E7V4Y.js.map +0 -1
  114. package/dist/async-storage-DKK-wTD4.js +0 -44
  115. package/dist/async-storage-DKK-wTD4.js.map +0 -1
  116. package/dist/babel-DWCsafYw.d.ts +0 -83
  117. package/dist/collector-C6TtL8HJ.js.map +0 -1
  118. package/dist/config-B3gPdCqd.js +0 -12421
  119. package/dist/config-B3gPdCqd.js.map +0 -1
  120. package/dist/context-CA8YKeMn.js +0 -24
  121. package/dist/context-CA8YKeMn.js.map +0 -1
  122. package/dist/core-Bq7w2kti.js +0 -1686
  123. package/dist/core-Bq7w2kti.js.map +0 -1
  124. package/dist/css-writer-Bgowobbx.js.map +0 -1
  125. package/dist/format-global-rules-DklyaXv-.js +0 -22
  126. package/dist/format-global-rules-DklyaXv-.js.map +0 -1
  127. package/dist/format-rules-rCZ37rqY.js +0 -130
  128. package/dist/format-rules-rCZ37rqY.js.map +0 -1
  129. package/dist/hydrate-CNOmZprz.js +0 -37
  130. package/dist/hydrate-CNOmZprz.js.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/keyframes-DE-OE76F.js +0 -535
  133. package/dist/keyframes-DE-OE76F.js.map +0 -1
  134. package/dist/merge-styles-BcLl1u_d.d.ts +0 -7
  135. package/dist/merge-styles-DuoZEsm9.js.map +0 -1
  136. package/dist/resolve-recipes-H9NqOQuP.js +0 -144
  137. package/dist/resolve-recipes-H9NqOQuP.js.map +0 -1
@@ -0,0 +1,150 @@
1
+ import { P as DEFAULT_PROPERTIES, R as indexPropertiesByName } from "./css-definitions-BkdTqT7G.js";
2
+ // src/config-resources.ts
3
+ let runtimeConfig = null;
4
+ let globalFontFace = null;
5
+ let globalCounterStyle = null;
6
+ let globalFunction = null;
7
+ let globalProperties = null;
8
+ let globalConfigTokens = null;
9
+ let globalStyles = null;
10
+ let globalKeyframes = null;
11
+ const GTKEY_TOKENS = "__tasty_cfg_tokens__";
12
+ const GTKEY_FONT_FACE = "__tasty_cfg_font_face__";
13
+ const GTKEY_COUNTER_STYLE = "__tasty_cfg_counter_style__";
14
+ const GTKEY_FUNCTION = "__tasty_cfg_function__";
15
+ const GTKEY_PROPERTIES = "__tasty_cfg_properties__";
16
+ const GTKEY_GLOBAL_STYLES = "__tasty_cfg_global_styles__";
17
+ const GTKEY_KEYFRAMES = "__tasty_cfg_keyframes__";
18
+ function setOnGlobalThis(key, value) {
19
+ globalThis[key] = value;
20
+ }
21
+ function getFromGlobalThis(key) {
22
+ return globalThis[key];
23
+ }
24
+ function getRuntimeConfigState() {
25
+ return runtimeConfig;
26
+ }
27
+ function setRuntimeConfigState(config) {
28
+ runtimeConfig = config;
29
+ }
30
+ function getEffectiveProperties() {
31
+ const properties = globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES);
32
+ return properties ? {
33
+ ...DEFAULT_PROPERTIES,
34
+ ...properties
35
+ } : DEFAULT_PROPERTIES;
36
+ }
37
+ let effectivePropertyIndex = null;
38
+ function getEffectivePropertiesByName() {
39
+ const source = globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES);
40
+ if (effectivePropertyIndex && effectivePropertyIndex.source === source) return effectivePropertyIndex.index;
41
+ const index = indexPropertiesByName(getEffectiveProperties());
42
+ effectivePropertyIndex = {
43
+ source,
44
+ index
45
+ };
46
+ return index;
47
+ }
48
+ function getGlobalFontFaces() {
49
+ return globalFontFace ?? getFromGlobalThis(GTKEY_FONT_FACE) ?? null;
50
+ }
51
+ function getGlobalCounterStyles() {
52
+ return globalCounterStyle ?? getFromGlobalThis(GTKEY_COUNTER_STYLE) ?? null;
53
+ }
54
+ function getGlobalFunctions() {
55
+ return globalFunction ?? getFromGlobalThis(GTKEY_FUNCTION) ?? null;
56
+ }
57
+ function getGlobalConfigTokens() {
58
+ return globalConfigTokens ?? getFromGlobalThis(GTKEY_TOKENS) ?? null;
59
+ }
60
+ function getGlobalStyles() {
61
+ return globalStyles ?? getFromGlobalThis(GTKEY_GLOBAL_STYLES) ?? null;
62
+ }
63
+ function getGlobalKeyframes() {
64
+ return globalKeyframes ?? getFromGlobalThis(GTKEY_KEYFRAMES) ?? null;
65
+ }
66
+ function mergeGlobalProperties(properties) {
67
+ globalProperties = {
68
+ ...globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {},
69
+ ...properties
70
+ };
71
+ setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);
72
+ }
73
+ function mergeGlobalFontFaces(fontFaces) {
74
+ globalFontFace = {
75
+ ...getGlobalFontFaces() ?? {},
76
+ ...fontFaces
77
+ };
78
+ setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);
79
+ }
80
+ function mergeGlobalCounterStyles(counterStyles) {
81
+ globalCounterStyle = {
82
+ ...getGlobalCounterStyles() ?? {},
83
+ ...counterStyles
84
+ };
85
+ setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);
86
+ }
87
+ function mergeGlobalFunctions(functions) {
88
+ globalFunction = {
89
+ ...getGlobalFunctions() ?? {},
90
+ ...functions
91
+ };
92
+ setOnGlobalThis(GTKEY_FUNCTION, globalFunction);
93
+ }
94
+ function mergeGlobalConfigTokens(styles) {
95
+ globalConfigTokens = globalConfigTokens ? {
96
+ ...globalConfigTokens,
97
+ ...styles
98
+ } : styles;
99
+ setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);
100
+ }
101
+ function mergeGlobalStyles(styles) {
102
+ if (globalStyles) for (const [selector, selectorStyles] of Object.entries(styles)) globalStyles[selector] = globalStyles[selector] ? {
103
+ ...globalStyles[selector],
104
+ ...selectorStyles
105
+ } : selectorStyles;
106
+ else globalStyles = { ...styles };
107
+ setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);
108
+ }
109
+ function mergeGlobalKeyframes(keyframes) {
110
+ globalKeyframes = {
111
+ ...getGlobalKeyframes() ?? {},
112
+ ...keyframes
113
+ };
114
+ setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);
115
+ }
116
+ function resetConfigResources() {
117
+ runtimeConfig = null;
118
+ globalProperties = null;
119
+ globalFontFace = null;
120
+ globalCounterStyle = null;
121
+ globalFunction = null;
122
+ globalConfigTokens = null;
123
+ globalStyles = null;
124
+ globalKeyframes = null;
125
+ const globalState = globalThis;
126
+ delete globalState[GTKEY_TOKENS];
127
+ delete globalState[GTKEY_FONT_FACE];
128
+ delete globalState[GTKEY_COUNTER_STYLE];
129
+ delete globalState[GTKEY_FUNCTION];
130
+ delete globalState[GTKEY_PROPERTIES];
131
+ delete globalState[GTKEY_GLOBAL_STYLES];
132
+ delete globalState[GTKEY_KEYFRAMES];
133
+ }
134
+ // src/ssr/ssr-collector-ref.ts
135
+ const GETTER_KEY = "__tasty_ssr_collector_getter__";
136
+ let _getSSRCollector = null;
137
+ function registerSSRCollectorGetter(fn) {
138
+ _getSSRCollector = fn;
139
+ }
140
+ function registerSSRCollectorGetterGlobal(fn) {
141
+ globalThis[GETTER_KEY] = fn;
142
+ }
143
+ function getRegisteredSSRCollector() {
144
+ if (_getSSRCollector) return _getSSRCollector();
145
+ const getter = globalThis[GETTER_KEY];
146
+ return getter ? getter() : null;
147
+ }
148
+ export { mergeGlobalKeyframes as _, getEffectivePropertiesByName as a, resetConfigResources as b, getGlobalFontFaces as c, getGlobalStyles as d, getRuntimeConfigState as f, mergeGlobalFunctions as g, mergeGlobalFontFaces as h, getEffectiveProperties as i, getGlobalFunctions as l, mergeGlobalCounterStyles as m, registerSSRCollectorGetter as n, getGlobalConfigTokens as o, mergeGlobalConfigTokens as p, registerSSRCollectorGetterGlobal as r, getGlobalCounterStyles as s, getRegisteredSSRCollector as t, getGlobalKeyframes as u, mergeGlobalProperties as v, setRuntimeConfigState as x, mergeGlobalStyles as y };
149
+
150
+ //# sourceMappingURL=runtime-state-BxLKsQzs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-state-BxLKsQzs.js","names":[],"sources":["../../src/config-resources.ts","../../src/ssr/ssr-collector-ref.ts"],"sourcesContent":["/**\n * DOM-free storage for configured CSS resources shared by the browser runtime\n * and server collectors.\n *\n * Astro can evaluate middleware and application code in separate module\n * graphs, so resources used by SSR are mirrored on globalThis. Keeping this\n * state outside config.ts lets server-only entrypoints read it without loading\n * StyleInjector and the rest of the browser runtime.\n */\n\nimport type {\n CounterStyleDescriptors,\n FontFaceInput,\n FunctionDefinition,\n KeyframesSteps,\n PropertyDefinition,\n} from './injector/types';\nimport type { DeclaredPropertyEntry } from './properties';\nimport { indexPropertiesByName } from './properties';\nimport { DEFAULT_PROPERTIES } from './properties/defaults';\nimport type { ConfigTokens, Styles } from './styles/types';\n\ninterface RuntimeConfigState {\n namePrefix?: string;\n nonce?: string;\n}\n\nlet runtimeConfig: RuntimeConfigState | null = null;\nlet globalFontFace: Record<string, FontFaceInput> | null = null;\nlet globalCounterStyle: Record<string, CounterStyleDescriptors> | null = null;\nlet globalFunction: Record<string, FunctionDefinition> | null = null;\nlet globalProperties: Record<string, PropertyDefinition> | null = null;\nlet globalConfigTokens: ConfigTokens | null = null;\nlet globalStyles: Record<string, Styles> | null = null;\nlet globalKeyframes: Record<string, KeyframesSteps> | null = null;\n\nconst GTKEY_TOKENS = '__tasty_cfg_tokens__';\nconst GTKEY_FONT_FACE = '__tasty_cfg_font_face__';\nconst GTKEY_COUNTER_STYLE = '__tasty_cfg_counter_style__';\nconst GTKEY_FUNCTION = '__tasty_cfg_function__';\nconst GTKEY_PROPERTIES = '__tasty_cfg_properties__';\nconst GTKEY_GLOBAL_STYLES = '__tasty_cfg_global_styles__';\nconst GTKEY_KEYFRAMES = '__tasty_cfg_keyframes__';\n\nfunction setOnGlobalThis(key: string, value: unknown): void {\n (globalThis as Record<string, unknown>)[key] = value;\n}\n\nfunction getFromGlobalThis<T>(key: string): T | undefined {\n return (globalThis as Record<string, unknown>)[key] as T | undefined;\n}\n\nexport function getRuntimeConfigState(): RuntimeConfigState | null {\n return runtimeConfig;\n}\n\nexport function setRuntimeConfigState(config: RuntimeConfigState): void {\n runtimeConfig = config;\n}\n\nexport function getEffectiveProperties(): Record<string, PropertyDefinition> {\n const properties =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n return properties\n ? { ...DEFAULT_PROPERTIES, ...properties }\n : DEFAULT_PROPERTIES;\n}\n\nlet effectivePropertyIndex: {\n source: Record<string, PropertyDefinition> | null | undefined;\n index: ReadonlyMap<string, DeclaredPropertyEntry>;\n} | null = null;\n\n/**\n * The effective properties (Tasty's defaults and `configure({ properties })`)\n * keyed by the custom property each one registers — see\n * `indexPropertiesByName()`. Rebuilt only when `configure({ properties })`\n * replaces the set.\n */\nexport function getEffectivePropertiesByName(): ReadonlyMap<\n string,\n DeclaredPropertyEntry\n> {\n const source =\n globalProperties ??\n getFromGlobalThis<Record<string, PropertyDefinition>>(GTKEY_PROPERTIES);\n\n if (effectivePropertyIndex && effectivePropertyIndex.source === source) {\n return effectivePropertyIndex.index;\n }\n\n const index = indexPropertiesByName(getEffectiveProperties());\n effectivePropertyIndex = { source, index };\n return index;\n}\n\nexport function getGlobalFontFaces(): Record<string, FontFaceInput> | null {\n return (\n globalFontFace ??\n getFromGlobalThis<Record<string, FontFaceInput>>(GTKEY_FONT_FACE) ??\n null\n );\n}\n\nexport function getGlobalCounterStyles(): Record<\n string,\n CounterStyleDescriptors\n> | null {\n return (\n globalCounterStyle ??\n getFromGlobalThis<Record<string, CounterStyleDescriptors>>(\n GTKEY_COUNTER_STYLE,\n ) ??\n null\n );\n}\n\nexport function getGlobalFunctions(): Record<\n string,\n FunctionDefinition\n> | null {\n return (\n globalFunction ??\n getFromGlobalThis<Record<string, FunctionDefinition>>(GTKEY_FUNCTION) ??\n null\n );\n}\n\nexport function getGlobalConfigTokens(): ConfigTokens | null {\n return (\n globalConfigTokens ?? getFromGlobalThis<ConfigTokens>(GTKEY_TOKENS) ?? null\n );\n}\n\nexport function getGlobalStyles(): Record<string, Styles> | null {\n return (\n globalStyles ??\n getFromGlobalThis<Record<string, Styles>>(GTKEY_GLOBAL_STYLES) ??\n null\n );\n}\n\n/**\n * Get global keyframes configuration.\n * Returns null if no keyframes configured (fast path for zero-overhead).\n */\nexport function getGlobalKeyframes(): Record<string, KeyframesSteps> | null {\n return (\n globalKeyframes ??\n getFromGlobalThis<Record<string, KeyframesSteps>>(GTKEY_KEYFRAMES) ??\n null\n );\n}\n\nexport function mergeGlobalProperties(\n properties: Record<string, PropertyDefinition>,\n): void {\n globalProperties = {\n ...(globalProperties ?? getFromGlobalThis(GTKEY_PROPERTIES) ?? {}),\n ...properties,\n };\n setOnGlobalThis(GTKEY_PROPERTIES, globalProperties);\n}\n\nexport function mergeGlobalFontFaces(\n fontFaces: Record<string, FontFaceInput>,\n): void {\n globalFontFace = { ...(getGlobalFontFaces() ?? {}), ...fontFaces };\n setOnGlobalThis(GTKEY_FONT_FACE, globalFontFace);\n}\n\nexport function mergeGlobalCounterStyles(\n counterStyles: Record<string, CounterStyleDescriptors>,\n): void {\n globalCounterStyle = {\n ...(getGlobalCounterStyles() ?? {}),\n ...counterStyles,\n };\n setOnGlobalThis(GTKEY_COUNTER_STYLE, globalCounterStyle);\n}\n\nexport function mergeGlobalFunctions(\n functions: Record<string, FunctionDefinition>,\n): void {\n globalFunction = { ...(getGlobalFunctions() ?? {}), ...functions };\n setOnGlobalThis(GTKEY_FUNCTION, globalFunction);\n}\n\nexport function mergeGlobalConfigTokens(styles: ConfigTokens): void {\n globalConfigTokens = globalConfigTokens\n ? { ...globalConfigTokens, ...styles }\n : styles;\n setOnGlobalThis(GTKEY_TOKENS, globalConfigTokens);\n}\n\nexport function mergeGlobalStyles(styles: Record<string, Styles>): void {\n if (globalStyles) {\n for (const [selector, selectorStyles] of Object.entries(styles)) {\n globalStyles[selector] = globalStyles[selector]\n ? { ...globalStyles[selector], ...selectorStyles }\n : selectorStyles;\n }\n } else {\n globalStyles = { ...styles };\n }\n setOnGlobalThis(GTKEY_GLOBAL_STYLES, globalStyles);\n}\n\nexport function mergeGlobalKeyframes(\n keyframes: Record<string, KeyframesSteps>,\n): void {\n globalKeyframes = { ...(getGlobalKeyframes() ?? {}), ...keyframes };\n setOnGlobalThis(GTKEY_KEYFRAMES, globalKeyframes);\n}\n\nexport function resetConfigResources(): void {\n runtimeConfig = null;\n globalProperties = null;\n globalFontFace = null;\n globalCounterStyle = null;\n globalFunction = null;\n globalConfigTokens = null;\n globalStyles = null;\n globalKeyframes = null;\n\n const globalState = globalThis as Record<string, unknown>;\n delete globalState[GTKEY_TOKENS];\n delete globalState[GTKEY_FONT_FACE];\n delete globalState[GTKEY_COUNTER_STYLE];\n delete globalState[GTKEY_FUNCTION];\n delete globalState[GTKEY_PROPERTIES];\n delete globalState[GTKEY_GLOBAL_STYLES];\n delete globalState[GTKEY_KEYFRAMES];\n}\n","/**\n * Global reference to the SSR collector getter function.\n *\n * This indirection avoids importing 'node:async_hooks' in the browser bundle.\n * The SSR entry point sets this ref when loaded on the server. The useStyles\n * hook calls it if set; on the client it stays null and is never called.\n *\n * Uses a module-level variable as the primary mechanism. In Next.js App\n * Router the RSC and SSR module graphs load separate copies of this module,\n * so the getter registered by TastyRegistry (SSR layer) is invisible to\n * server components (RSC layer) — which correctly fall through to inline\n * RSC styles.\n *\n * A globalThis fallback (`registerSSRCollectorGetterGlobal`) is provided\n * for frameworks like Astro where middleware and page components live in\n * different module graphs and must share the getter across them.\n */\n\nimport type { ServerStyleCollector } from './collector';\n\ntype SSRCollectorGetter = () => ServerStyleCollector | null;\n\nconst GETTER_KEY = '__tasty_ssr_collector_getter__';\n\nlet _getSSRCollector: SSRCollectorGetter | null = null;\n\n/**\n * Register the collector getter in the current module graph only.\n * Used by Next.js TastyRegistry.\n */\nexport function registerSSRCollectorGetter(fn: SSRCollectorGetter): void {\n _getSSRCollector = fn;\n}\n\n/**\n * Register the collector getter on globalThis so it is visible across\n * separate module graphs (e.g. Astro middleware ↔ page components).\n */\nexport function registerSSRCollectorGetterGlobal(fn: SSRCollectorGetter): void {\n (globalThis as Record<string, unknown>)[GETTER_KEY] = fn;\n}\n\n/**\n * Retrieve the SSR collector: module-level first, globalThis fallback.\n */\nexport function getRegisteredSSRCollector(): ServerStyleCollector | null {\n if (_getSSRCollector) return _getSSRCollector();\n const getter = (globalThis as Record<string, unknown>)[GETTER_KEY] as\n SSRCollectorGetter | undefined;\n return getter ? getter() : null;\n}\n"],"mappings":";;AA2BA,IAAI,gBAA2C;AAC/C,IAAI,iBAAuD;AAC3D,IAAI,qBAAqE;AACzE,IAAI,iBAA4D;AAChE,IAAI,mBAA8D;AAClE,IAAI,qBAA0C;AAC9C,IAAI,eAA8C;AAClD,IAAI,kBAAyD;AAE7D,MAAM,eAAe;AACrB,MAAM,kBAAkB;AACxB,MAAM,sBAAsB;AAC5B,MAAM,iBAAiB;AACvB,MAAM,mBAAmB;AACzB,MAAM,sBAAsB;AAC5B,MAAM,kBAAkB;AAExB,SAAS,gBAAgB,KAAa,OAAsB;CAC1D,WAAwC,OAAO;AACjD;AAEA,SAAS,kBAAqB,KAA4B;CACxD,OAAQ,WAAuC;AACjD;AAEA,SAAgB,wBAAmD;CACjE,OAAO;AACT;AAEA,SAAgB,sBAAsB,QAAkC;CACtE,gBAAgB;AAClB;AAEA,SAAgB,yBAA6D;CAC3E,MAAM,aACJ,oBACA,kBAAsD,gBAAgB;CACxE,OAAO,aACH;EAAE,GAAG;EAAoB,GAAG;CAAW,IACvC;AACN;AAEA,IAAI,yBAGO;AAQX,SAAgB,+BAGd;CACA,MAAM,SACJ,oBACA,kBAAsD,gBAAgB;CAExE,IAAI,0BAA0B,uBAAuB,WAAW,QAC9D,OAAO,uBAAuB;CAGhC,MAAM,QAAQ,sBAAsB,uBAAuB,CAAC;CAC5D,yBAAyB;EAAE;EAAQ;CAAM;CACzC,OAAO;AACT;AAEA,SAAgB,q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qBAAqB,YAAY;AACnD;AAEA,SAAgB,qBACd,WACM;CACN,kBAAkB;EAAE,GAAI,mBAAmB,KAAK,CAAC;EAAI,GAAG;CAAU;CAClE,gBAAgB,iBAAiB,eAAe;AAClD;AAEA,SAAgB,uBAA6B;CAC3C,gBAAgB;CAChB,mBAAmB;CACnB,iBAAiB;CACjB,qBAAqB;CACrB,iBAAiB;CACjB,qBAAqB;CACrB,eAAe;CACf,kBAAkB;CAElB,MAAM,cAAc;CACpB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,OAAO,YAAY;CACnB,OAAO,YAAY;AACrB;;ACpNA,MAAM,aAAa;AAEnB,IAAI,mBAA8C;AAMlD,SAAgB,2BAA2B,IAA8B;CACvE,mBAAmB;AACrB;AAMA,SAAgB,iCAAiC,IAA8B;CAC7E,WAAwC,cAAc;AACxD;AAKA,SAAgB,4BAAyD;CACvE,IAAI,kBAAkB,OAAO,iBAAiB;CAC9C,MAAM,SAAU,WAAuC;CAEvD,OAAO,SAAS,OAAO,IAAI;AAC7B"}
@@ -1,36 +1,47 @@
1
- import { I as isSelector, Qt as isDevEnv } from "./config-B3gPdCqd.js";
2
- //#region src/utils/merge-styles.ts
1
+ // src/utils/is-dev-env.ts
2
+ function isDevEnv() {
3
+ if (typeof window !== "undefined" && window.localStorage) try {
4
+ const forceTastyDebug = window.localStorage.getItem("TASTY_DEBUG");
5
+ if (forceTastyDebug !== null && forceTastyDebug.toLowerCase() === "true") return true;
6
+ } catch {}
7
+ if (typeof process === "undefined") return false;
8
+ const nodeEnv = process.env.NODE_ENV;
9
+ return nodeEnv !== "test" && nodeEnv !== "production";
10
+ }
11
+ // src/utils/warnings.ts
12
+ const PREFIX = "[Tasty]";
13
+ const emittedWarnings = /* @__PURE__ */ new Set();
14
+ function warn(...args) {
15
+ console.warn(PREFIX, ...args);
16
+ }
17
+ function warnOnceDev(key, message) {
18
+ if (emittedWarnings.has(key)) return;
19
+ emittedWarnings.add(key);
20
+ if (!isDevEnv()) return;
21
+ console.warn(`${PREFIX} ${message}`);
22
+ }
23
+ function resetStyleWarnings() {
24
+ emittedWarnings.clear();
25
+ }
26
+ // src/utils/is-selector.ts
27
+ function isSelector(key) {
28
+ const first = key.charCodeAt(0);
29
+ return first === 38 || first === 46 || first >= 65 && first <= 90;
30
+ }
31
+ // src/utils/merge-styles.ts
3
32
  const devMode = isDevEnv();
4
33
  const INHERIT_VALUE = "@inherit";
5
- /**
6
- * Check if a value is a state map (object, not array).
7
- */
34
+ function warnMissingInherit(key) {
35
+ if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
36
+ }
8
37
  function isStateMap(value) {
9
38
  return typeof value === "object" && value !== null && !Array.isArray(value);
10
39
  }
11
- /**
12
- * Normalize a parent value to a state map.
13
- * - Already a state map → return as-is
14
- * - Non-null, non-false primitive → wrap as `{ '': value }`
15
- * - null / undefined / false → return null (no parent to merge with)
16
- */
17
40
  function normalizeToStateMap(value) {
18
41
  if (isStateMap(value)) return value;
19
42
  if (value != null && value !== false) return { "": value };
20
43
  return null;
21
44
  }
22
- /**
23
- * Resolve a child state map against a parent value.
24
- *
25
- * Mode is determined by whether the child contains a `''` (default) key:
26
- * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions
27
- * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent
28
- *
29
- * In both modes:
30
- * - `@inherit` value → resolve from parent state map
31
- * - `null` value → remove this state from the result
32
- * - `false` value → tombstone, persists through all layers, blocks recipe
33
- */
34
45
  function resolveStateMap(parentValue, childMap) {
35
46
  const isExtend = !("" in childMap);
36
47
  const parentMap = normalizeToStateMap(parentValue);
@@ -46,49 +57,39 @@ function resolveStateMap(parentValue, childMap) {
46
57
  if (isExtend) return resolveExtendMode(parentMap, childMap);
47
58
  return resolveReplaceMode(parentMap, childMap);
48
59
  }
49
- /**
50
- * Extend mode: parent entries are preserved, child entries add/override/reposition.
51
- */
52
60
  function resolveExtendMode(parentMap, childMap) {
53
- const inheritKeys = /* @__PURE__ */ new Set();
54
- const removeKeys = /* @__PURE__ */ new Set();
55
- const overrideKeys = /* @__PURE__ */ new Map();
56
- for (const key of Object.keys(childMap)) {
57
- const val = childMap[key];
58
- if (val === INHERIT_VALUE) {
59
- if (key in parentMap) inheritKeys.add(key);
60
- else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
61
- } else if (val === null) removeKeys.add(key);
62
- else if (key in parentMap) overrideKeys.set(key, val);
63
- }
64
61
  const result = {};
62
+ const childKeys = Object.keys(childMap);
63
+ const childKeySet = new Set(childKeys);
65
64
  for (const key of Object.keys(parentMap)) {
66
- if (removeKeys.has(key)) continue;
67
- if (inheritKeys.has(key)) continue;
68
- if (overrideKeys.has(key)) result[key] = overrideKeys.get(key);
69
- else result[key] = parentMap[key];
65
+ if (!childKeySet.has(key)) {
66
+ result[key] = parentMap[key];
67
+ continue;
68
+ }
69
+ const childValue = childMap[key];
70
+ if (childValue === null || childValue === INHERIT_VALUE) continue;
71
+ result[key] = childValue;
72
+ }
73
+ for (const key of childKeys) {
74
+ const value = childMap[key];
75
+ if (value === INHERIT_VALUE) {
76
+ if (key in parentMap) result[key] = parentMap[key];
77
+ else warnMissingInherit(key);
78
+ } else if (value !== null && !(key in parentMap)) result[key] = value;
70
79
  }
71
- for (const key of Object.keys(childMap)) if (inheritKeys.has(key)) result[key] = parentMap[key];
72
- else if (!removeKeys.has(key) && !overrideKeys.has(key) && childMap[key] !== INHERIT_VALUE) result[key] = childMap[key];
73
80
  return result;
74
81
  }
75
- /**
76
- * Replace mode: child entries define the result, `@inherit` pulls from parent.
77
- */
78
82
  function resolveReplaceMode(parentMap, childMap) {
79
83
  const result = {};
80
84
  for (const key of Object.keys(childMap)) {
81
85
  const val = childMap[key];
82
86
  if (val === INHERIT_VALUE) {
83
87
  if (key in parentMap) result[key] = parentMap[key];
84
- else if (devMode) console.warn(`[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`);
88
+ else warnMissingInherit(key);
85
89
  } else if (val !== null) result[key] = val;
86
90
  }
87
91
  return result;
88
92
  }
89
- /**
90
- * Merge sub-element properties with state map / null / undefined support.
91
- */
92
93
  function mergeSubElementStyles(parentSub, childSub) {
93
94
  const parent = parentSub;
94
95
  const child = childSub;
@@ -117,7 +118,7 @@ function mergeStyles(...objects) {
117
118
  ...newStyles
118
119
  };
119
120
  const newSelectorKeys = Object.keys(newStyles).filter(isSelector);
120
- const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);
121
+ const allSelectorKeys = /* @__PURE__ */ new Set([...selectorKeys, ...newSelectorKeys]);
121
122
  for (const key of allSelectorKeys) {
122
123
  const newValue = newStyles?.[key];
123
124
  if (newValue === false || newValue === null) delete resultStyles[key];
@@ -127,9 +128,10 @@ function mergeStyles(...objects) {
127
128
  for (const key of Object.keys(newStyles)) {
128
129
  if (isSelector(key)) continue;
129
130
  const newValue = newStyles[key];
130
- if (newValue === void 0) if (key in styles) resultStyles[key] = styles[key];
131
- else delete resultStyles[key];
132
- else if (newValue === null) delete resultStyles[key];
131
+ if (newValue === void 0) {
132
+ if (key in styles) resultStyles[key] = styles[key];
133
+ else delete resultStyles[key];
134
+ } else if (newValue === null) delete resultStyles[key];
133
135
  else if (isStateMap(newValue)) resultStyles[key] = resolveStateMap(styles[key], newValue);
134
136
  }
135
137
  styles = resultStyles;
@@ -138,7 +140,6 @@ function mergeStyles(...objects) {
138
140
  }
139
141
  return styles;
140
142
  }
141
- //#endregion
142
- export { mergeStyles as t };
143
+ export { warnOnceDev as a, warn as i, isSelector as n, isDevEnv as o, resetStyleWarnings as r, mergeStyles as t };
143
144
 
144
- //# sourceMappingURL=merge-styles-DuoZEsm9.js.map
145
+ //# sourceMappingURL=shared-utils-CYgOs2mp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shared-utils-CYgOs2mp.js","names":[],"sources":["../../src/utils/is-dev-env.ts","../../src/utils/warnings.ts","../../src/utils/is-selector.ts","../../src/utils/merge-styles.ts"],"sourcesContent":["/**\n * Check if we're in a development environment at runtime\n * Uses bracket notation to avoid bundler compilation\n * Also checks for TASTY_DEBUG localStorage setting\n */\nexport function isDevEnv(): boolean {\n // Check localStorage for DEBUG_TASTY setting (browser environment)\n if (typeof window !== 'undefined' && window.localStorage) {\n try {\n const forceTastyDebug = window.localStorage.getItem('TASTY_DEBUG');\n if (\n forceTastyDebug !== null &&\n forceTastyDebug.toLowerCase() === 'true'\n ) {\n return true;\n }\n } catch {\n // localStorage might not be available (private browsing, etc.)\n // Continue with other checks\n }\n }\n\n // Check NODE_ENV for Node.js environments\n if (typeof process === 'undefined') return false;\n\n // Use bracket notation to avoid bundler replacement\n const nodeEnv = process.env?.['NODE_ENV'];\n return nodeEnv !== 'test' && nodeEnv !== 'production';\n}\n","import { isDevEnv } from './is-dev-env';\n\nconst PREFIX = '[Tasty]';\n\n/** Warning keys already emitted, so each distinct diagnostic warns once. */\nconst emittedWarnings = new Set<string>();\n\nexport function warn(...args: unknown[]) {\n console.warn(PREFIX, ...args);\n}\n\n/** Emit a warning at most once per key. No-op outside development mode. */\nexport function warnOnceDev(key: string, message: string): void {\n if (emittedWarnings.has(key)) return;\n emittedWarnings.add(key);\n\n if (!isDevEnv()) return;\n\n console.warn(`${PREFIX} ${message}`);\n}\n\n/** Forget emitted style warnings. Called by `resetConfig()` for test isolation. */\nexport function resetStyleWarnings(): void {\n emittedWarnings.clear();\n}\n","/** Check whether a style-object key identifies a nested CSS selector. */\nexport function isSelector(key: string): boolean {\n const first = key.charCodeAt(0);\n return (\n first === 38 || // &\n first === 46 || // .\n (first >= 65 && first <= 90) // A-Z\n );\n}\n","import type { Styles, StylesWithoutSelectors } from '../styles/types';\n\nimport { isDevEnv } from './is-dev-env';\nimport { isSelector } from './is-selector';\n\nconst devMode = isDevEnv();\n\nconst INHERIT_VALUE = '@inherit';\n\nfunction warnMissingInherit(key: string): void {\n if (devMode) {\n console.warn(\n `[Tasty] @inherit used for state '${key}' that does not exist in the parent style map. Entry skipped.`,\n );\n }\n}\n\n/**\n * Check if a value is a state map (object, not array).\n */\nfunction isStateMap(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Normalize a parent value to a state map.\n * - Already a state map → return as-is\n * - Non-null, non-false primitive → wrap as `{ '': value }`\n * - null / undefined / false → return null (no parent to merge with)\n */\nfunction normalizeToStateMap(value: unknown): Record<string, unknown> | null {\n if (isStateMap(value)) return value as Record<string, unknown>;\n if (value != null && value !== false) return { '': value };\n return null;\n}\n\n/**\n * Resolve a child state map against a parent value.\n *\n * Mode is determined by whether the child contains a `''` (default) key:\n * - No `''` → extend mode: parent entries preserved, child adds/overrides/repositions\n * - Has `''` → replace mode: child defines everything, `@inherit` cherry-picks from parent\n *\n * In both modes:\n * - `@inherit` value → resolve from parent state map\n * - `null` value → remove this state from the result\n * - `false` value → tombstone, persists through all layers, blocks recipe\n */\nfunction resolveStateMap(\n parentValue: unknown,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const isExtend = !('' in childMap);\n const parentMap = normalizeToStateMap(parentValue);\n\n if (!parentMap) {\n // No parent to merge with — strip nulls and @inherit, return child entries\n const result: Record<string, unknown> = {};\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === null || val === INHERIT_VALUE) continue;\n result[key] = val;\n }\n return result;\n }\n\n if (isExtend) {\n return resolveExtendMode(parentMap, childMap);\n }\n\n return resolveReplaceMode(parentMap, childMap);\n}\n\n/**\n * Extend mode: parent entries are preserved, child entries add/override/reposition.\n */\nfunction resolveExtendMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n // 1. Parent entries in order (skip removed, skip repositioned, apply overrides)\n const result: Record<string, unknown> = {};\n const childKeys = Object.keys(childMap);\n const childKeySet = new Set(childKeys);\n for (const key of Object.keys(parentMap)) {\n if (!childKeySet.has(key)) {\n result[key] = parentMap[key];\n continue;\n }\n const childValue = childMap[key];\n if (childValue === null || childValue === INHERIT_VALUE) continue;\n result[key] = childValue;\n }\n\n // 2. Append new + repositioned entries in child declaration order\n for (const key of childKeys) {\n const value = childMap[key];\n if (value === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else warnMissingInherit(key);\n } else if (value !== null && !(key in parentMap)) {\n result[key] = value;\n }\n }\n\n return result;\n}\n\n/**\n * Replace mode: child entries define the result, `@inherit` pulls from parent.\n */\nfunction resolveReplaceMode(\n parentMap: Record<string, unknown>,\n childMap: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n for (const key of Object.keys(childMap)) {\n const val = childMap[key];\n if (val === INHERIT_VALUE) {\n if (key in parentMap) {\n result[key] = parentMap[key];\n } else warnMissingInherit(key);\n } else if (val !== null) {\n result[key] = val;\n }\n }\n\n return result;\n}\n\n/**\n * Merge sub-element properties with state map / null / undefined support.\n */\nfunction mergeSubElementStyles(\n parentSub: StylesWithoutSelectors | undefined,\n childSub: StylesWithoutSelectors,\n): StylesWithoutSelectors {\n const parent = parentSub as Record<string, unknown> | undefined;\n const child = childSub as Record<string, unknown>;\n const merged: Record<string, unknown> = { ...parent, ...child };\n\n for (const key of Object.keys(child)) {\n const val = child[key];\n\n if (val === undefined) {\n if (parent && key in parent) {\n merged[key] = parent[key];\n }\n } else if (val === null) {\n delete merged[key];\n } else if (isStateMap(val)) {\n merged[key] = resolveStateMap(\n parent ? parent[key] : undefined,\n val as Record<string, unknown>,\n );\n }\n }\n\n return merged as StylesWithoutSelectors;\n}\n\nexport function mergeStyles(...objects: (Styles | undefined | null)[]): Styles {\n let styles: Styles = objects[0] ? { ...objects[0] } : {};\n let pos = 1;\n\n while (pos in objects) {\n const selectorKeys = Object.keys(styles).filter(\n (key) => isSelector(key) && styles[key],\n );\n const newStyles = objects[pos];\n\n if (newStyles) {\n const resultStyles = { ...styles, ...newStyles };\n\n // Collect all selector keys from both parent and child\n const newSelectorKeys = Object.keys(newStyles).filter(isSelector);\n const allSelectorKeys = new Set([...selectorKeys, ...newSelectorKeys]);\n\n for (const key of allSelectorKeys) {\n const newValue = newStyles?.[key];\n\n if (newValue === false || newValue === null) {\n delete resultStyles[key];\n } else if (newValue === undefined) {\n resultStyles[key] = styles[key];\n } else if (newValue) {\n resultStyles[key] = mergeSubElementStyles(\n styles[key] as StylesWithoutSelectors,\n newValue as StylesWithoutSelectors,\n );\n }\n }\n\n // Handle non-selector properties: state maps, null, undefined\n for (const key of Object.keys(newStyles)) {\n if (isSelector(key)) continue;\n\n const newValue = newStyles[key];\n\n if (newValue === undefined) {\n if (key in styles) {\n resultStyles[key] = styles[key];\n } else {\n delete resultStyles[key];\n }\n } else if (newValue === null) {\n delete resultStyles[key];\n } else if (isStateMap(newValue)) {\n (resultStyles as Record<string, unknown>)[key] = resolveStateMap(\n styles[key],\n newValue as Record<string, unknown>,\n );\n }\n }\n\n styles = resultStyles;\n }\n\n pos++;\n }\n\n return styles;\n}\n"],"mappings":";AAKA,SAAgB,WAAoB;CAElC,IAAI,OAAO,WAAW,eAAe,OAAO,cAC1C,IAAI;EACF,MAAM,kBAAkB,OAAO,aAAa,QAAQ,aAAa;EACjE,IACE,oBAAoB,QACpB,gBAAgB,YAAY,MAAM,QAElC,OAAO;CAEX,QAAQ,CAGR;CAIF,IAAI,OAAO,YAAY,aAAa,OAAO;CAG3C,MAAM,UAAA,QAAA,IAAA;CACN,OAAO,YAAY,UAAU,YAAY;AAC3C;;AC1BA,MAAM,SAAS;AAGf,MAAM,kCAAkB,IAAI,IAAY;AAExC,SAAgB,KAAK,GAAG,MAAiB;CACvC,QAAQ,KAAK,QAAQ,GAAG,IAAI;AAC9B;AAGA,SAAgB,YAAY,KAAa,SAAuB;CAC9D,IAAI,gBAAgB,IAAI,GAAG,GAAG;CAC9B,gBAAgB,IAAI,GAAG;CAEvB,IAAI,CAAC,SAAS,GA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