@salmonui/overlays 0.0.0-stage → 0.2.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 (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -2
  3. package/dist/dialog/AlertDialog.d.ts +62 -0
  4. package/dist/dialog/AlertDialog.d.ts.map +1 -0
  5. package/dist/dialog/AlertDialog.js +100 -0
  6. package/dist/dialog/AlertDialog.js.map +1 -0
  7. package/dist/dialog/Dialog.d.ts +15 -0
  8. package/dist/dialog/Dialog.d.ts.map +1 -0
  9. package/dist/dialog/Dialog.js +17 -0
  10. package/dist/dialog/Dialog.js.map +1 -0
  11. package/dist/dialog.css +656 -0
  12. package/dist/dialog.d.ts +6 -0
  13. package/dist/dialog.d.ts.map +1 -0
  14. package/dist/dialog.js +13 -0
  15. package/dist/dialog.js.map +1 -0
  16. package/dist/drawer/Drawer.d.ts +23 -0
  17. package/dist/drawer/Drawer.d.ts.map +1 -0
  18. package/dist/drawer/Drawer.js +11 -0
  19. package/dist/drawer/Drawer.js.map +1 -0
  20. package/dist/drawer.css +247 -0
  21. package/dist/drawer.d.ts +5 -0
  22. package/dist/drawer.d.ts.map +1 -0
  23. package/dist/drawer.js +11 -0
  24. package/dist/drawer.js.map +1 -0
  25. package/dist/internal/placement.d.ts +18 -0
  26. package/dist/internal/placement.d.ts.map +1 -0
  27. package/dist/internal/placement.js +19 -0
  28. package/dist/internal/placement.js.map +1 -0
  29. package/dist/popover/Popover.d.ts +99 -0
  30. package/dist/popover/Popover.d.ts.map +1 -0
  31. package/dist/popover/Popover.js +140 -0
  32. package/dist/popover/Popover.js.map +1 -0
  33. package/dist/popover.css +116 -0
  34. package/dist/popover.d.ts +3 -0
  35. package/dist/popover.d.ts.map +1 -0
  36. package/dist/popover.js +9 -0
  37. package/dist/popover.js.map +1 -0
  38. package/dist/styles.css +870 -0
  39. package/dist/tooltip/Tooltip.d.ts +87 -0
  40. package/dist/tooltip/Tooltip.d.ts.map +1 -0
  41. package/dist/tooltip/Tooltip.js +183 -0
  42. package/dist/tooltip/Tooltip.js.map +1 -0
  43. package/dist/tooltip.css +57 -0
  44. package/dist/tooltip.d.ts +3 -0
  45. package/dist/tooltip.d.ts.map +1 -0
  46. package/dist/tooltip.js +8 -0
  47. package/dist/tooltip.js.map +1 -0
  48. package/package.json +57 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 NuLL
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,45 @@
1
- # Temporary Holding Version
1
+ # @salmonui/overlays
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Dialog, AlertDialog, Drawer, Popover and Tooltip for Salmon UI.
4
+
5
+ ```sh
6
+ npm install @salmonui/overlays @salmonui/core react react-dom
7
+ ```
8
+
9
+ `react` and `react-dom` `>=19` are peer dependencies. ESM only.
10
+ Every `@salmonui/*` package of an application must resolve to the same
11
+ version (they are released together and exact-pinned to each other);
12
+ `@salmonui/core` warns in development when a second copy loads.
13
+
14
+ ```tsx
15
+ import { Dialog, DialogTrigger, DialogTitle, DialogBody } from '@salmonui/overlays/dialog';
16
+ import { Popover, PopoverTrigger, PopoverContent } from '@salmonui/overlays/popover';
17
+ import { Tooltip } from '@salmonui/overlays/tooltip';
18
+ ```
19
+
20
+ Import the theme stylesheet once per application, then the
21
+ stylesheet of each family you use:
22
+
23
+ ```tsx
24
+ import '@salmonui/core/styles.css'; // the theme, once per application
25
+ import '@salmonui/overlays/dialog/styles.css';
26
+ ```
27
+
28
+ Each family has its own `@salmonui/overlays/<family>/styles.css`.
29
+ A family stylesheet carries its own rules and those of every family and shared
30
+ module it renders, so it is the only stylesheet that family needs.
31
+
32
+ Public entry points:
33
+
34
+ - `@salmonui/overlays/dialog`
35
+ - `@salmonui/overlays/drawer`
36
+ - `@salmonui/overlays/popover`
37
+ - `@salmonui/overlays/tooltip`
38
+
39
+ ## Documentation
40
+
41
+ - Component guides and API reference: <https://salmonui.dev>
42
+
43
+ ## License
44
+
45
+ MIT
@@ -0,0 +1,62 @@
1
+ import { type ReactElement, type ReactNode } from 'react';
2
+ import { type DialogProps } from '@salmonui/core/internal/dialog-core/Dialog';
3
+ export interface AlertDialogLocaleText {
4
+ /** Confirm label without `confirmLabel`. Default `"OK"`. */
5
+ readonly ok?: string | undefined;
6
+ /** Cancel label without `cancelLabel` (only used when `onCancel` or a cancel label exists). Default `"Cancel"`. */
7
+ readonly cancel?: string | undefined;
8
+ /** Error text after a rejected `onConfirm` whose reason is not an `Error` with a message. Default `"Something went wrong. Try again."`. */
9
+ readonly error?: string | undefined;
10
+ }
11
+ export interface AlertDialogProps extends Omit<DialogProps, 'title' | 'dismissible' | 'trigger' | 'children' | 'localeText'> {
12
+ readonly title: ReactNode;
13
+ readonly description?: ReactNode;
14
+ /** Form fields (a prompt): the body and actions become a `<form>`; submitting it (Enter or the confirm button) calls `onConfirm(formData)`. */
15
+ readonly children?: ReactNode;
16
+ readonly trigger?: ReactNode;
17
+ readonly confirmLabel?: ReactNode;
18
+ /** Without a cancel label (and without `localeText.cancel` plus `onCancel`) the dialog is an alert with one action. */
19
+ readonly cancelLabel?: ReactNode;
20
+ readonly confirmIcon?: ReactNode;
21
+ readonly cancelIcon?: ReactNode;
22
+ /** `'danger'` styles the confirm button for destructive actions. */
23
+ readonly tone?: 'primary' | 'danger' | undefined;
24
+ /**
25
+ * May return a promise: the confirm button shows its loading state and the
26
+ * dialog stays open until it settles. While pending, Cancel is disabled and
27
+ * Escape and the close button are ignored. A rejection keeps the dialog open
28
+ * and shows the reason's `Error` message (else `localeText.error`) in a
29
+ * `role="alert"` region above the actions; confirming again clears it.
30
+ */
31
+ readonly onConfirm?: ((formData: FormData | undefined) => unknown) | undefined;
32
+ readonly onCancel?: (() => void) | undefined;
33
+ /** Escape cancels. Default true. */
34
+ readonly dismissible?: boolean | undefined;
35
+ readonly localeText?: AlertDialogLocaleText | undefined;
36
+ }
37
+ /** A confirm, alert or prompt dialog (`role="alertdialog"`, `.salmon-dialog[data-kind="alert"]`). */
38
+ export declare function AlertDialog(props: AlertDialogProps): ReactElement;
39
+ /** Options of `useConfirm()` / `useAlert()`. */
40
+ export interface ConfirmOptions extends Pick<AlertDialogProps, 'title' | 'description' | 'confirmLabel' | 'cancelLabel' | 'tone' | 'confirmIcon' | 'cancelIcon' | 'localeText' | 'className' | 'style'> {
41
+ /** Aborting closes the dialog; the promise resolves `false` (confirm) or `undefined` (alert). */
42
+ readonly signal?: AbortSignal | undefined;
43
+ /**
44
+ * Runs on confirm before the dialog closes. A returned promise keeps it open
45
+ * with a loading confirm button until it settles: fulfilled, the call resolves
46
+ * `true`; rejected, the error shows in the dialog (as on `AlertDialog`) and
47
+ * Cancel still resolves `false`.
48
+ */
49
+ readonly onConfirm?: (() => unknown) | undefined;
50
+ }
51
+ /**
52
+ * Hosts the dialogs of `useConfirm()` / `useAlert()` below it: a queue in
53
+ * its own state, at most one alert dialog at a time, nothing on the server.
54
+ */
55
+ export declare function DialogProvider(props: {
56
+ readonly children?: ReactNode;
57
+ }): ReactElement;
58
+ /** `await confirm({ title, description, tone })`: true on confirm, false on cancel, Escape or abort. */
59
+ export declare function useConfirm(): (options: ConfirmOptions) => Promise<boolean>;
60
+ /** `await alert({ title, description })`: resolves when the user acknowledges (or on abort). */
61
+ export declare function useAlert(): (options: ConfirmOptions) => Promise<void>;
62
+ //# sourceMappingURL=AlertDialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertDialog.d.ts","sourceRoot":"","sources":["../../src/dialog/AlertDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAgD,KAAK,YAAY,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExG,OAAO,EAA4E,KAAK,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAIxJ,MAAM,WAAW,qBAAqB;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,mHAAmH;IACnH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,2IAA2I;IAC3I,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,WAAW,gBAAiB,SAAQ,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,aAAa,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,CAAC;IAC1H,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,CAAC;IACjC,+IAA+I;IAC/I,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,C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U,IAAI,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAG1E;AAED,gGAAgG;AAChG,wBAAgB,QAAQ,IAAI,CAAC,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,IAAI,CAAC,CAGrE"}
@@ -0,0 +1,100 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ // AlertDialog, DialogProvider, useConfirm, useAlert (APG Alert and Message Dialogs). AlertDialog is
4
+ // the Dialog host with role="alertdialog", no backdrop dismissal and initial
5
+ // focus on the least destructive action. It composes `Button` (the Buttons
6
+ // family's public entry). The provider keeps its queue in its own state (one
7
+ // per provider instance); there is no library-owned global.
8
+ import { createContext, use, useState } from 'react';
9
+ import { Button } from '@salmonui/buttons/button';
10
+ import { DialogBody, DialogDescription, DialogFooter, DialogTitle, useOpenRequest } from '@salmonui/core/internal/dialog-core/Dialog';
11
+ import { DialogBase } from './Dialog.js';
12
+ import { useLocaleText } from '@salmonui/core/internal/locale';
13
+ /** A confirm, alert or prompt dialog (`role="alertdialog"`, `.salmon-dialog[data-kind="alert"]`). */
14
+ export function AlertDialog(props) {
15
+ const { title, description, children, confirmLabel, cancelLabel, confirmIcon, cancelIcon, tone = 'primary', onConfirm, onCancel, dismissible = true, localeText: ownText, ...rest } = props;
16
+ const localeText = useLocaleText('alertDialog', ownText);
17
+ // The open triad straight from props; the root below overrides `open` and `onOpenChange`.
18
+ const [open, request] = useOpenRequest(props);
19
+ // `true` while an async confirm is pending, the error text after it rejected.
20
+ const [pending, setPending] = useState(null);
21
+ const busy = pending === true;
22
+ const hasCancel = cancelLabel !== undefined || onCancel !== undefined;
23
+ const confirm = (data) => {
24
+ if (busy)
25
+ return;
26
+ const result = onConfirm?.(data);
27
+ if (!result?.then)
28
+ return request(false, 'confirm', 'api');
29
+ setPending(true);
30
+ result.then(() => (setPending(null), request(false, 'confirm', 'api')), (reason) => setPending((reason instanceof Error && reason.message) || localeText?.error || 'Something went wrong. Try again.'));
31
+ };
32
+ const cancel = () => {
33
+ onCancel?.();
34
+ setPending(null);
35
+ request(false, 'cancel', 'api');
36
+ };
37
+ const actions = (_jsxs(_Fragment, { children: [typeof pending === 'string' ? (_jsx("div", { className: "salmon-alert-dialog-error", role: "alert", children: pending })) : null, _jsxs(DialogFooter, { children: [hasCancel ? (_jsx(Button, { variant: "outline", "data-autofocus": "", iconStart: cancelIcon, onClick: cancel, disabled: busy, children: cancelLabel ?? localeText?.cancel ?? 'Cancel' })) : null, _jsx(Button, { tone: tone, type: children ? 'submit' : 'button', iconStart: confirmIcon, loading: busy, "data-autofocus": hasCancel ? undefined : '', onClick: children ? undefined : () => confirm(undefined), children: confirmLabel ?? localeText?.ok ?? 'OK' })] })] }));
38
+ return (_jsxs(DialogBase, { ...rest, kind: "alert", open: open, dismissible: { escape: dismissible, outside: false }, onOpenChange: (next, e) => {
39
+ // Escape (and any other host request) is a cancel; the root stays controlled by this component.
40
+ // A pending confirm ignores Escape and the close button.
41
+ e.preventDefault();
42
+ if (busy)
43
+ return;
44
+ setPending(null);
45
+ if (!next)
46
+ onCancel?.();
47
+ request(next, e.reason, e.source);
48
+ }, children: [_jsx(DialogTitle, { children: title }), description === undefined ? null : _jsx(DialogDescription, { children: description }), children ? (_jsxs("form", { className: "salmon-dialog-form", onSubmit: (e) => {
49
+ e.preventDefault();
50
+ confirm(new FormData(e.currentTarget));
51
+ }, children: [_jsx(DialogBody, { children: children }), actions] })) : (actions)] }));
52
+ }
53
+ const QueueContext = createContext(null);
54
+ /**
55
+ * Hosts the dialogs of `useConfirm()` / `useAlert()` below it: a queue in
56
+ * its own state, at most one alert dialog at a time, nothing on the server.
57
+ */
58
+ export function DialogProvider(props) {
59
+ const [entries, setEntries] = useState([]);
60
+ const [seq] = useState(() => ({ n: 0 }));
61
+ const [queue] = useState(() => ({
62
+ push(kind, options) {
63
+ return new Promise((resolve) => {
64
+ const id = ++seq.n;
65
+ const done = (value) => {
66
+ setEntries((list) => list.filter((e) => e.id !== id));
67
+ resolve(value);
68
+ };
69
+ if (options.signal?.aborted)
70
+ return resolve(false);
71
+ options.signal?.addEventListener('abort', () => done(false), { once: true });
72
+ setEntries((list) => [...list, { id, kind, options, resolve: done }]);
73
+ });
74
+ },
75
+ }));
76
+ const current = entries[0];
77
+ return (_jsxs(QueueContext, { value: queue, children: [props.children, current ? (_jsx(AlertDialog, { ...current.options, defaultOpen: true, cancelLabel: current.kind === 'confirm' ? current.options.cancelLabel : undefined, onConfirm: () => {
78
+ const result = current.options.onConfirm?.();
79
+ if (!result?.then)
80
+ return current.resolve(true);
81
+ return result.then(() => current.resolve(true));
82
+ }, onCancel: () => current.resolve(false) }, current.id)) : null] }));
83
+ }
84
+ function useQueue(name) {
85
+ const queue = use(QueueContext);
86
+ if (!queue)
87
+ throw new Error(`[salmonui] ${name}() needs a <DialogProvider> above it.`);
88
+ return queue;
89
+ }
90
+ /** `await confirm({ title, description, tone })`: true on confirm, false on cancel, Escape or abort. */
91
+ export function useConfirm() {
92
+ const queue = useQueue('useConfirm');
93
+ return (options) => queue.push('confirm', options);
94
+ }
95
+ /** `await alert({ title, description })`: resolves when the user acknowledges (or on abort). */
96
+ export function useAlert() {
97
+ const queue = useQueue('useAlert');
98
+ return (options) => queue.push('alert', options).then(() => undefined);
99
+ }
100
+ //# sourceMappingURL=AlertDialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlertDialog.js","sourceRoot":"","sources":["../../src/dialog/AlertDialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,oGAAoG;AACpG,6EAA6E;AAC7E,2EAA2E;AAC3E,6EAA6E;AAC7E,4DAA4D;AAE5D,OAAO,EAAE,aAAa,EAAE,GAAG,EAAE,QAAQ,EAAqD,MAAM,OAAO,CAAC;AACxG,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,YAAY,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,15 @@
1
+ import type { ReactElement } from 'react';
2
+ import { type DialogParts, type DialogProps, type RootProps } from '@salmonui/core/internal/dialog-core/Dialog';
3
+ /** @internal The dialog core of `Dialog` and `AlertDialog`: the lazy drag and resize chunk and the `dialog` family's text. */
4
+ export declare function DialogBase(props: RootProps): ReactElement;
5
+ /** Dialog root: the open state, the trigger and the `<dialog>` (`.salmon-dialog`). */
6
+ export declare function Dialog(props: DialogProps): ReactElement;
7
+ export declare namespace Dialog {
8
+ const Trigger: DialogParts['Trigger'];
9
+ const Close: DialogParts['Close'];
10
+ const Title: DialogParts['Title'];
11
+ const Description: DialogParts['Description'];
12
+ const Body: DialogParts['Body'];
13
+ const Footer: DialogParts['Footer'];
14
+ }
15
+ //# sourceMappingURL=Dialog.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAqB,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAKnI,8HAA8H;AAC9H,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,CAIzD;AAED,sFAAsF;AACtF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAEvD;AAGD,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IACvB,MAAM,OAAO,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACtC,MAAM,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,KAAK,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IAClC,MAAM,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IAC9C,MAAM,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAChC,MAAM,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;CAC5C"}
@@ -0,0 +1,17 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { DialogRoot, PARTS } from '@salmonui/core/internal/dialog-core/Dialog';
4
+ import { useLocaleText } from '@salmonui/core/internal/locale';
5
+ const loadDrag = () => import('@salmonui/core/internal/dialog-core/drag');
6
+ /** @internal The dialog core of `Dialog` and `AlertDialog`: the lazy drag and resize chunk and the `dialog` family's text. */
7
+ export function DialogBase(props) {
8
+ // One `dialog` family for Dialog, AlertDialog and Drawer (the close button, drag and resize text).
9
+ const localeText = useLocaleText('dialog', props.localeText);
10
+ return _jsx(DialogRoot, { ...props, localeText: localeText, loadDrag: loadDrag });
11
+ }
12
+ /** Dialog root: the open state, the trigger and the `<dialog>` (`.salmon-dialog`). */
13
+ export function Dialog(props) {
14
+ return _jsx(DialogBase, { ...props, kind: "dialog" });
15
+ }
16
+ Object.assign(Dialog, PARTS);
17
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sourceRoot":"","sources":["../../src/dialog/Dialog.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAOb,OAAO,EAAE,UAAU,EAAE,KAAK,EAAsD,MAAM,4CAA4C,CAAC;AACnI,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,MAAM,QAAQ,GAAG,GAAuE,EAAE,CAAC,MAAM,CAAC,0CAA0C,CAAC,CAAC;AAE9I,8HAA8H;AAC9H,MAAM,UAAU,UAAU,CAAC,KAAgB;IACzC,mGAAmG;IACnG,MAAM,UAAU,GAAG,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC7D,OAAO,KAAC,UAAU,OAAK,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAAE,QAAQ,GAAI,CAAC;AAC/E,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,MAAM,CAAC,KAAkB;IACvC,OAAO,KAAC,UAAU,OAAK,KAAK,EAAE,IAAI,EAAC,QAAQ,GAAG,CAAC;AACjD,CAAC;AAWD,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC"}