@aglyn/shared-util-tools 1.0.0-beta.284 → 1.0.0-beta.287

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/shared-util-tools",
3
- "version": "1.0.0-beta.284",
3
+ "version": "1.0.0-beta.287",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
@@ -25,7 +25,7 @@
25
25
  "./package.json": "./package.json"
26
26
  },
27
27
  "dependencies": {
28
- "@aglyn/shared-data-types": "1.0.0-beta.284",
28
+ "@aglyn/shared-data-types": "1.0.0-beta.287",
29
29
  "@swc/helpers": "0.5.23",
30
30
  "lodash-es": "^4.18.1",
31
31
  "php-serialize": "^5.1.3"
@@ -0,0 +1,81 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import type { HostTheme, HostThemeFontCategory, HostThemeTypographyVariantKey } from '@aglyn/shared-data-types';
18
+ /**
19
+ * A theme's body and heading fonts, read and written (AGL-3656).
20
+ *
21
+ * Moved here from `@aglyn/shared-ui-theme/util/theme-editor-fields`, which
22
+ * re-exports every name, so the theme editor, the AI site look and a site
23
+ * starter's theme (AGL-4049) set fonts through one writer. The editor's
24
+ * module is a UI library, which the platform core and the server data layer
25
+ * may not import; this one is a utility they can.
26
+ *
27
+ * Pure functions over `HostTheme`: no MUI, no React.
28
+ */
29
+ /** The CSS stack a theme names a family by: the family, then its generic fallback. */
30
+ export declare function fontFamilyStack(family: string, category: HostThemeFontCategory): string;
31
+ /**
32
+ * The text styles a separate heading font is set on: `h1`…`h6`, and
33
+ * `displayXl`, the platform's rung above `h1`, which a heading font left off
34
+ * would draw in the body font — and load the body font's heaviest weight for.
35
+ */
36
+ export declare const THEME_HEADING_VARIANTS: readonly HostThemeTypographyVariantKey[];
37
+ /**
38
+ * One family a theme sets text in, as the font picker shows and writes it
39
+ * (AGL-3656): a `fonts` entry and the role it plays.
40
+ */
41
+ export interface ThemeFontChoice {
42
+ family: string;
43
+ category: HostThemeFontCategory;
44
+ /** Upright weights to load, ascending. */
45
+ weights: number[];
46
+ /** Italic weights to load, ascending; absent or empty for none. */
47
+ italics?: number[];
48
+ source: 'google' | 'custom';
49
+ }
50
+ /**
51
+ * The theme's body font and, when it differs, its heading font. `null` is the
52
+ * theme default: the base stack, nothing loaded.
53
+ */
54
+ export interface ThemeFontSelection {
55
+ body: ThemeFontChoice | null;
56
+ heading: ThemeFontChoice | null;
57
+ }
58
+ /** The first family a CSS font-family stack names, unquoted. */
59
+ export declare function firstStackFamily(stack: unknown): string | undefined;
60
+ /**
61
+ * The body and heading fonts a theme sets text in (AGL-3656).
62
+ *
63
+ * The body font is the family the theme-wide stack names first, when the
64
+ * theme loads it: a font the theme lists that no stack names draws nothing,
65
+ * which is what the theme default is. The heading font is the family `h1`
66
+ * names, when that is a loaded font other than the body's.
67
+ */
68
+ export declare function readThemeFonts(theme: HostTheme | undefined): ThemeFontSelection;
69
+ /**
70
+ * Sets the theme's body and heading fonts (AGL-3656): the `fonts` entries the
71
+ * page loads, the theme-wide stack, and the stack of each style in
72
+ * {@link THEME_HEADING_VARIANTS} for a heading font of its own. `null` goes
73
+ * back to the theme default for that role.
74
+ *
75
+ * An uploaded (`custom`) font the theme lists but no longer sets text in is
76
+ * kept, because it is the site's own and is picked again from the list; a
77
+ * Google font nothing sets text in any more is dropped, so the page stops
78
+ * loading it. Everything else in the typography — sizes, weights, a variant's own
79
+ * family that is not a heading — is left as it was.
80
+ */
81
+ export declare function writeThemeFonts(theme: HostTheme, selection: ThemeFontSelection): HostTheme;
@@ -0,0 +1,185 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2026 Aglyn LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */ import { _ as _extends } from "@swc/helpers/_/_extends";
17
+ /**
18
+ * A theme's body and heading fonts, read and written (AGL-3656).
19
+ *
20
+ * Moved here from `@aglyn/shared-ui-theme/util/theme-editor-fields`, which
21
+ * re-exports every name, so the theme editor, the AI site look and a site
22
+ * starter's theme (AGL-4049) set fonts through one writer. The editor's
23
+ * module is a UI library, which the platform core and the server data layer
24
+ * may not import; this one is a utility they can.
25
+ *
26
+ * Pure functions over `HostTheme`: no MUI, no React.
27
+ */ /** The CSS stack a theme names a family by: the family, then its generic fallback. */ export function fontFamilyStack(family, category) {
28
+ const fallback = category === 'monospace' ? 'monospace' : category === 'serif' ? 'serif' : 'sans-serif';
29
+ return `"${family}", ${fallback}`;
30
+ }
31
+ /**
32
+ * The text styles a separate heading font is set on: `h1`…`h6`, and
33
+ * `displayXl`, the platform's rung above `h1`, which a heading font left off
34
+ * would draw in the body font — and load the body font's heaviest weight for.
35
+ */ export const THEME_HEADING_VARIANTS = [
36
+ 'displayXl',
37
+ 'h1',
38
+ 'h2',
39
+ 'h3',
40
+ 'h4',
41
+ 'h5',
42
+ 'h6'
43
+ ];
44
+ /** The first family a CSS font-family stack names, unquoted. */ export function firstStackFamily(stack) {
45
+ var _stack_split_;
46
+ if (typeof stack !== 'string') return undefined;
47
+ const first = (_stack_split_ = stack.split(',')[0]) == null ? void 0 : _stack_split_.trim().replace(/^["']|["']$/g, '').trim();
48
+ return first || undefined;
49
+ }
50
+ /** The category a stack's generic keyword names, for a font that records none. */ function stackCategory(stack) {
51
+ if (typeof stack !== 'string') return 'sans-serif';
52
+ if (/\bmonospace\b/i.test(stack)) return 'monospace';
53
+ if (/(^|,)\s*serif\b/i.test(stack)) return 'serif';
54
+ return 'sans-serif';
55
+ }
56
+ function sortedWeights(values) {
57
+ return [
58
+ ...new Set((values != null ? values : []).map((value)=>Math.round(Number(value))).filter((value)=>Number.isFinite(value) && value >= 1 && value <= 1000))
59
+ ].sort((a, b)=>a - b);
60
+ }
61
+ function choiceOf(font, stack) {
62
+ var _font_category;
63
+ const italics = sortedWeights(font.italics);
64
+ return _extends({
65
+ family: font.family.trim(),
66
+ category: (_font_category = font.category) != null ? _font_category : stackCategory(stack),
67
+ weights: sortedWeights(font.weights).length ? sortedWeights(font.weights) : [
68
+ 400
69
+ ]
70
+ }, italics.length ? {
71
+ italics
72
+ } : {}, {
73
+ source: font.source === 'custom' ? 'custom' : 'google'
74
+ });
75
+ }
76
+ function findFont(theme, family) {
77
+ var _theme_fonts;
78
+ if (!family) return undefined;
79
+ const wanted = family.toLowerCase();
80
+ return theme == null ? void 0 : (_theme_fonts = theme.fonts) == null ? void 0 : _theme_fonts.find((font)=>{
81
+ var _font_source;
82
+ var _font_family;
83
+ return ((_font_family = font.family) == null ? void 0 : _font_family.trim().toLowerCase()) === wanted && ((_font_source = font.source) != null ? _font_source : 'google') !== 'system';
84
+ });
85
+ }
86
+ /**
87
+ * The body and heading fonts a theme sets text in (AGL-3656).
88
+ *
89
+ * The body font is the family the theme-wide stack names first, when the
90
+ * theme loads it: a font the theme lists that no stack names draws nothing,
91
+ * which is what the theme default is. The heading font is the family `h1`
92
+ * names, when that is a loaded font other than the body's.
93
+ */ export function readThemeFonts(theme) {
94
+ var _theme_typography, _theme_typography_variants_h1, _theme_typography_variants, _theme_typography1;
95
+ const stack = theme == null ? void 0 : (_theme_typography = theme.typography) == null ? void 0 : _theme_typography.fontFamily;
96
+ const bodyFont = findFont(theme, firstStackFamily(stack));
97
+ const headingStack = theme == null ? void 0 : (_theme_typography1 = theme.typography) == null ? void 0 : (_theme_typography_variants = _theme_typography1.variants) == null ? void 0 : (_theme_typography_variants_h1 = _theme_typography_variants.h1) == null ? void 0 : _theme_typography_variants_h1.fontFamily;
98
+ const headingFont = findFont(theme, firstStackFamily(headingStack));
99
+ return {
100
+ body: bodyFont ? choiceOf(bodyFont, stack) : null,
101
+ heading: headingFont && headingFont !== bodyFont ? choiceOf(headingFont, headingStack) : null
102
+ };
103
+ }
104
+ function fontEntry(choice) {
105
+ const italics = sortedWeights(choice.italics);
106
+ return _extends({
107
+ family: choice.family.trim(),
108
+ weights: sortedWeights(choice.weights).length ? sortedWeights(choice.weights) : [
109
+ 400
110
+ ]
111
+ }, italics.length ? {
112
+ italics
113
+ } : {}, {
114
+ source: choice.source,
115
+ category: choice.category
116
+ });
117
+ }
118
+ /**
119
+ * Sets the theme's body and heading fonts (AGL-3656): the `fonts` entries the
120
+ * page loads, the theme-wide stack, and the stack of each style in
121
+ * {@link THEME_HEADING_VARIANTS} for a heading font of its own. `null` goes
122
+ * back to the theme default for that role.
123
+ *
124
+ * An uploaded (`custom`) font the theme lists but no longer sets text in is
125
+ * kept, because it is the site's own and is picked again from the list; a
126
+ * Google font nothing sets text in any more is dropped, so the page stops
127
+ * loading it. Everything else in the typography — sizes, weights, a variant's own
128
+ * family that is not a heading — is left as it was.
129
+ */ export function writeThemeFonts(theme, selection) {
130
+ var _ref, _theme_fonts;
131
+ var _theme_typography_variants_h1, _theme_typography_variants, _theme_typography, _theme_typography1;
132
+ const body = selection.body;
133
+ const heading = selection.heading && (!body || selection.heading.family.toLowerCase() !== body.family.toLowerCase()) ? selection.heading : null;
134
+ const previous = readThemeFonts(theme);
135
+ const previousHeadingStack = previous.heading ? (_theme_typography = theme.typography) == null ? void 0 : (_theme_typography_variants = _theme_typography.variants) == null ? void 0 : (_theme_typography_variants_h1 = _theme_typography_variants.h1) == null ? void 0 : _theme_typography_variants_h1.fontFamily : undefined;
136
+ const chosen = [
137
+ body,
138
+ heading
139
+ ].filter((entry)=>!!entry);
140
+ const chosenKeys = new Set(chosen.map((entry)=>entry.family.trim().toLowerCase()));
141
+ // Families a text style other than a heading still names, by hand or by
142
+ // an earlier editor: they keep loading, as their style keeps drawing them.
143
+ const otherStyles = new Set(Object.entries((_ref = (_theme_typography1 = theme.typography) == null ? void 0 : _theme_typography1.variants) != null ? _ref : {}).filter(([key])=>!THEME_HEADING_VARIANTS.includes(key)).map(([, variant])=>{
144
+ var _firstStackFamily;
145
+ return (_firstStackFamily = firstStackFamily(variant == null ? void 0 : variant.fontFamily)) == null ? void 0 : _firstStackFamily.toLowerCase();
146
+ }).filter((family)=>!!family));
147
+ const kept = ((_theme_fonts = theme.fonts) != null ? _theme_fonts : []).filter((font)=>{
148
+ var _ref;
149
+ var _font_family;
150
+ const key = (_ref = (_font_family = font.family) == null ? void 0 : _font_family.trim().toLowerCase()) != null ? _ref : '';
151
+ if (!key || chosenKeys.has(key)) return false;
152
+ return font.source === 'custom' || otherStyles.has(key);
153
+ });
154
+ const fonts = [
155
+ ...chosen.map(fontEntry),
156
+ ...kept
157
+ ];
158
+ const typography = _extends({}, theme.typography);
159
+ if (body) typography.fontFamily = fontFamilyStack(body.family.trim(), body.category);
160
+ else delete typography.fontFamily;
161
+ const variants = _extends({}, typography.variants);
162
+ for (const key of THEME_HEADING_VARIANTS){
163
+ const variant = _extends({}, variants[key]);
164
+ if (heading) {
165
+ variant.fontFamily = fontFamilyStack(heading.family.trim(), heading.category);
166
+ } else if (variant.fontFamily !== undefined && (variant.fontFamily === previousHeadingStack || !findFont({
167
+ fonts
168
+ }, firstStackFamily(variant.fontFamily)))) {
169
+ // The heading font this theme had, or a family it no longer loads.
170
+ delete variant.fontFamily;
171
+ }
172
+ if (Object.keys(variant).length) variants[key] = variant;
173
+ else delete variants[key];
174
+ }
175
+ if (Object.keys(variants).length) typography.variants = variants;
176
+ else delete typography.variants;
177
+ const next = _extends({}, theme);
178
+ if (fonts.length) next.fonts = fonts;
179
+ else delete next.fonts;
180
+ if (Object.keys(typography).length) next.typography = typography;
181
+ else delete next.typography;
182
+ return next;
183
+ }
184
+
185
+ //# sourceMappingURL=theme-fonts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/shared/util/tools/src/lib/theme-fonts.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2026 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport type {\n HostTheme,\n HostThemeFont,\n HostThemeFontCategory,\n HostThemeTypographyVariantKey,\n} from '@aglyn/shared-data-types'\n\n/**\n * A theme's body and heading fonts, read and written (AGL-3656).\n *\n * Moved here from `@aglyn/shared-ui-theme/util/theme-editor-fields`, which\n * re-exports every name, so the theme editor, the AI site look and a site\n * starter's theme (AGL-4049) set fonts through one writer. The editor's\n * module is a UI library, which the platform core and the server data layer\n * may not import; this one is a utility they can.\n *\n * Pure functions over `HostTheme`: no MUI, no React.\n */\n\n/** The CSS stack a theme names a family by: the family, then its generic fallback. */\nexport function fontFamilyStack(\n family: string,\n category: HostThemeFontCategory,\n) {\n const fallback = category === 'monospace' ? 'monospace' : category === 'serif' ? 'serif' : 'sans-serif'\n return `\"${family}\", ${fallback}`\n}\n\n/**\n * The text styles a separate heading font is set on: `h1`…`h6`, and\n * `displayXl`, the platform's rung above `h1`, which a heading font left off\n * would draw in the body font — and load the body font's heaviest weight for.\n */\nexport const THEME_HEADING_VARIANTS: readonly HostThemeTypographyVariantKey[] = [\n 'displayXl',\n 'h1',\n 'h2',\n 'h3',\n 'h4',\n 'h5',\n 'h6',\n]\n\n/**\n * One family a theme sets text in, as the font picker shows and writes it\n * (AGL-3656): a `fonts` entry and the role it plays.\n */\nexport interface ThemeFontChoice {\n family: string\n category: HostThemeFontCategory\n /** Upright weights to load, ascending. */\n weights: number[]\n /** Italic weights to load, ascending; absent or empty for none. */\n italics?: number[]\n source: 'google' | 'custom'\n}\n\n/**\n * The theme's body font and, when it differs, its heading font. `null` is the\n * theme default: the base stack, nothing loaded.\n */\nexport interface ThemeFontSelection {\n body: ThemeFontChoice | null\n heading: ThemeFontChoice | null\n}\n\n/** The first family a CSS font-family stack names, unquoted. */\nexport function firstStackFamily(stack: unknown): string | undefined {\n if (typeof stack !== 'string') return undefined\n const first = stack.split(',')[0]?.trim().replace(/^[\"']|[\"']$/g, '').trim()\n return first || undefined\n}\n\n/** The category a stack's generic keyword names, for a font that records none. */\nfunction stackCategory(stack: unknown): HostThemeFontCategory {\n if (typeof stack !== 'string') return 'sans-serif'\n if (/\\bmonospace\\b/i.test(stack)) return 'monospace'\n if (/(^|,)\\s*serif\\b/i.test(stack)) return 'serif'\n return 'sans-serif'\n}\n\nfunction sortedWeights(values: readonly unknown[] | undefined): number[] {\n return [\n ...new Set(\n (values ?? [])\n .map((value) => Math.round(Number(value)))\n .filter((value) => Number.isFinite(value) && value >= 1 && value <= 1000),\n ),\n ].sort((a, b) => a - b)\n}\n\nfunction choiceOf(font: HostThemeFont, stack: unknown): ThemeFontChoice {\n const italics = sortedWeights(font.italics)\n return {\n family: font.family.trim(),\n category: font.category ?? stackCategory(stack),\n weights: sortedWeights(font.weights).length ? sortedWeights(font.weights) : [400],\n ...(italics.length ? { italics } : {}),\n source: font.source === 'custom' ? 'custom' : 'google',\n }\n}\n\nfunction findFont(theme: HostTheme | undefined, family: string | undefined) {\n if (!family) return undefined\n const wanted = family.toLowerCase()\n return theme?.fonts?.find(\n (font) =>\n font.family?.trim().toLowerCase() === wanted && (font.source ?? 'google') !== 'system',\n )\n}\n\n/**\n * The body and heading fonts a theme sets text in (AGL-3656).\n *\n * The body font is the family the theme-wide stack names first, when the\n * theme loads it: a font the theme lists that no stack names draws nothing,\n * which is what the theme default is. The heading font is the family `h1`\n * names, when that is a loaded font other than the body's.\n */\nexport function readThemeFonts(theme: HostTheme | undefined): ThemeFontSelection {\n const stack = theme?.typography?.fontFamily\n const bodyFont = findFont(theme, firstStackFamily(stack))\n const headingStack = theme?.typography?.variants?.h1?.fontFamily\n const headingFont = findFont(theme, firstStackFamily(headingStack))\n return {\n body: bodyFont ? choiceOf(bodyFont, stack) : null,\n heading:\n headingFont && headingFont !== bodyFont ? choiceOf(headingFont, headingStack) : null,\n }\n}\n\nfunction fontEntry(choice: ThemeFontChoice): HostThemeFont {\n const italics = sortedWeights(choice.italics)\n return {\n family: choice.family.trim(),\n weights: sortedWeights(choice.weights).length ? sortedWeights(choice.weights) : [400],\n ...(italics.length ? { italics } : {}),\n source: choice.source,\n category: choice.category,\n }\n}\n\n/**\n * Sets the theme's body and heading fonts (AGL-3656): the `fonts` entries the\n * page loads, the theme-wide stack, and the stack of each style in\n * {@link THEME_HEADING_VARIANTS} for a heading font of its own. `null` goes\n * back to the theme default for that role.\n *\n * An uploaded (`custom`) font the theme lists but no longer sets text in is\n * kept, because it is the site's own and is picked again from the list; a\n * Google font nothing sets text in any more is dropped, so the page stops\n * loading it. Everything else in the typography — sizes, weights, a variant's own\n * family that is not a heading — is left as it was.\n */\nexport function writeThemeFonts(theme: HostTheme, selection: ThemeFontSelection): HostTheme {\n const body = selection.body\n const heading =\n selection.heading &&\n (!body || selection.heading.family.toLowerCase() !== body.family.toLowerCase())\n ? selection.heading\n : null\n const previous = readThemeFonts(theme)\n const previousHeadingStack = previous.heading\n ? theme.typography?.variants?.h1?.fontFamily\n : undefined\n\n const chosen = [body, heading].filter((entry): entry is ThemeFontChoice => !!entry)\n const chosenKeys = new Set(chosen.map((entry) => entry.family.trim().toLowerCase()))\n // Families a text style other than a heading still names, by hand or by\n // an earlier editor: they keep loading, as their style keeps drawing them.\n const otherStyles = new Set(\n Object.entries(theme.typography?.variants ?? {})\n .filter(([key]) => !(THEME_HEADING_VARIANTS as readonly string[]).includes(key))\n .map(([, variant]) => firstStackFamily(variant?.fontFamily)?.toLowerCase())\n .filter((family): family is string => !!family),\n )\n const kept = (theme.fonts ?? []).filter((font) => {\n const key = font.family?.trim().toLowerCase() ?? ''\n if (!key || chosenKeys.has(key)) return false\n return font.source === 'custom' || otherStyles.has(key)\n })\n const fonts = [...chosen.map(fontEntry), ...kept]\n\n const typography = { ...theme.typography }\n if (body) typography.fontFamily = fontFamilyStack(body.family.trim(), body.category)\n else delete typography.fontFamily\n\n const variants = { ...typography.variants }\n for (const key of THEME_HEADING_VARIANTS) {\n const variant = { ...variants[key] }\n if (heading) {\n variant.fontFamily = fontFamilyStack(heading.family.trim(), heading.category)\n } else if (\n variant.fontFamily !== undefined &&\n (variant.fontFamily === previousHeadingStack ||\n !findFont({ fonts }, firstStackFamily(variant.fontFamily)))\n ) {\n // The heading font this theme had, or a family it no longer loads.\n delete variant.fontFamily\n }\n if (Object.keys(variant).length) variants[key] = variant\n else delete variants[key]\n }\n if (Object.keys(variants).length) typography.variants = variants\n else delete typography.variants\n\n const next: HostTheme = { ...theme }\n if (fonts.length) next.fonts = fonts\n else delete next.fonts\n if (Object.keys(typography).length) next.typography = typography\n else delete next.typography\n return next\n}\n"],"names":["fontFamilyStack","family","category","fallback","THEME_HEADING_VARIANTS","firstStackFamily","stack","undefined","first","split","trim","replace","stackCategory","test","sortedWeights","values","Set","map","value","Math","round","Number","filter","isFinite","sort","a","b","choiceOf","font","italics","weights","length","source","findFont","theme","wanted","toLowerCase","fonts","find","readThemeFonts","typography","fontFamily","bodyFont","headingStack","variants","h1","headingFont","body","heading","fontEntry","choice","writeThemeFonts","selection","previous","previousHeadingStack","chosen","entry","chosenKeys","otherStyles","Object","entries","key","includes","variant","kept","has","keys","next"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC;AAQD;;;;;;;;;;CAUC,GAED,oFAAoF,GACpF,OAAO,SAASA,gBACdC,MAAc,EACdC,QAA+B;IAE/B,MAAMC,WAAWD,aAAa,cAAc,cAAcA,aAAa,UAAU,UAAU;IAC3F,OAAO,CAAC,CAAC,EAAED,OAAO,GAAG,EAAEE,UAAU;AACnC;AAEA;;;;CAIC,GACD,OAAO,MAAMC,yBAAmE;IAC9E;IACA;IACA;IACA;IACA;IACA;IACA;CACD,CAAA;AAyBD,8DAA8D,GAC9D,OAAO,SAASC,iBAAiBC,KAAc;QAE/BA;IADd,IAAI,OAAOA,UAAU,UAAU,OAAOC;IACtC,MAAMC,SAAQF,gBAAAA,MAAMG,KAAK,CAAC,IAAI,CAAC,EAAE,qBAAnBH,cAAqBI,IAAI,GAAGC,OAAO,CAAC,gBAAgB,IAAID,IAAI;IAC1E,OAAOF,SAASD;AAClB;AAEA,gFAAgF,GAChF,SAASK,cAAcN,KAAc;IACnC,IAAI,OAAOA,UAAU,UAAU,OAAO;IACtC,IAAI,iBAAiBO,IAAI,CAACP,QAAQ,OAAO;IACzC,IAAI,mBAAmBO,IAAI,CAACP,QAAQ,OAAO;IAC3C,OAAO;AACT;AAEA,SAASQ,cAAcC,MAAsC;IAC3D,OAAO;WACF,IAAIC,IACL,CAACD,iBAAAA,SAAU,EAAE,EACVE,GAAG,CAAC,CAACC,QAAUC,KAAKC,KAAK,CAACC,OAAOH,SACjCI,MAAM,CAAC,CAACJ,QAAUG,OAAOE,QAAQ,CAACL,UAAUA,SAAS,KAAKA,SAAS;KAEzE,CAACM,IAAI,CAAC,CAACC,GAAGC,IAAMD,IAAIC;AACvB;AAEA,SAASC,SAASC,IAAmB,EAAEtB,KAAc;QAIvCsB;IAHZ,MAAMC,UAAUf,cAAcc,KAAKC,OAAO;IAC1C,OAAO;QACL5B,QAAQ2B,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