@kong-ui-public/freeform 0.14.3 → 0.14.4-pr.4118.cd0ec009f.0

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 (35) hide show
  1. package/README.md +1 -0
  2. package/dist/filler/packages/core/freeform/src/composables/errors.d.ts +1 -0
  3. package/dist/filler/packages/core/freeform/src/composables/errors.d.ts.map +1 -1
  4. package/dist/filler/packages/core/freeform/src/composables/field.d.ts.map +1 -1
  5. package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts +9 -0
  6. package/dist/filler/packages/core/freeform/src/composables/form-context.d.ts.map +1 -1
  7. package/dist/filler/packages/core/freeform/src/composables/index.d.ts +2 -0
  8. package/dist/filler/packages/core/freeform/src/composables/index.d.ts.map +1 -1
  9. package/dist/filler/packages/core/freeform/src/composables/reveal-adapter.d.ts +56 -0
  10. package/dist/filler/packages/core/freeform/src/composables/reveal-adapter.d.ts.map +1 -0
  11. package/dist/filler/packages/core/freeform/src/composables/reveal-tree.d.ts +53 -0
  12. package/dist/filler/packages/core/freeform/src/composables/reveal-tree.d.ts.map +1 -0
  13. package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts +24 -1
  14. package/dist/filler/packages/core/freeform/src/composables/reveal.d.ts.map +1 -1
  15. package/dist/freeform.es.js +2368 -2122
  16. package/dist/freeform.umd.js +6 -6
  17. package/dist/style.css +1 -1
  18. package/dist/types/components/Form.vue.d.ts +11 -0
  19. package/dist/types/components/Form.vue.d.ts.map +1 -1
  20. package/dist/types/composables/errors.d.ts +1 -0
  21. package/dist/types/composables/errors.d.ts.map +1 -1
  22. package/dist/types/composables/field.d.ts.map +1 -1
  23. package/dist/types/composables/form-context.d.ts +9 -0
  24. package/dist/types/composables/form-context.d.ts.map +1 -1
  25. package/dist/types/composables/index.d.ts +2 -0
  26. package/dist/types/composables/index.d.ts.map +1 -1
  27. package/dist/types/composables/reveal-adapter.d.ts +56 -0
  28. package/dist/types/composables/reveal-adapter.d.ts.map +1 -0
  29. package/dist/types/composables/reveal-tree.d.ts +53 -0
  30. package/dist/types/composables/reveal-tree.d.ts.map +1 -0
  31. package/dist/types/composables/reveal.d.ts +24 -1
  32. package/dist/types/composables/reveal.d.ts.map +1 -1
  33. package/dist/types/reveal-adapters.d.ts +2 -0
  34. package/dist/types/reveal-adapters.d.ts.map +1 -0
  35. package/package.json +1 -1
