@kwiz/fluentui 1.0.202 → 1.0.203
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/README.md +209 -34
- package/dist/helpers/drag-drop/drag-drop-context.d.ts +1 -0
- package/dist/helpers/drag-drop/drag-drop-context.js +1 -0
- package/dist/helpers/drag-drop/drag-drop-context.js.map +1 -1
- package/dist/helpers/use-alerts.d.ts +1 -5
- package/dist/helpers/use-alerts.js +1 -5
- package/dist/helpers/use-alerts.js.map +1 -1
- package/dist/helpers/use-controlled-state-tracker.d.ts +2 -0
- package/dist/helpers/use-controlled-state-tracker.js +2 -0
- package/dist/helpers/use-controlled-state-tracker.js.map +1 -1
- package/dist/helpers/use-highlight.d.ts +1 -0
- package/dist/helpers/use-highlight.js +1 -0
- package/dist/helpers/use-highlight.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,53 +1,228 @@
|
|
|
1
|
-
# fluentui
|
|
1
|
+
# About @kwiz/fluentui
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
@kwiz/fluentui is a set of enhanced controls built for and on top of `@fluentui/react-components` (https://storybooks.fluentui.dev/react)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
It adds a few key components, some very powerful and some simple wrappers to make the library easier to render in rapid dev.
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
# Key components
|
|
10
|
+
|
|
11
|
+
### Containers
|
|
12
|
+
|
|
13
|
+
#### Section
|
|
14
|
+
|
|
15
|
+
Renders a simple div with ease.
|
|
16
|
+
|
|
17
|
+
Properties:
|
|
18
|
+
|
|
19
|
+
1. **main**: make this grow to fill space in a stackable component
|
|
20
|
+
2. **css**: pass a string array of a makeStyles/useStyles classes
|
|
21
|
+
|
|
22
|
+
#### Vertical
|
|
23
|
+
|
|
24
|
+
A simple vertical flex box stackable
|
|
25
|
+
|
|
26
|
+
#### Horizontal
|
|
27
|
+
|
|
28
|
+
A simple horizontal flex box stackable
|
|
29
|
+
|
|
30
|
+
#### Stack
|
|
31
|
+
|
|
32
|
+
A simple vertical/horizontal flex box stackable
|
|
33
|
+
|
|
34
|
+
### Data viewers
|
|
35
|
+
|
|
36
|
+
#### Table
|
|
37
|
+
|
|
38
|
+
A powerful strongly typed table control with sort, filter, sticky headers and sticker left 1/2 columns.
|
|
39
|
+
|
|
40
|
+
Provide an item level menu, and easy selection controls.
|
|
41
|
+
|
|
42
|
+
#### ListEx
|
|
43
|
+
|
|
44
|
+
Display items using a list control
|
|
45
|
+
|
|
46
|
+
#### AccordionEX
|
|
47
|
+
|
|
48
|
+
Display data in a collapsible accordion
|
|
49
|
+
|
|
50
|
+
### QRCodeEX
|
|
51
|
+
|
|
52
|
+
Render a QR code for a specific string value (usually, a URL)
|
|
53
|
+
|
|
54
|
+
### KWIZOverflowV2
|
|
55
|
+
|
|
56
|
+
A much better, more stable implementation of the overflow concept in the original library.
|
|
57
|
+
|
|
58
|
+
Render items horizontally or vertically in an overflow hidden zone to automatically collapse overflow items in a menu.
|
|
59
|
+
|
|
60
|
+
### Inputs
|
|
61
|
+
|
|
62
|
+
#### InputEx
|
|
63
|
+
|
|
64
|
+
enhanced input control
|
|
65
|
+
|
|
66
|
+
#### InputNumberEx
|
|
67
|
+
|
|
68
|
+
enhanced input number control with built in validations
|
|
69
|
+
|
|
70
|
+
#### TextAreaEx
|
|
71
|
+
|
|
72
|
+
enhanced text area input control
|
|
73
|
+
|
|
74
|
+
#### FileUpload
|
|
75
|
+
|
|
76
|
+
Render a file upload button with a drop file option
|
|
77
|
+
|
|
78
|
+
#### DatePickerEx
|
|
79
|
+
|
|
80
|
+
A date picker wrapped nicely
|
|
81
|
+
|
|
82
|
+
#### CodeEditor
|
|
83
|
+
|
|
84
|
+
An implementation wrapper of `monaco-editor`
|
|
85
|
+
|
|
86
|
+
### FileTypeIcon
|
|
87
|
+
|
|
88
|
+
Render an icon for a file type
|
|
89
|
+
|
|
90
|
+
### DropdownEX
|
|
91
|
+
|
|
92
|
+
Strongly typed dropdown control
|
|
93
|
+
|
|
94
|
+
### Buttons
|
|
95
|
+
|
|
96
|
+
A collection of `ButtonEX` controls and `CompoundButtonEX` controls wrapping and enhancing the original button control.
|
|
97
|
+
|
|
98
|
+
ButtonEX, ButtonEXSecondary, ButtonEXMessageBarAction, ButtonEXPrimary, ButtonEXDanger, ButtonEXSuccess, ButtonEXPrimarySubtle, ButtonEXDangerSubtle
|
|
99
|
+
|
|
100
|
+
CompoundButtonEX, CompoundButtonEXSecondary, CompoundButtonEXPrimary, CompoundButtonEXDanger
|
|
101
|
+
|
|
102
|
+
#### DrawPad
|
|
103
|
+
|
|
104
|
+
A canvas control
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
# Key hooks
|
|
109
|
+
|
|
110
|
+
## useDraggable
|
|
111
|
+
|
|
112
|
+
create a drag / drop context on an element, provide the element ref via dragDropRef like this:
|
|
113
|
+
|
|
114
|
+
```jsx
|
|
115
|
+
const dropContext = useDragDropContext<..., ...>({...});
|
|
116
|
+
...
|
|
117
|
+
<Vertical main ref={(v) => {
|
|
118
|
+
dropContext.dragDropRef(v);
|
|
119
|
+
}}>
|
|
12
120
|
```
|
|
13
121
|
|
|
14
|
-
|
|
122
|
+
Next, you can show "drop here" UI using markers like this:
|
|
15
123
|
|
|
124
|
+
```tsx
|
|
125
|
+
{dropContext.drop.isOver && <div>drop here!</div>}
|
|
16
126
|
```
|
|
17
|
-
|
|
127
|
+
|
|
128
|
+
a useDragDropContext must be added to all draggable items (or files), and to all droppable zones, explaining what they allow to drag / drop.
|
|
129
|
+
|
|
130
|
+
## useTrackFocus
|
|
131
|
+
|
|
132
|
+
## useWindowSize
|
|
133
|
+
|
|
134
|
+
## useElementSize
|
|
135
|
+
|
|
136
|
+
## useIsInPrint
|
|
137
|
+
|
|
138
|
+
## useKeyDown
|
|
139
|
+
|
|
140
|
+
## useStateEX
|
|
141
|
+
|
|
142
|
+
set state on steroids. provide promise callback after render, onChange transformer and automatic skip-set when value not change
|
|
143
|
+
|
|
144
|
+
## useRefWithState
|
|
145
|
+
|
|
146
|
+
use a ref, that can be tracked as useEffect dependency
|
|
147
|
+
|
|
148
|
+
## useClickableDiv
|
|
149
|
+
|
|
150
|
+
return props to make div appear as clickable, and accept enter key as click
|
|
151
|
+
|
|
152
|
+
## useAlerts
|
|
153
|
+
|
|
154
|
+
Easily prompt, confirm or alert the user. To use this you must render the alertPrompt in your element.
|
|
155
|
+
## useAutoFocusEX
|
|
156
|
+
|
|
157
|
+
better auto-focus that actually works. use the ref on the element you wish to focus.
|
|
158
|
+
|
|
159
|
+
focus set initially, and then again on a timeout - default is 200ms timeout. send 0 to skip the timeout
|
|
160
|
+
|
|
161
|
+
## **useControlledStateTracker**
|
|
162
|
+
|
|
163
|
+
track an input control if it was changed from a managed to unmanaged (controlled / uncontrolled) state between renders.
|
|
164
|
+
|
|
165
|
+
for example, if you pass a value on first render, but a defaultValue on a following render.
|
|
166
|
+
|
|
167
|
+
## **useHighlight**
|
|
168
|
+
|
|
169
|
+
returns a function you can call to make an element glow momentarily
|
|
170
|
+
|
|
171
|
+
## useIsConcurrent
|
|
172
|
+
|
|
173
|
+
Call at the beginning of a useEffect, check after all your promises finished before applying results to state.
|
|
174
|
+
You must keep the same name for each useEffect
|
|
175
|
+
|
|
176
|
+
```jsx
|
|
177
|
+
const {getConcurrency} = useIsConcurrent();
|
|
178
|
+
useEffect(()=>{
|
|
179
|
+
const c = getConcurrency('loading data');
|
|
180
|
+
const result = await someSlowPromise();
|
|
181
|
+
if( c.isCurrent() ) setData(result);
|
|
182
|
+
},[]);
|
|
18
183
|
```
|
|
19
184
|
|
|
20
|
-
|
|
185
|
+
## useReloadTracker
|
|
186
|
+
|
|
187
|
+
A simple reload marker, can be used as a dependency, and called as a function
|
|
188
|
+
|
|
189
|
+
Powerful load/reload/progress management with multiple scopes
|
|
190
|
+
|
|
191
|
+
## useShowOnHover
|
|
192
|
+
|
|
193
|
+
Easily show content only on hover
|
|
194
|
+
|
|
195
|
+
## useToast
|
|
196
|
+
|
|
197
|
+
## useTrackChanges
|
|
198
|
+
|
|
199
|
+
Provides useful helpers for tracking if control has changes, and handling the save changes with progress bar and on success/fail messages.
|
|
200
|
+
|
|
201
|
+
# Usage details
|
|
202
|
+
|
|
203
|
+
## Debugging
|
|
204
|
+
|
|
205
|
+
For local debugging, use `yalc-link` to register the project, and `watch` to build and push.
|
|
206
|
+
|
|
207
|
+
Caller projects should use `yalc add @kwiz/fluentui` to link up your local project.
|
|
208
|
+
|
|
209
|
+
This will make sure both projects use the same instance of react.
|
|
210
|
+
|
|
211
|
+
## Using the project controls
|
|
212
|
+
|
|
213
|
+
To successfully use these controls you should create a context, and wrap it in a drag/drop provider.
|
|
21
214
|
|
|
22
215
|
We recommend using the provider control:
|
|
23
216
|
|
|
24
|
-
```
|
|
217
|
+
```tsx
|
|
25
218
|
<KWIZFluentProvider ctx={{ buttonShape: "rounded" }}>
|
|
219
|
+
<IdPrefixProvider value="my-project">
|
|
26
220
|
<FluentProvider theme={webLightTheme}>
|
|
27
221
|
{content}
|
|
28
222
|
</FluentProvider>
|
|
223
|
+
</IdPrefixProvider>
|
|
29
224
|
</KWIZFluentProvider>
|
|
30
225
|
|
|
31
226
|
```
|
|
32
227
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
// it is no longer needed to send in a root node const root = React.useRef<HTMLDivElement>(null);
|
|
37
|
-
const { KWIZFluentContext, value: kwizFluentContext } =
|
|
38
|
-
useKWIZFluentContextProvider({
|
|
39
|
-
ctx: {
|
|
40
|
-
buttonShape: "rounded",
|
|
41
|
-
},
|
|
42
|
-
//root,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
//...
|
|
46
|
-
<KWIZFluentContext.Provider value={kwizFluentContext}>
|
|
47
|
-
<DragDropContextProvider>
|
|
48
|
-
<FluentProvider theme={webLightTheme} /*ref={root}*/>
|
|
49
|
-
{content}
|
|
50
|
-
</FluentProvider>
|
|
51
|
-
</DragDropContextProvider>
|
|
52
|
-
</KWIZFluentContext.Provider>;
|
|
53
|
-
```
|
|
228
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { iDragDropContext, iDraggableProps, iDraggedItemType, iDroppableProps } from "./drag-drop.types";
|
|
3
|
+
/** */
|
|
3
4
|
export declare function useDragDropContext<DragItemType extends iDraggedItemType<string> = never, DropInfoType extends iDroppableProps<string, any> = never>(info: {
|
|
4
5
|
dragInfo?: iDraggableProps<DragItemType>;
|
|
5
6
|
dropInfo?: DropInfoType;
|
|
@@ -6,6 +6,7 @@ import { useStateEX } from "../hooks";
|
|
|
6
6
|
import { DragDropContext, useDragDropContextInternal } from "./drag-drop-context-internal";
|
|
7
7
|
import { useDraggable } from "./use-draggable";
|
|
8
8
|
import { useDroppable } from "./use-droppable";
|
|
9
|
+
/** */
|
|
9
10
|
export function useDragDropContext(info) {
|
|
10
11
|
const dragDropContext = useDragDropContextInternal();
|
|
11
12
|
const isDraggable = !isNullOrUndefined(info.dragInfo);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drag-drop-context.js","sourceRoot":"","sources":["../../../src/helpers/drag-drop/drag-drop-context.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAE3F,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAA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;
|
|
22
22
|
close: () => void;
|
|
23
23
|
}
|
|
24
|
-
/**
|
|
25
|
-
* - call setMessage to add a blocker message
|
|
26
|
-
* - call onNav when you have internal navigation (open / close popups)
|
|
27
|
-
* - render the navPrompt control to your page
|
|
28
|
-
* FYI for page unload, most modern browsers won't show your message but a generic one instead. */
|
|
24
|
+
/** Easily prompt, confirm or alert the user. To use this you must render the alertPrompt in your element. */
|
|
29
25
|
export declare function useAlerts(): iAlerts;
|
|
30
26
|
export {};
|
|
@@ -16,11 +16,7 @@ import { useEffectOnlyOnMount, useStateEX } from "./hooks";
|
|
|
16
16
|
function isConfirmOptions(param) {
|
|
17
17
|
return isFunction(param) ? false : true;
|
|
18
18
|
}
|
|
19
|
-
/**
|
|
20
|
-
* - call setMessage to add a blocker message
|
|
21
|
-
* - call onNav when you have internal navigation (open / close popups)
|
|
22
|
-
* - render the navPrompt control to your page
|
|
23
|
-
* FYI for page unload, most modern browsers won't show your message but a generic one instead. */
|
|
19
|
+
/** Easily prompt, confirm or alert the user. To use this you must render the alertPrompt in your element. */
|
|
24
20
|
export function useAlerts() {
|
|
25
21
|
const [_prompt, _setPrompt] = useStateEX(null);
|
|
26
22
|
const promptEX = useCallback((info) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-alerts.js","sourceRoot":"","sources":["../../src/helpers/use-alerts.tsx"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAkB,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAmB3D,SAAS,gBAAgB,CAAC,KAAqC;IAC3D,OAAO,UAAU,CAAC,KAAK,C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;IACP,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAEzB,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,OAA6B,EAAE,IAAgB,EAAE,EAAE;QAC5E,OAAO,IAAI,OAAO,CAAO,OAAO,CAAC,EAAE;YAC/B,QAAQ,CAAC;gBACL,QAAQ,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAC,KAAK,cAAE,OAAO,GAAS,CAAC,CAAC,CAAC,OAAO;gBAChE,UAAU,EAAE,IAAI;gBAChB,IAAI,EAAE,GAAG,EAAE;oBACP,IAAI,UAAU,CAAC,IAAI,CAAC;wBAAE,IAAI,EAAE,CAAC;oBAC7B,OAAO,EAAE,CAAC;gBACd,CAAC;aACJ,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,EAAE,oBAAoB,CAAC,CAAC;IAEzB,OAAO;QACH,QAAQ,EAAE,SAAS,EAAE,OAAO;QAC5B,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,KAAC,QAAQ,oBAAK,OAAO,EAAI,CAAC,CAAC,CAAC,SAAS;QAC5D,KAAK,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC;KAChC,CAAC;AACN,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** track an input control if it was changed from a managed to unmanaged (controlled / uncontrolled) state between renders.
|
|
2
|
+
for example, if you pass a value on first render, but a defaultValue on a following render. */
|
|
1
3
|
export declare function useControlledStateTracker<ValueType>(props: {
|
|
2
4
|
name: string;
|
|
3
5
|
value?: ValueType;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CommonLogger, isUndefined } from "@kwiz/common";
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
const logger = new CommonLogger("useControlledStateTracker");
|
|
4
|
+
/** track an input control if it was changed from a managed to unmanaged (controlled / uncontrolled) state between renders.
|
|
5
|
+
for example, if you pass a value on first render, but a defaultValue on a following render. */
|
|
4
6
|
export function useControlledStateTracker(props) {
|
|
5
7
|
const [isUnControlled, setIsUnControlled] = useState(!isUndefined(props.defaultValue));
|
|
6
8
|
const __isUnControlled = !isUndefined(props.defaultValue);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-controlled-state-tracker.js","sourceRoot":"","sources":["../../src/helpers/use-controlled-state-tracker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,MAAM,GAAG,IAAI,YAAY,CAAC,2BAA2B,CAAC,CAAC;AAE7D,MAAM,UAAU,yBAAyB,CAAY,KAAoE;IACrH,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC;IAEvF,MAAM,gBAAgB,GAAG,CAAC,WAAW,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAC1D,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,gBAAgB,KAAK,cAAc,EAAE,CAAC;YACtC,MAAM,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC,IAAI,oFAAoF,CAAC,CAAC;YAChH,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;YACpC,IAAI,CAAC,gBAAgB,EAAE,CAAC;gBACpB,uBAAuB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;IACL,CAAC,EAAE,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC,CAAC;IAEvC,MAAM,CAAC,oBAAoB,EAAE,uBAAuB,CAAC,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAEpH,MAAM,UAAU,GAAG,cAAc,CAAC,CAAC,C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C,CAAC,CAAC,IAAI,CAAC,CAAC;YACnD,CAAC;QACL,CAAC;KACJ,CAAA;AACL,CAAC"}
|
|
1
|
+
{"version":3,"file":"use-highlight.js","sourceRoot":"","sources":["../../src/helpers/use-highlight.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAEhE,MAAM,SAAS,GAAG,UAAU,CAAC;IACzB,WAAW,EAAE;QACT,UAAU,EAAE,8BAA8B;KAC7C;IACD,SAAS,EAAE;QACP,UAAU,EACN,YAAY,MAAM,CAAC,8BAA8B;uBACtC,MAAM,CAAC,8BAA8B;uBACrC,MAAM,CAAC,8BAA8B;uBACrC,MAAM,CAAC,8BAA8B,EAAE;KACzD;IACD,aAAa,EAAE;QACX,UAAU,EACN,YAAY,MAAM,CAAC,8BAA8B;uBACtC,MAAM,CAAC,8BAA8B;uBACrC,MAAM,CAAC,8BAA8B;uBACrC,MAAM,CAAC,8BAA8B,EAAE;KACzD;IACD,cAAc,EAAE;QACZ,UAAU,EAAE,6BAA6B;KAC5C;IACD,YAAY,EAAE;QACV,SAAS,EACL,YAAY,MAAM,CAAC,8BAA8B;uBACtC,MAAM,CAAC,8BAA8B,EAAE;KACzD;IACD,gBAAgB,EAAE;QACd,SAAS,EACL,YAAY,MAAM,CAAC,8BAA8B;uBACtC,MAAM,CAAC,8BAA8B,EAAE;KACzD;CACJ,CAAC,CAAC;AACH,0EAA0E;AAC1E,MAAM,UAAU,YAAY;IAYxB,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IAExB,OAAO;QACH,SAAS,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;YAClB,IAAI,GAAG,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;gBACvB,MAAM,SAAS,GAAG,CAAC,CAAA,CAAC,aAAD,CAAC,uBAAD,CAAC,CAAE,IAAI,MAAK,KAAK;oBAChC,CAAC,CAAC,CAAA,CAAC,aAAD,CAAC,uB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