juxscript 1.1.82 → 1.1.87

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "totalComponents": 63,
3
- "generatedAt": "2026-02-12T04:14:03.006Z",
3
+ "generatedAt": "2026-02-12T18:17:52.009Z",
4
4
  "components": [
5
5
  {
6
6
  "file": "alert.js",
package/index.d.ts CHANGED
@@ -46,6 +46,9 @@ import { registry } from './lib/components/registry.js';
46
46
  import { stateHistory } from './lib/components/history/StateHistory.js';
47
47
  import { watcher } from './lib/components/watcher.js';
48
48
  export { state, registry, stateHistory };
49
+ import { vstack } from './lib/components/stack/VStack.js';
50
+ import { hstack } from './lib/components/stack/HStack.js';
51
+ import { zstack } from './lib/components/stack/ZStack.js';
49
52
  export declare const jux: {
50
53
  alert: typeof alert;
51
54
  app: typeof app;
@@ -89,6 +92,9 @@ export declare const jux: {
89
92
  themeToggle: typeof themeToggle;
90
93
  tooltip: typeof tooltip;
91
94
  write: typeof write;
95
+ vstack: typeof vstack;
96
+ hstack: typeof hstack;
97
+ zstack: typeof zstack;
92
98
  fetch: typeof import("./lib/utils/fetch.js").juxFetch & {
93
99
  all: typeof import("./lib/utils/fetch.js").fetchAll;
94
100
  get: <T = any>(url: string, options?: Omit<import("./lib/utils/fetch.js").FetchOptions, "method">) => {
@@ -201,4 +207,5 @@ export declare const jux: {
201
207
  getOrCreateContainer: typeof getOrCreateContainer;
202
208
  watcher: typeof watcher;
203
209
  };
210
+ export { vstack, hstack, zstack };
204
211
  //# sourceMappingURL=index.d.ts.map
package/index.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAClD,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAA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ACxD,OAAO,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAExE,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAEtD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC;AAGzC,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAG1D,eAAO,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqDf,CAAC;AAGF,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC"}
package/index.js CHANGED
@@ -48,6 +48,10 @@ import { registry } from './lib/components/registry.js'; // ✅ Import registry
48
48
  import { stateHistory } from './lib/components/history/StateHistory.js'; // ✅ Import history
49
49
  import { watcher } from './lib/components/watcher.js';
50
50
  export { state, registry, stateHistory }; // ✅ Export history
51
+ // ✅ Import Stack components
52
+ import { vstack } from './lib/components/stack/VStack.js';
53
+ import { hstack } from './lib/components/stack/HStack.js';
54
+ import { zstack } from './lib/components/stack/ZStack.js';
51
55
  // Utilities
52
56
  export const jux = {
53
57
  alert,
@@ -92,6 +96,10 @@ export const jux = {
92
96
  themeToggle,
93
97
  tooltip,
94
98
  write,
99
+ // ✅ Stack components
100
+ vstack,
101
+ hstack,
102
+ zstack,
95
103
  // Utilities
96
104
  fetch: fetchAPI,
97
105
  renderIcon,
@@ -99,3 +107,5 @@ export const jux = {
99
107
  getOrCreateContainer,
100
108
  watcher
101
109
  };
110
+ // ✅ Export Stack components directly
111
+ export { vstack, hstack, zstack };
@@ -14,6 +14,7 @@ export interface ButtonOptions {
14
14
  }
15
15
  type ButtonState = {
16
16
  label: string;
17
+ content: string;
17
18
  icon: string;
18
19
  variant: string;
19
20
  size: string;
@@ -30,13 +31,28 @@ export declare class Button extends BaseComponent<ButtonState> {
30
31
  constructor(id: string, options?: ButtonOptions);
31
32
  protected getTriggerEvents(): readonly string[];
32
33
  protected getCallbackEvents(): readonly string[];
34
+ /**
35
+ * Set button label (plain text, auto-escaped)
36
+ * Clears any HTML content
37
+ */
33
38
  label(value: string): this;
34
- icon(value: string): this;
35
- variant(value: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'info' | 'link' | string): this;
36
- size(value: 'small' | 'medium' | 'large'): this;
37
- iconPosition(value: 'left' | 'right'): this;
38
- fullWidth(value: boolean): this;
39
- type(value: 'button' | 'submit' | 'reset'): this;
39
+ /**
40
+ * Alias for label() - more semantic for buttons
41
+ */
42
+ text(value: string): this;
43
+ /**
44
+ * Set button content as HTML (overrides label)
45
+ */
46
+ content(value: string): this;
47
+ /**
48
+ * Alias for content() - more semantic
49
+ */
50
+ html(value: string): this;
51
+ /**
52
+ * Update button text/HTML based on priority
53
+ * Priority: content (HTML) > label (text) > loading state
54
+ */
55
+ private _updateButtonText;
40
56
  update(prop: string, value: any): void;
41
57
  /**
42
58
  * Override visible() to update the actual button element
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAQxD,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAChG,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,QAAQ,CAAC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G,MAAM,CAElE"}
@@ -8,7 +8,8 @@ export class Button extends BaseComponent {
8
8
  constructor(id, options) {
9
9
  const opts = options || {};
10
10
  super(id, {
11
- label: opts.label ?? formatIdAsLabel(id), // ✅ Use utility for default
11
+ label: opts.label ?? formatIdAsLabel(id), // ✅ Auto-generate label
12
+ content: '', // ✅ Empty by default
12
13
  icon: opts.icon ?? '',
13
14
  variant: opts.variant ?? 'primary',
14
15
  size: opts.size ?? 'medium',
@@ -20,7 +21,7 @@ export class Button extends BaseComponent {
20
21
  style: opts.style ?? '',
21
22
  class: opts.class ?? ''
22
23
  });
23
- this._buttonElement = null; // ✅ Store button reference
24
+ this._buttonElement = null;
24
25
  }
25
26
  getTriggerEvents() {
26
27
  return TRIGGER_EVENTS;
@@ -29,36 +30,56 @@ export class Button extends BaseComponent {
29
30
  return CALLBACK_EVENTS;
30
31
  }
31
32
  /* ═════════════════════════════════════════════════════════════════
32
- * FLUENT API
33
+ * FLUENT API - Priority: content > label > auto-generated
33
34
  * ═════════════════════════════════════════════════════════════════ */
34
- // ✅ Inherited from BaseComponent
35
+ /**
36
+ * Set button label (plain text, auto-escaped)
37
+ * Clears any HTML content
38
+ */
35
39
  label(value) {
36
40
  this.state.label = value;
41
+ this.state.content = ''; // ✅ Clear HTML content when label is set
42
+ this._updateButtonText();
37
43
  return this;
38
44
  }
39
- icon(value) {
40
- this.state.icon = value;
41
- return this;
42
- }
43
- variant(value) {
44
- this.state.variant = value;
45
- return this;
46
- }
47
- size(value) {
48
- this.state.size = value;
49
- return this;
45
+ /**
46
+ * Alias for label() - more semantic for buttons
47
+ */
48
+ text(value) {
49
+ return this.label(value);
50
50
  }
51
- iconPosition(value) {
52
- this.state.iconPosition = value;
51
+ /**
52
+ * Set button content as HTML (overrides label)
53
+ */
54
+ content(value) {
55
+ this.state.content = value;
56
+ this._updateButtonText();
53
57
  return this;
54
58
  }
55
- fullWidth(value) {
56
- this.state.fullWidth = value;
57
- return this;
59
+ /**
60
+ * Alias for content() - more semantic
61
+ */
62
+ html(value) {
63
+ return this.content(value);
58
64
  }
59
- type(value) {
60
- this.state.type = value;
61
- return this;
65
+ /**
66
+ * Update button text/HTML based on priority
67
+ * Priority: content (HTML) > label (text) > loading state
68
+ */
69
+ _updateButtonText() {
70
+ if (!this._buttonElement)
71
+ return;
72
+ const textEl = this._buttonElement.querySelector('span:not(.jux-button-icon)');
73
+ if (!textEl)
74
+ return;
75
+ // Priority 1: HTML content (if set)
76
+ if (this.state.content) {
77
+ textEl.innerHTML = this.state.content;
78
+ }
79
+ // Priority 2: Label text
80
+ else if (this.state.label) {
81
+ textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
82
+ }
62
83
  }
63
84
  update(prop, value) {
64
85
  // No reactive updates needed
@@ -79,9 +100,9 @@ export class Button extends BaseComponent {
79
100
  }
80
101
  render(targetId) {
81
102
  const container = this._setupContainer(targetId);
82
- const { label, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
103
+ const { label, content, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
83
104
  const button = document.createElement('button');
84
- this._buttonElement = button; // ✅ Store reference
105
+ this._buttonElement = button;
85
106
  button.className = `jux-button jux-button-${variant} jux-button-${size}`;
86
107
  button.id = this._id;
87
108
  button.disabled = disabled || loading;
@@ -96,7 +117,17 @@ export class Button extends BaseComponent {
96
117
  button.appendChild(iconEl);
97
118
  }
98
119
  const textEl = document.createElement('span');
99
- textEl.textContent = loading ? 'Loading...' : label;
120
+ // Priority: content (HTML) > label (text) > loading state
121
+ if (content) {
122
+ textEl.innerHTML = content;
123
+ }
124
+ else if (label) {
125
+ textEl.textContent = loading ? 'Loading...' : label;
126
+ }
127
+ else {
128
+ // Fallback to auto-generated label from ID
129
+ textEl.textContent = loading ? 'Loading...' : formatIdAsLabel(this._id);
130
+ }
100
131
  button.appendChild(textEl);
101
132
  if (icon && iconPosition === 'right') {
102
133
  const iconEl = document.createElement('span');
@@ -22,6 +22,7 @@ export interface ButtonOptions {
22
22
 
23
23
  type ButtonState = {
24
24
  label: string;
25
+ content: string; // ✅ Raw HTML content (overrides label if set)
25
26
  icon: string;
26
27
  variant: string;
27
28
  size: string;
@@ -35,13 +36,14 @@ type ButtonState = {
35
36
  };
36
37
 
37
38
  export class Button extends BaseComponent<ButtonState> {
38
- private _buttonElement: HTMLButtonElement | null = null; // ✅ Store button reference
39
+ private _buttonElement: HTMLButtonElement | null = null;
39
40
 
40
41
  constructor(id: string, options?: ButtonOptions) {
41
42
  const opts = options || {};
42
43
 
43
44
  super(id, {
44
- label: opts.label ?? formatIdAsLabel(id), // ✅ Use utility for default
45
+ label: opts.label ?? formatIdAsLabel(id), // ✅ Auto-generate label
46
+ content: '', // ✅ Empty by default
45
47
  icon: opts.icon ?? '',
46
48
  variant: opts.variant ?? 'primary',
47
49
  size: opts.size ?? 'medium',
@@ -64,44 +66,61 @@ export class Button extends BaseComponent<ButtonState> {
64
66
  }
65
67
 
66
68
  /* ═════════════════════════════════════════════════════════════════
67
- * FLUENT API
69
+ * FLUENT API - Priority: content > label > auto-generated
68
70
  * ═════════════════════════════════════════════════════════════════ */
69
71
 
70
- // ✅ Inherited from BaseComponent
71
-
72
+ /**
73
+ * Set button label (plain text, auto-escaped)
74
+ * Clears any HTML content
75
+ */
72
76
  label(value: string): this {
73
77
  this.state.label = value;
78
+ this.state.content = ''; // ✅ Clear HTML content when label is set
79
+ this._updateButtonText();
74
80
  return this;
75
81
  }
76
82
 
77
- icon(value: string): this {
78
- this.state.icon = value;
79
- return this;
83
+ /**
84
+ * Alias for label() - more semantic for buttons
85
+ */
86
+ text(value: string): this {
87
+ return this.label(value);
80
88
  }
81
89
 
82
- variant(value: 'primary' | 'secondary' | 'danger' | 'success' | 'warning' | 'info' | 'link' | string): this {
83
- this.state.variant = value;
90
+ /**
91
+ * Set button content as HTML (overrides label)
92
+ */
93
+ content(value: string): this {
94
+ this.state.content = value;
95
+ this._updateButtonText();
84
96
  return this;
85
97
  }
86
98
 
87
- size(value: 'small' | 'medium' | 'large'): this {
88
- this.state.size = value;
89
- return this;
99
+ /**
100
+ * Alias for content() - more semantic
101
+ */
102
+ html(value: string): this {
103
+ return this.content(value);
90
104
  }
91
105
 
92
- iconPosition(value: 'left' | 'right'): this {
93
- this.state.iconPosition = value;
94
- return this;
95
- }
106
+ /**
107
+ * Update button text/HTML based on priority
108
+ * Priority: content (HTML) > label (text) > loading state
109
+ */
110
+ private _updateButtonText(): void {
111
+ if (!this._buttonElement) return;
96
112
 
97
- fullWidth(value: boolean): this {
98
- this.state.fullWidth = value;
99
- return this;
100
- }
113
+ const textEl = this._buttonElement.querySelector('span:not(.jux-button-icon)') as HTMLElement;
114
+ if (!textEl) return;
101
115
 
102
- type(value: 'button' | 'submit' | 'reset'): this {
103
- this.state.type = value;
104
- return this;
116
+ // Priority 1: HTML content (if set)
117
+ if (this.state.content) {
118
+ textEl.innerHTML = this.state.content;
119
+ }
120
+ // Priority 2: Label text
121
+ else if (this.state.label) {
122
+ textEl.textContent = this.state.loading ? 'Loading...' : this.state.label;
123
+ }
105
124
  }
106
125
 
107
126
  update(prop: string, value: any): void {
@@ -128,10 +147,10 @@ export class Button extends BaseComponent<ButtonState> {
128
147
 
129
148
  render(targetId?: string | HTMLElement | BaseComponent<any>): this {
130
149
  const container = this._setupContainer(targetId);
131
- const { label, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
150
+ const { label, content, variant, size, disabled, icon, iconPosition, loading, style, class: className } = this.state;
132
151
 
133
152
  const button = document.createElement('button');
134
- this._buttonElement = button; // ✅ Store reference
153
+ this._buttonElement = button;
135
154
  button.className = `jux-button jux-button-${variant} jux-button-${size}`;
136
155
  button.id = this._id;
137
156
  button.disabled = disabled || loading;
@@ -147,7 +166,17 @@ export class Button extends BaseComponent<ButtonState> {
147
166
  }
148
167
 
149
168
  const textEl = document.createElement('span');
150
- textEl.textContent = loading ? 'Loading...' : label;
169
+
170
+ // ✅ Priority: content (HTML) > label (text) > loading state
171
+ if (content) {
172
+ textEl.innerHTML = content;
173
+ } else if (label) {
174
+ textEl.textContent = loading ? 'Loading...' : label;
175
+ } else {
176
+ // Fallback to auto-generated label from ID
177
+ textEl.textContent = loading ? 'Loading...' : formatIdAsLabel(this._id);
178
+ }
179
+
151
180
  button.appendChild(textEl);
152
181
 
153
182
  if (icon && iconPosition === 'right') {
@@ -0,0 +1,112 @@
1
+ import { BaseComponent, BaseState } from '../base/BaseComponent.js';
2
+ export interface StackOptions {
3
+ spacing?: 'none' | 'tight' | 'default' | 'loose';
4
+ align?: 'start' | 'center' | 'end' | 'stretch';
5
+ justify?: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly';
6
+ divider?: boolean;
7
+ responsive?: boolean;
8
+ class?: string;
9
+ style?: string;
10
+ }
11
+ export interface ChildStyleFunction {
12
+ (index: number): string;
13
+ }
14
+ interface StackState extends BaseState {
15
+ spacing: string;
16
+ align?: string;
17
+ justify?: string;
18
+ divider: boolean;
19
+ responsive: boolean;
20
+ children: Array<any>;
21
+ childStyles?: ChildStyleFunction | string[];
22
+ }
23
+ /**
24
+ * BaseStack - Foundation for all stack layout components
25
+ * Provides common styling, child management, and progressive effects
26
+ */
27
+ export declare abstract class BaseStack extends BaseComponent<StackState> {
28
+ protected abstract baseClassName: string;
29
+ private _inlineStyles;
30
+ constructor(id: string, children: Record<string, any> | any[], options?: StackOptions);
31
+ protected getTriggerEvents(): readonly string[];
32
+ protected getCallbackEvents(): readonly string[];
33
+ spacing(value: 'none' | 'tight' | 'default' | 'loose'): this;
34
+ align(value: 'start' | 'center' | 'end' | 'stretch'): this;
35
+ justify(value: 'start' | 'center' | 'end' | 'between' | 'around' | 'evenly'): this;
36
+ divider(value?: boolean): this;
37
+ responsive(value?: boolean): this;
38
+ /**
39
+ * Internal helper to add individual CSS properties
40
+ */
41
+ private _addStyle;
42
+ /**
43
+ * Build and apply the complete style attribute
44
+ */
45
+ private _updateStyleAttribute;
46
+ padding(value: string): this;
47
+ margin(value: string): this;
48
+ border(value: string): this;
49
+ borderRadius(value: string): this;
50
+ width(value: string): this;
51
+ height(value: string): this;
52
+ minWidth(value: string): this;
53
+ maxWidth(value: string): this;
54
+ minHeight(value: string): this;
55
+ maxHeight(value: string): this;
56
+ background(value: string): this;
57
+ backgroundColor(value: string): this;
58
+ boxShadow(value: string): this;
59
+ opacity(value: string | number): this;
60
+ position(value: 'static' | 'relative' | 'absolute' | 'fixed' | 'sticky'): this;
61
+ top(value: string): this;
62
+ right(value: string): this;
63
+ bottom(value: string): this;
64
+ left(value: string): this;
65
+ zIndex(value: string | number): this;
66
+ overflow(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
67
+ overflowX(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
68
+ overflowY(value: 'visible' | 'hidden' | 'scroll' | 'auto'): this;
69
+ display(value: string): this;
70
+ cursor(value: string): this;
71
+ transform(value: string): this;
72
+ transformOrigin(value: string): this;
73
+ transition(value: string): this;
74
+ animation(value: string): this;
75
+ /**
76
+ * Apply custom styles to each child progressively
77
+ */
78
+ childStyle(stylesOrFunction: string[] | ChildStyleFunction): this;
79
+ /**
80
+ * Cascade effect - offset children progressively
81
+ */
82
+ cascade(baseOffset?: number, axis?: 'x' | 'y' | 'both' | 'horizontal' | 'vertical' | 'xy'): this;
83
+ /**
84
+ * Fan effect - rotate children progressively
85
+ */
86
+ fan(angle?: number, origin?: string): this;
87
+ /**
88
+ * Scale progression - shrink/grow children
89
+ */
90
+ scaleProgressive(startScale?: number, step?: number, origin?: string): this;
91
+ /**
92
+ * Fade effect - progressive opacity
93
+ */
94
+ fade(startOpacity?: number, step?: number): this;
95
+ /**
96
+ * Blur effect - progressive blur
97
+ */
98
+ blur(startBlur?: number, step?: number): this;
99
+ /**
100
+ * Stagger animation delays
101
+ */
102
+ stagger(baseDelay?: number): this;
103
+ protected buildClasses(): string;
104
+ protected renderChild(child: any, index: number): string;
105
+ private wrapChildWithStyle;
106
+ private injectChildStyle;
107
+ private getChildStyle;
108
+ render(targetId?: string | HTMLElement | BaseComponent<any>): this;
109
+ update(prop: string, value: any): void;
110
+ }
111
+ export {};
112
+ //# sourceMappingURL=BaseStack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseStack.d.ts","sourceRoot":"","sources":["BaseStack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAMpE,MAAM,WAAW,YAAY;IACzB,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,OAAO,CAAC;IACjD,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAC;IAC/C,OAAO,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACvE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IAC/B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B;AAED,UAAU,UAAW,SAAQ,SAAS;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,WAAW,CAAC,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAAC;CAC/C;AAED;;;GAGG;AACH,8BAAsB,SAAU,SAAQ,aAAa,CAAC,UAAU,CAAC;IAC7D,SAAS,CAAC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IACzC,OAAO,CAAC,aAAa,CAAkC;gBAE3C,EAAE,EAAE,MAAM,E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