package/README.md CHANGED
@@ -66,6 +66,7 @@ function handleSubmit() {
66
66
  - [CEL Input](docs/cel-input.md): `CelInput` and `CelField`
67
67
  - [Custom Fields](docs/custom-fields.md): `FieldRenderer` and custom field components
68
68
  - [Field Navigation](docs/field-navigation.md): `reveal(path)`
69
+ - [Closed Containers](docs/closed-containers.md): `defineRevealAdapter`, for fields in tabs, `v-if` sections and opaque components
69
70
  - [Field Errors](docs/field-errors.md): `errors` and `unmatchedErrors`
70
71
  - [Filler](docs/filler.md): test utilities for Cypress and Playwright, adding a new field type
71
72
  - [Reference](docs/reference.md): injection keys, `data-testid` conventions
@@ -33,6 +33,7 @@ export declare function createFieldErrors(options: {
33
33
  onChange?: (errors: FieldError[]) => void;
34
34
  }): {
35
35
  getFieldErrors: (fieldPath: string, deep?: boolean) => FieldError[];
36
+ getErrorsWhere: (predicate: (fieldPath: string) => boolean) => FieldError[];
36
37
  unmatchedErrors: import("vue").ComputedRef<FieldError[]>;
37
38
  onArrayItemRemoved: (arrayFieldPath: string, index: number) => void;
38
39
  onMapKeyRenamed: (mapFieldPath: string, from: string, to: string) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/errors.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD;;;;;;;;;;;GAWG;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,7 @@
1
1
  import type { ComputedRef, MaybeRefOrGetter } from 'vue';
2
2
  import type { EmptyValue, FieldError, FormConfig, MatchMap, RenderRules } from '../types';
3
3
  import type { FormSchema, UnionFieldSchema } from '../form-schema';
4
+ import type { RevealContainerQuery, RevealNode } from './reveal-tree';
4
5
  export declare const provideFormShared: (options: {
5
6
  schema: FormSchema | UnionFieldSchema;
6
7
  propsData?: ComputedRef<Record<string, any>> | undefined;
@@ -33,7 +34,11 @@ export declare const provideFormShared: (options: {
33
34
  getEmptyOrDefault: <T = unknown>(path?: string) => EmptyValue | T;
34
35
  revealTarget: import("vue").ShallowRef<string | null, string | null>;
35
36
  registerFieldElement: (entry: import("./reveal").FieldElementEntry) => () => void;
37
+ rememberField: (memory: import("./reveal").FieldMemory) => void;
38
+ findAnchor: (fieldPath: string, element: Element | null) => string | null;
36
39
  findCoveringElement: (fieldPath: string) => Element | null;
40
+ revealTree: ComputedRef<RevealNode[]>;
41
+ getContainerErrors: (query: RevealContainerQuery) => FieldError[];
37
42
  /**
38
43
  * Reveals the field at a data path, see `createFieldReveal`
39
44
  */
@@ -93,7 +98,11 @@ export declare const provideFormShared: (options: {
93
98
  getEmptyOrDefault: <T = unknown>(path?: string) => EmptyValue | T;
94
99
  revealTarget: import("vue").ShallowRef<string | null, string | null>;
95
100
  registerFieldElement: (entry: import("./reveal").FieldElementEntry) => () => void;
101
+ rememberField: (memory: import("./reveal").FieldMemory) => void;
102
+ findAnchor: (fieldPath: string, element: Element | null) => string | null;
96
103
  findCoveringElement: (fieldPath: string) => Element | null;
104
+ revealTree: ComputedRef<RevealNode[]>;
105
+ getContainerErrors: (query: RevealContainerQuery) => FieldError[];
97
106
  /**
98
107
  * Reveals the field at a data path, see `createFieldReveal`
99
108
  */
@@ -1 +1 @@
1
- {"version":3,"file":"form-context.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/form-context.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,M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,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAAA;IAC/B,QAAQ,EAAE,MAAM,CAAC,CAAA;CAClB,CACF"}
@@ -8,7 +8,9 @@ export * from './form-context';
8
8
  export * from './labels';
9
9
  export type { RevealOptions, RevealResult } from './reveal';
10
10
  export { DEFAULT_REVEAL_DURATION, DEFAULT_REVEAL_HIGHLIGHT_DURATION } from './reveal';
11
+ export * from './reveal-adapter';
11
12
  export * from './reveal-open';
13
+ export * from './reveal-tree';
12
14
  export * from './schema';
13
15
  export * from './useMapField';
14
16
  export { renderRuleExactMatch } from './render-rules';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAA;AACrF,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,gBAAgB,CAAA;AAC9B,cAAc,UAAU,CAAA;AACxB,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AAC3D,OAAO,EAAE,uBAAuB,EAAE,iCAAiC,EAAE,MAAM,UAAU,CAAA;AACrF,cAAc,kBAAkB,CAAA;AAChC,cAAc,eAAe,CAAA;AAC7B,cAAc,eAAe,CAAA;AAC7B,cAAc,UAAU,CAAA;AACxB,cAAc,eAAe,CAAA;AAC7B,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,56 @@
1
+ import type { VNode } from 'vue';
2
+ /**
3
+ * A field a part of the form covers: the field at `path` and everything below
4
+ * it, except the children named in `exclude` (e.g. `ObjectField`'s `omit`)
5
+ */
6
+ export interface FieldCover {
7
+ path: string;
8
+ exclude?: string[];
9
+ }
10
+ export interface RevealAdapterContext<P = Record<string, any>> {
11
+ /** The component's vnode, as the form's content renders it now */
12
+ vnode: VNode;
13
+ props: P;
14
+ /** The slot that holds the field being revealed */
15
+ slotName: string;
16
+ }
17
+ /**
18
+ * Tells the form what a component does with fields, so a reveal can find the
19
+ * fields its content holds without the content being mounted (e.g. an inactive
20
+ * tab), and open it.
21
+ */
22
+ export interface RevealAdapter<P = Record<string, any>> {
23
+ /**
24
+ * For a field component: the field it renders, named as its `name` prop is.
25
+ * The fields in its default slot are relative to it.
26
+ */
27
+ field?: (props: P) => FieldCover | undefined;
28
+ /**
29
+ * For a component that renders fields in its own template, which the form
30
+ * can't see until it mounts: those fields, named as a `name` prop would be.
31
+ */
32
+ fields?: (props: P) => Array<string | FieldCover>;
33
+ /**
34
+ * For a container: the slots whose content shows only while it opens them,
35
+ * e.g. a tab's panel. Its other slots always show.
36
+ */
37
+ contentSlots?: (slotName: string) => boolean;
38
+ /**
39
+ * Opens a content slot. Only view state should change, e.g. by calling the
40
+ * vnode's `onUpdate:modelValue`.
41
+ */
42
+ open?: (context: RevealAdapterContext<P>) => void;
43
+ }
44
+ /**
45
+ * Tells the form what a component does with fields (see `RevealAdapter`).
46
+ * Register it once per component, e.g. next to where the component is defined.
47
+ */
48
+ export declare function defineRevealAdapter<P = Record<string, any>>(component: object, adapter: RevealAdapter<P>): void;
49
+ export declare function getRevealAdapter(component: unknown): RevealAdapter | undefined;
50
+ /**
51
+ * Asks the parent of a vnode to set its `v-model`, as the component would
52
+ * when the user changes it. Warns when the parent binds no `v-model`, so
53
+ * there is no state to set.
54
+ */
55
+ export declare function updateModelValue(vnode: VNode, value: unknown): void;
56
+ //# sourceMappingURL=reveal-adapter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-adapter.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/reveal-adapter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,KAAK,CAAA;AAEhC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAED,MAAM,WAAW,oBAAoB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAC3D,kEAAkE;IAClE,KAAK,EAAE,KAAK,CAAA;IACZ,KAAK,EAAE,CAAC,CAAA;IACR,mDAAmD;IACnD,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;;GAIG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACpD;;;OAGG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,UAAU,GAAG,SAAS,CAAA;IAC5C;;;OAGG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,GAAG,UAAU,CAAC,CAAA;IACjD;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAA;IAC5C;;;OAGG;IACH,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAA;CAClD;AAID;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,QAExG;AAED,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,CAI9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,QAS5D"}
@@ -0,0 +1,53 @@
1
+ import type { Component, VNode, VNodeChild } from 'vue';
2
+ import type { FieldCover } from './reveal-adapter';
3
+ /** A field the form's content renders, mounted or not */
4
+ export interface RevealFieldNode {
5
+ kind: 'field';
6
+ cover: FieldCover;
7
+ }
8
+ /** A slot of a container that shows its content only while opened, e.g. a tab's panel */
9
+ export interface RevealContainerNode {
10
+ kind: 'container';
11
+ component: Component;
12
+ /** The vnode's `key`, to tell containers of the same component apart */
13
+ key: VNode['key'];
14
+ slotName: string;
15
+ open: () => void;
16
+ children: RevealNode[];
17
+ }
18
+ export type RevealNode = RevealFieldNode | RevealContainerNode;
19
+ /**
20
+ * Finds the fields that vnodes render and the containers they sit in, without
21
+ * mounting them. It renders the slots of components to read them, so the
22
+ * content of a closed container (e.g. an inactive tab) is found too. A
23
+ * component's own template is not rendered: what it renders is up to its
24
+ * `RevealAdapter`.
25
+ *
26
+ * @param base The field path the vnodes' field names are relative to
27
+ */
28
+ export declare function scanRevealTree(vnodes: VNodeChild, base?: string): RevealNode[];
29
+ /**
30
+ * Whether a cover stands for the field at `fieldPath`: its own path, or a path
31
+ * below it that is not in a child it leaves out
32
+ */
33
+ export declare function coversFieldPath(cover: FieldCover, fieldPath: string): boolean;
34
+ /**
35
+ * The cover that most closely stands for `fieldPath`: the deepest one that
36
+ * covers it (see `coversFieldPath`). At the same depth, the first one wins.
37
+ */
38
+ export declare function findDeepest<T extends FieldCover>(covers: Iterable<T>, fieldPath: string): T | null;
39
+ /** A field of the reveal tree */
40
+ export interface RevealTreeField extends FieldCover {
41
+ /** The containers it sits in, outermost first: those to open to show it */
42
+ containers: RevealContainerNode[];
43
+ }
44
+ /** Every field of the tree, with the containers it sits in */
45
+ export declare function flattenRevealTree(nodes: RevealNode[], containers?: RevealContainerNode[]): RevealTreeField[];
46
+ /** Picks the containers of a tree, e.g. to count the errors in a tab */
47
+ export interface RevealContainerQuery {
48
+ component: Component;
49
+ slotName?: string;
50
+ key?: VNode['key'];
51
+ }
52
+ export declare function matchesContainer(node: RevealContainerNode, query: RevealContainerQuery): boolean;
53
+ //# sourceMappingURL=reveal-tree.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reveal-tree.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/reveal-tree.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,KAAK,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAElD,yDAAyD;AACzD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAA;IACb,KAAK,EAAE,UAAU,CAAA;CAClB;AAED,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,WAAW,CAAA;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,wEAAwE;IACxE,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,QAAQ,EAAE,UAAU,EAAE,CAAA;CACvB;AAED,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG,mBAAmB,CAAA;AAgG9D;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,SAAK,GAAG,UAAU,EAAE,CAE1E;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAS7E;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAWlG;AAED,iCAAiC;AACjC,MAAM,WAAW,eAAgB,SAAQ,UAAU;IACjD,2EAA2E;IAC3E,UAAU,EAAE,mBAAmB,EAAE,CAAA;CAClC;AAED,8DAA8D;AAC9D,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,UAAU,GAAE,mBAAmB,EAAO,GAAG,eAAe,EAAE,CAIhH;AAED,wEAAwE;AACxE,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAA;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,GAAG,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAA;CACnB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAIhG"}
@@ -1,6 +1,8 @@
1
1
  import { type VNode } from 'vue';
2
2
  import type { KeyId } from '../types';
3
3
  import type { UnionFieldSchema } from '../form-schema';
4
+ import type { FieldCover } from './reveal-adapter';
5
+ import type { RevealTreeField } from './reveal-tree';
4
6
  export interface RevealResult {
5
7
  /**
6
8
  * The data path that was revealed, in the `formatDataPath` format: the
@@ -39,11 +41,27 @@ export interface FieldElementEntry {
39
41
  */
40
42
  exclude?: () => string[] | undefined;
41
43
  }
44
+ /**
45
+ * A field that has unmounted, e.g. as a `v-if` took it out, see
46
+ * `rememberField`
47
+ */
48
+ export interface FieldMemory extends FieldCover {
49
+ /** Its ancestors as it unmounts */
50
+ ancestors: Element[];
51
+ /** Its anchors as it mounted and as it unmounts */
52
+ anchors: Array<string | null>;
53
+ }
42
54
  type PathMapOptions = {
43
55
  formData: Record<string, any>;
44
56
  getSchema: (path: string) => UnionFieldSchema | undefined;
45
57
  getKey: (id: KeyId) => string | undefined;
46
58
  };
59
+ type FieldRevealOptions = PathMapOptions & {
60
+ /** The fields the form's content renders, mounted or not, see `flattenRevealTree` */
61
+ getTreeFields?: () => RevealTreeField[];
62
+ /** Whether render rules hide the field at a path, e.g. for the data's current mode */
63
+ isFieldHidden?: (fieldPath: string) => boolean;
64
+ };
47
65
  /**
48
66
  * Turns data path segments into a field path: map keys become the key IDs
49
67
  * the form data is keyed by. A key that isn't in the data is kept as is, so
@@ -60,9 +78,14 @@ export declare function toDataPath(fieldPath: string, getKey: PathMapOptions['ge
60
78
  * themselves (see `useField`'s `revealTarget`), then the field is scrolled
61
79
  * into view and focused.
62
80
  */
63
- export declare function createFieldReveal(options: PathMapOptions): {
81
+ export declare function createFieldReveal(options: FieldRevealOptions): {
64
82
  revealTarget: import("vue").ShallowRef<string | null, string | null>;
65
83
  registerFieldElement: (entry: FieldElementEntry) => () => void;
84
+ rememberField: (memory: FieldMemory) => void;
85
+ findAnchor: (fieldPath: string, element: Element | null) => string | null;
86
+ getAnchoredFields: () => Array<FieldCover & {
87
+ anchor: string;
88
+ }>;
66
89
  isFieldRendered: (fieldPath: string) => boolean;
67
90
  findCoveringElement: (fieldPath: string) => Element | null;
68
91
  reveal: (path: string, { duration, highlight: withHighlight }?: RevealOptions) => Promise<RevealResult | null>;
@@ -1 +1 @@
1
- {"version":3,"file":"reveal.d.ts","sourceRoot":"","sources":["../../../../../../../src/composables/reveal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,KAAK,EAAE,MAAM,KAAK,CAAA;AAMvE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAA;AACrC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,MAAM,WAAW,YAAY;IAC3B;;;;OAIG;IACH,IAAI,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