@tamagui/static 3.0.0-beta.1093.1 → 3.0.0-beta.1097.1
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.
- package/dist/cjs/compilerHost.cjs +13 -11
- package/dist/cjs/zero/islands.cjs +2 -1
- package/dist/esm/compilerHost.mjs +13 -11
- package/dist/esm/compilerHost.mjs.map +1 -1
- package/dist/esm/zero/islands.mjs +2 -1
- package/dist/esm/zero/islands.mjs.map +1 -1
- package/package.json +18 -18
- package/src/compilerHost.ts +13 -26
- package/src/zero/islands.ts +2 -1
- package/types/compilerHost.d.ts.map +1 -1
- package/types/zero/islands.d.ts.map +1 -1
|
@@ -127,7 +127,8 @@ function generateIslandEntrySource(input) {
|
|
|
127
127
|
const entry = input.island.entry;
|
|
128
128
|
return `// generated by @tamagui/static zero-runtime. do not edit.
|
|
129
129
|
import * as React from 'react'
|
|
130
|
-
import { TamaguiProvider
|
|
130
|
+
import { TamaguiProvider } from 'tamagui/provider'
|
|
131
|
+
import { Theme } from '@tamagui/core'
|
|
131
132
|
import { createThemeUpdateState } from '@tamagui/web/theme-update'
|
|
132
133
|
import config from ${JSON.stringify(importPath(entry, input.configPath))}
|
|
133
134
|
import IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"islands.js","names":[],"sources":["esm/zero/islands.js"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nconst ISLAND_RUNTIME_KEY = \"__tamagui_island_runtime__\";\nconst ISLAND_REGISTRY_KEY = \"__tamagui_islands__\";\nfunction writeIfChanged(file, content) {\n mkdirSync(path.dirname(file), { recursive: true });\n let existing = null;\n try {\n existing = readFileSync(file, \"utf8\");\n } catch {\n existing = null;\n }\n if (existing !== content) writeFileSync(file, content);\n}\nfunction importPath(from, to) {\n const relative = path.relative(path.dirname(from), to).replace(/\\\\/g, \"/\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\nfunction generateIslandLoaderSource(input) {\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport * as JSXRuntime from 'react/jsx-runtime'\n\nconst ISLAND_ID = ${JSON.stringify(input.island.id)}\nconst ISLAND_SRC = ${JSON.stringify(input.scriptUrl)}\nconst CSS_HREF = ${JSON.stringify(input.cssHref)}\nconst INTEGRATION = ${JSON.stringify(input.integration)}\n\nfunction sharedRuntime() {\n const scope = globalThis\n if (!scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}]) {\n scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}] = {\n react: React,\n reactDom: ReactDOM,\n jsxRuntime: JSXRuntime,\n }\n }\n if (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) {\n scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\n }\n return scope\n}\n\n// The one accepted runtime recovery in zero-runtime mode, and it is loud on\n// purpose. \"Unimported\" is not decidable at build time for a published zero\n// artifact on Next or Metro, so the loader still guarantees the island has its\n// styles; on a correct build this never runs.\nfunction ensureZeroStylesheet() {\n const links = document.querySelectorAll('link[rel=\"stylesheet\"]')\n for (let index = 0; index < links.length; index++) {\n const href = links[index].getAttribute('href') || ''\n if (href === CSS_HREF || href.split('?')[0].endsWith(CSS_HREF)) return\n }\n console.error(\n '[tamagui zero-runtime] the page did not link the generated CSS artifact ' +\n CSS_HREF +\n ', so island \"' +\n ISLAND_ID +\n '\" (' +\n INTEGRATION +\n ') is loading it at runtime. On a correct build this never happens: the ' +\n 'artifact is generated by the build and must be linked by the document ' +\n 'that mounts the island. Fix the document, not this recovery.'\n )\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = CSS_HREF\n link.setAttribute('data-tamagui-zero-css', '1')\n document.head.appendChild(link)\n}\n\nlet pending = null\n\nfunction loadIsland() {\n const scope = sharedRuntime()\n const registered = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (registered) return Promise.resolve(registered)\n if (!pending) {\n pending = new Promise((resolve, reject) => {\n ensureZeroStylesheet()\n const script = document.createElement('script')\n script.src = ISLAND_SRC\n script.async = true\n script.onload = () => {\n const mod = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (mod) resolve(mod)\n else reject(new Error('tamagui island ' + ISLAND_ID + ' did not register'))\n }\n script.onerror = () => reject(new Error('tamagui island ' + ISLAND_ID + ' failed to load ' + ISLAND_SRC))\n document.head.appendChild(script)\n })\n }\n return pending\n}\n\nexport default function TamaguiIsland(props) {\n const bridgeId = props['data-tamagui-bridge'] || 'root'\n const [Loaded, setLoaded] = React.useState(null)\n\n React.useEffect(() => {\n let cancelled = false\n loadIsland().then((mod) => {\n if (!cancelled) setLoaded(() => mod.Island)\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n if (!Loaded) {\n return React.createElement('div', {\n 'data-tamagui-island': ISLAND_ID,\n 'data-tamagui-bridge': bridgeId,\n })\n }\n\n const forwarded = {}\n for (const key in props) forwarded[key] = props[key]\n forwarded['data-tamagui-island'] = ISLAND_ID\n return React.createElement(Loaded, forwarded)\n}\n`;\n}\nfunction generateIslandEntrySource(input) {\n const entry = input.island.entry;\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport { TamaguiProvider
|
|
1
|
+
{"version":3,"file":"islands.js","names":[],"sources":["esm/zero/islands.js"],"sourcesContent":["import { mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport path from \"node:path\";\nconst ISLAND_RUNTIME_KEY = \"__tamagui_island_runtime__\";\nconst ISLAND_REGISTRY_KEY = \"__tamagui_islands__\";\nfunction writeIfChanged(file, content) {\n mkdirSync(path.dirname(file), { recursive: true });\n let existing = null;\n try {\n existing = readFileSync(file, \"utf8\");\n } catch {\n existing = null;\n }\n if (existing !== content) writeFileSync(file, content);\n}\nfunction importPath(from, to) {\n const relative = path.relative(path.dirname(from), to).replace(/\\\\/g, \"/\");\n return relative.startsWith(\".\") ? relative : `./${relative}`;\n}\nfunction generateIslandLoaderSource(input) {\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport * as ReactDOM from 'react-dom'\nimport * as JSXRuntime from 'react/jsx-runtime'\n\nconst ISLAND_ID = ${JSON.stringify(input.island.id)}\nconst ISLAND_SRC = ${JSON.stringify(input.scriptUrl)}\nconst CSS_HREF = ${JSON.stringify(input.cssHref)}\nconst INTEGRATION = ${JSON.stringify(input.integration)}\n\nfunction sharedRuntime() {\n const scope = globalThis\n if (!scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}]) {\n scope[${JSON.stringify(ISLAND_RUNTIME_KEY)}] = {\n react: React,\n reactDom: ReactDOM,\n jsxRuntime: JSXRuntime,\n }\n }\n if (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) {\n scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\n }\n return scope\n}\n\n// The one accepted runtime recovery in zero-runtime mode, and it is loud on\n// purpose. \"Unimported\" is not decidable at build time for a published zero\n// artifact on Next or Metro, so the loader still guarantees the island has its\n// styles; on a correct build this never runs.\nfunction ensureZeroStylesheet() {\n const links = document.querySelectorAll('link[rel=\"stylesheet\"]')\n for (let index = 0; index < links.length; index++) {\n const href = links[index].getAttribute('href') || ''\n if (href === CSS_HREF || href.split('?')[0].endsWith(CSS_HREF)) return\n }\n console.error(\n '[tamagui zero-runtime] the page did not link the generated CSS artifact ' +\n CSS_HREF +\n ', so island \"' +\n ISLAND_ID +\n '\" (' +\n INTEGRATION +\n ') is loading it at runtime. On a correct build this never happens: the ' +\n 'artifact is generated by the build and must be linked by the document ' +\n 'that mounts the island. Fix the document, not this recovery.'\n )\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = CSS_HREF\n link.setAttribute('data-tamagui-zero-css', '1')\n document.head.appendChild(link)\n}\n\nlet pending = null\n\nfunction loadIsland() {\n const scope = sharedRuntime()\n const registered = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (registered) return Promise.resolve(registered)\n if (!pending) {\n pending = new Promise((resolve, reject) => {\n ensureZeroStylesheet()\n const script = document.createElement('script')\n script.src = ISLAND_SRC\n script.async = true\n script.onload = () => {\n const mod = scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][ISLAND_ID]\n if (mod) resolve(mod)\n else reject(new Error('tamagui island ' + ISLAND_ID + ' did not register'))\n }\n script.onerror = () => reject(new Error('tamagui island ' + ISLAND_ID + ' failed to load ' + ISLAND_SRC))\n document.head.appendChild(script)\n })\n }\n return pending\n}\n\nexport default function TamaguiIsland(props) {\n const bridgeId = props['data-tamagui-bridge'] || 'root'\n const [Loaded, setLoaded] = React.useState(null)\n\n React.useEffect(() => {\n let cancelled = false\n loadIsland().then((mod) => {\n if (!cancelled) setLoaded(() => mod.Island)\n })\n return () => {\n cancelled = true\n }\n }, [])\n\n if (!Loaded) {\n return React.createElement('div', {\n 'data-tamagui-island': ISLAND_ID,\n 'data-tamagui-bridge': bridgeId,\n })\n }\n\n const forwarded = {}\n for (const key in props) forwarded[key] = props[key]\n forwarded['data-tamagui-island'] = ISLAND_ID\n return React.createElement(Loaded, forwarded)\n}\n`;\n}\nfunction generateIslandEntrySource(input) {\n const entry = input.island.entry;\n return `// generated by @tamagui/static zero-runtime. do not edit.\nimport * as React from 'react'\nimport { TamaguiProvider } from 'tamagui/provider'\nimport { Theme } from '@tamagui/core'\nimport { createThemeUpdateState } from '@tamagui/web/theme-update'\nimport config from ${JSON.stringify(importPath(entry, input.configPath))}\nimport IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}\n\nexport function Island(props) {\n const bridge = props.__tamaguiBridge\n const inner = {}\n for (const key in props) {\n if (key !== '__tamaguiBridge') inner[key] = props[key]\n }\n let node = React.createElement(IslandRoot, inner)\n const layers = (bridge && bridge.layers) || []\n for (let index = layers.length - 1; index >= 0; index--) {\n node = React.createElement(\n Theme,\n {\n _themeUpdate: createThemeUpdateState(\n layers[index].inlineValues,\n layers[index].inlineClassName\n ),\n forceClassName: true,\n },\n node\n )\n }\n // isSubtreeRoot: the island shares a document with a zero page that already\n // has its own compiled theme spans, so its provider must not write a theme\n // class onto html or body and must carry its own theme on its own node.\n return React.createElement(\n TamaguiProvider,\n {\n config,\n defaultTheme: (bridge && bridge.name) || 'light',\n disableInjectCSS: true,\n isSubtreeRoot: true,\n },\n node\n )\n}\n\nconst scope = globalThis\nif (!scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}]) scope[${JSON.stringify(ISLAND_REGISTRY_KEY)}] = {}\nscope[${JSON.stringify(ISLAND_REGISTRY_KEY)}][${JSON.stringify(input.island.id)}] = { Island }\n`;\n}\nfunction writeIslandModules(input) {\n writeIfChanged(input.island.loader, generateIslandLoaderSource(input));\n writeIfChanged(input.island.entry, generateIslandEntrySource(input));\n}\nconst ISLAND_EXTERNAL_GLOBAL_PATHS = {\n react: [ISLAND_RUNTIME_KEY, \"react\"],\n \"react-dom\": [ISLAND_RUNTIME_KEY, \"reactDom\"],\n \"react/jsx-runtime\": [ISLAND_RUNTIME_KEY, \"jsxRuntime\"]\n};\nconst ISLAND_EXTERNAL_GLOBALS = Object.fromEntries(\n Object.entries(ISLAND_EXTERNAL_GLOBAL_PATHS).map(([name, segments]) => [\n name,\n `globalThis.${segments.join(\".\")}`\n ])\n);\nfunction mergeIslandBridges(target, incoming) {\n for (const [islandId, bridges] of incoming) {\n const list = target.get(islandId) ?? [];\n for (const bridge of bridges) {\n const index = list.findIndex((existing) => existing.id === bridge.id);\n if (index >= 0) list[index] = bridge;\n else list.push(bridge);\n }\n list.sort((left, right) => left.id < right.id ? -1 : left.id > right.id ? 1 : 0);\n target.set(islandId, list);\n }\n}\nexport {\n ISLAND_EXTERNAL_GLOBALS,\n ISLAND_EXTERNAL_GLOBAL_PATHS,\n ISLAND_REGISTRY_KEY,\n ISLAND_RUNTIME_KEY,\n generateIslandEntrySource,\n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14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"source": "src/index.ts",
|
|
@@ -45,22 +45,22 @@
|
|
|
45
45
|
"clean:build": "tamagui-build clean:build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@tamagui/animation-helpers": "3.0.0-beta.
|
|
49
|
-
"@tamagui/cli-color": "3.0.0-beta.
|
|
50
|
-
"@tamagui/compiler-core": "3.0.0-beta.
|
|
51
|
-
"@tamagui/config-default": "3.0.0-beta.
|
|
52
|
-
"@tamagui/core": "3.0.0-beta.
|
|
53
|
-
"@tamagui/dom": "3.0.0-beta.
|
|
54
|
-
"@tamagui/fake-react-native": "3.0.0-beta.
|
|
55
|
-
"@tamagui/generate-themes": "3.0.0-beta.
|
|
56
|
-
"@tamagui/helpers": "3.0.0-beta.
|
|
57
|
-
"@tamagui/helpers-node": "3.0.0-beta.
|
|
58
|
-
"@tamagui/react-native-web-internals": "3.0.0-beta.
|
|
59
|
-
"@tamagui/react-native-web-lite": "3.0.0-beta.
|
|
60
|
-
"@tamagui/shorthands": "3.0.0-beta.
|
|
61
|
-
"@tamagui/style-grammar": "3.0.0-beta.
|
|
62
|
-
"@tamagui/types": "3.0.0-beta.
|
|
63
|
-
"@tamagui/web": "3.0.0-beta.
|
|
48
|
+
"@tamagui/animation-helpers": "3.0.0-beta.1097.1",
|
|
49
|
+
"@tamagui/cli-color": "3.0.0-beta.1097.1",
|
|
50
|
+
"@tamagui/compiler-core": "3.0.0-beta.1097.1",
|
|
51
|
+
"@tamagui/config-default": "3.0.0-beta.1097.1",
|
|
52
|
+
"@tamagui/core": "3.0.0-beta.1097.1",
|
|
53
|
+
"@tamagui/dom": "3.0.0-beta.1097.1",
|
|
54
|
+
"@tamagui/fake-react-native": "3.0.0-beta.1097.1",
|
|
55
|
+
"@tamagui/generate-themes": "3.0.0-beta.1097.1",
|
|
56
|
+
"@tamagui/helpers": "3.0.0-beta.1097.1",
|
|
57
|
+
"@tamagui/helpers-node": "3.0.0-beta.1097.1",
|
|
58
|
+
"@tamagui/react-native-web-internals": "3.0.0-beta.1097.1",
|
|
59
|
+
"@tamagui/react-native-web-lite": "3.0.0-beta.1097.1",
|
|
60
|
+
"@tamagui/shorthands": "3.0.0-beta.1097.1",
|
|
61
|
+
"@tamagui/style-grammar": "3.0.0-beta.1097.1",
|
|
62
|
+
"@tamagui/types": "3.0.0-beta.1097.1",
|
|
63
|
+
"@tamagui/web": "3.0.0-beta.1097.1",
|
|
64
64
|
"browserslist": "^4.28.1",
|
|
65
65
|
"check-dependency-version-consistency": "^4.1.0",
|
|
66
66
|
"esbuild": "0.28.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"react-native-web": "~0.21.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
|
-
"@tamagui/build": "3.0.0-beta.
|
|
75
|
+
"@tamagui/build": "3.0.0-beta.1097.1",
|
|
76
76
|
"@types/find-root": "^1.1.2",
|
|
77
77
|
"@types/node": "^22.1.0",
|
|
78
78
|
"@types/webpack": "^4.41.26",
|
package/src/compilerHost.ts
CHANGED
|
@@ -140,14 +140,6 @@ function componentKey(resolvedId: string, exportName: string): string {
|
|
|
140
140
|
return `${resolvedId}#${exportName}`
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
function cssFromRules(rules: Record<string, any>): string[] {
|
|
144
|
-
return Object.values(rules).flatMap((styleObject: any) => {
|
|
145
|
-
const identifier = styleObject?.[StyleObjectIdentifier]
|
|
146
|
-
const styleRules = styleObject?.[StyleObjectRules]
|
|
147
|
-
return identifier && Array.isArray(styleRules) ? styleRules : []
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
|
|
151
143
|
function jsxClassName(value: string): string {
|
|
152
144
|
return `className=${JSON.stringify(value)}`
|
|
153
145
|
}
|
|
@@ -215,7 +207,16 @@ function extractedStyleArtifacts(
|
|
|
215
207
|
? viewClassName.slice(0, -callerClassName.length).trimEnd()
|
|
216
208
|
: viewClassName
|
|
217
209
|
const rules = split.rulesToInsert ?? {}
|
|
218
|
-
const mediaNames =
|
|
210
|
+
const mediaNames = Object.keys(config.media ?? {})
|
|
211
|
+
const rulesByIdentifier = new Map<string, string[]>()
|
|
212
|
+
for (const styleObject of Object.values(rules) as any[]) {
|
|
213
|
+
const identifier = styleObject?.[StyleObjectIdentifier]
|
|
214
|
+
const styleRules = styleObject?.[StyleObjectRules]
|
|
215
|
+
if (typeof identifier !== 'string' || !Array.isArray(styleRules)) continue
|
|
216
|
+
const existing = rulesByIdentifier.get(identifier)
|
|
217
|
+
if (existing) existing.push(...styleRules)
|
|
218
|
+
else rulesByIdentifier.set(identifier, [...styleRules])
|
|
219
|
+
}
|
|
219
220
|
const pseudoNames = [
|
|
220
221
|
'hover',
|
|
221
222
|
'press',
|
|
@@ -244,21 +245,14 @@ function extractedStyleArtifacts(
|
|
|
244
245
|
])
|
|
245
246
|
for (const identifier of identifiers) {
|
|
246
247
|
const key = classKeys.get(identifier) ?? ''
|
|
247
|
-
const css =
|
|
248
|
-
Object.fromEntries(
|
|
249
|
-
Object.entries(rules).filter(
|
|
250
|
-
([, styleObject]: [string, any]) =>
|
|
251
|
-
styleObject?.[StyleObjectIdentifier] === identifier
|
|
252
|
-
)
|
|
253
|
-
)
|
|
254
|
-
).join('')
|
|
248
|
+
const css = (rulesByIdentifier.get(identifier) ?? []).join('')
|
|
255
249
|
if (identifier.startsWith('t_group_')) {
|
|
256
250
|
buckets.group.push(identifier)
|
|
257
251
|
} else if (pseudoNames.some((name) => key.endsWith(`-${name}`))) {
|
|
258
252
|
buckets.pseudo.push(identifier)
|
|
259
253
|
} else if (css.includes('.t_')) {
|
|
260
254
|
buckets.theme.push(identifier)
|
|
261
|
-
} else if (
|
|
255
|
+
} else if (mediaNames.some((name) => key.endsWith(`-${name}`))) {
|
|
262
256
|
buckets.media.push(identifier)
|
|
263
257
|
} else {
|
|
264
258
|
buckets.normal.push(identifier)
|
|
@@ -279,14 +273,7 @@ function extractedStyleArtifacts(
|
|
|
279
273
|
.join(' ')
|
|
280
274
|
: ''
|
|
281
275
|
const css = orderedIdentifiers.flatMap((identifier) => {
|
|
282
|
-
const identifierRules =
|
|
283
|
-
Object.fromEntries(
|
|
284
|
-
Object.entries(rules).filter(
|
|
285
|
-
([, styleObject]: [string, any]) =>
|
|
286
|
-
styleObject?.[StyleObjectIdentifier] === identifier
|
|
287
|
-
)
|
|
288
|
-
)
|
|
289
|
-
)
|
|
276
|
+
const identifierRules = rulesByIdentifier.get(identifier) ?? []
|
|
290
277
|
// The legacy static theme-block path adds one root specificity level after
|
|
291
278
|
// resolving tokens. Keep that output contract until the legacy oracle is removed.
|
|
292
279
|
return buckets.theme.includes(identifier)
|
package/src/zero/islands.ts
CHANGED
|
@@ -169,7 +169,8 @@ export function generateIslandEntrySource(input: IslandGenerationInput): string
|
|
|
169
169
|
const entry = input.island.entry
|
|
170
170
|
return `// generated by @tamagui/static zero-runtime. do not edit.
|
|
171
171
|
import * as React from 'react'
|
|
172
|
-
import { TamaguiProvider
|
|
172
|
+
import { TamaguiProvider } from 'tamagui/provider'
|
|
173
|
+
import { Theme } from '@tamagui/core'
|
|
173
174
|
import { createThemeUpdateState } from '@tamagui/web/theme-update'
|
|
174
175
|
import config from ${JSON.stringify(importPath(entry, input.configPath))}
|
|
175
176
|
import IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compilerHost.d.ts","sourceRoot":"","sources":["../src/compilerHost.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,oBAAoB,EACpB,cAAc,EAQf,MAAM,wBAAwB,CAAA;AAqC/B,OAAO,KAAK,EAAiC,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAExF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAIhE,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA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