@photon-ai/pho-ui 0.7.1 → 1.0.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 (121) hide show
  1. package/dist/chunks/avatar-CiAvJNNs.js +99 -0
  2. package/dist/chunks/avatar-CiAvJNNs.js.map +1 -0
  3. package/dist/chunks/close-button-8f-oRJXt.js +420 -0
  4. package/dist/chunks/close-button-8f-oRJXt.js.map +1 -0
  5. package/dist/chunks/{cn-7uGUzCOM.js → cn-DTiB6ek_.js} +4 -2
  6. package/dist/chunks/{cn-7uGUzCOM.js.map → cn-DTiB6ek_.js.map} +1 -1
  7. package/dist/chunks/dialog-Bgb2Z1_v.js +141 -0
  8. package/dist/chunks/dialog-Bgb2Z1_v.js.map +1 -0
  9. package/dist/chunks/{input-DbJpdu6v.js → input-BSJGBUbf.js} +36 -36
  10. package/dist/chunks/input-BSJGBUbf.js.map +1 -0
  11. package/dist/chunks/menu-COLB_liS.js +205 -0
  12. package/dist/chunks/menu-COLB_liS.js.map +1 -0
  13. package/dist/chunks/{sidebar-CivriTLb.js → sidebar-16Pfn7IC.js} +12 -12
  14. package/dist/chunks/sidebar-16Pfn7IC.js.map +1 -0
  15. package/dist/chunks/spinner-Cy8bkyJf.js +54 -0
  16. package/dist/chunks/spinner-Cy8bkyJf.js.map +1 -0
  17. package/dist/components/accordion.js +21 -21
  18. package/dist/components/accordion.js.map +1 -1
  19. package/dist/components/alert-dialog.js +26 -26
  20. package/dist/components/alert-dialog.js.map +1 -1
  21. package/dist/components/autocomplete.js +46 -46
  22. package/dist/components/autocomplete.js.map +1 -1
  23. package/dist/components/avatar.js +1 -1
  24. package/dist/components/badge.js +1 -1
  25. package/dist/components/button.js +11 -11
  26. package/dist/components/checkbox.js +3 -3
  27. package/dist/components/checkbox.js.map +1 -1
  28. package/dist/components/collapsible.js +8 -8
  29. package/dist/components/collapsible.js.map +1 -1
  30. package/dist/components/combobox.js +69 -69
  31. package/dist/components/combobox.js.map +1 -1
  32. package/dist/components/context-menu.js +57 -44
  33. package/dist/components/context-menu.js.map +1 -1
  34. package/dist/components/dialog.js +3 -2
  35. package/dist/components/drawer.js +15 -15
  36. package/dist/components/drawer.js.map +1 -1
  37. package/dist/components/field.js +18 -18
  38. package/dist/components/field.js.map +1 -1
  39. package/dist/components/fieldset.js +9 -9
  40. package/dist/components/fieldset.js.map +1 -1
  41. package/dist/components/form.js +1 -1
  42. package/dist/components/input.js +1 -1
  43. package/dist/components/kbd.js +6 -6
  44. package/dist/components/kbd.js.map +1 -1
  45. package/dist/components/menu.js +6 -4
  46. package/dist/components/menubar.js +5 -5
  47. package/dist/components/menubar.js.map +1 -1
  48. package/dist/components/meter.js +20 -20
  49. package/dist/components/meter.js.map +1 -1
  50. package/dist/components/navigation-menu.js +8 -8
  51. package/dist/components/navigation-menu.js.map +1 -1
  52. package/dist/components/notification.js +24 -24
  53. package/dist/components/notification.js.map +1 -1
  54. package/dist/components/number-field.js +32 -32
  55. package/dist/components/number-field.js.map +1 -1
  56. package/dist/components/otp-field.js +5 -5
  57. package/dist/components/otp-field.js.map +1 -1
  58. package/dist/components/popover.js +10 -10
  59. package/dist/components/popover.js.map +1 -1
  60. package/dist/components/preview-card.js +8 -8
  61. package/dist/components/preview-card.js.map +1 -1
  62. package/dist/components/progress.js +25 -25
  63. package/dist/components/progress.js.map +1 -1
  64. package/dist/components/radio-group.js +13 -13
  65. package/dist/components/radio-group.js.map +1 -1
  66. package/dist/components/scroll-area.js +1 -1
  67. package/dist/components/select.js +27 -27
  68. package/dist/components/select.js.map +1 -1
  69. package/dist/components/separator.js +1 -1
  70. package/dist/components/slider.js +17 -17
  71. package/dist/components/slider.js.map +1 -1
  72. package/dist/components/spinner.js +6 -0
  73. package/dist/components/switch.js +10 -10
  74. package/dist/components/switch.js.map +1 -1
  75. package/dist/components/tabs.js +16 -16
  76. package/dist/components/tabs.js.map +1 -1
  77. package/dist/components/theme-toggle.js +199 -0
  78. package/dist/components/theme-toggle.js.map +1 -0
  79. package/dist/components/toast.js +24 -24
  80. package/dist/components/toast.js.map +1 -1
  81. package/dist/components/toggle-group.js +1 -1
  82. package/dist/components/toggle.js +5 -5
  83. package/dist/components/toggle.js.map +1 -1
  84. package/dist/components/toolbar.js +8 -8
  85. package/dist/components/toolbar.js.map +1 -1
  86. package/dist/components/tooltip.js +10 -10
  87. package/dist/components/tooltip.js.map +1 -1
  88. package/dist/index.js +29 -28
  89. package/dist/sections/sidebar.js +1 -1
  90. package/dist/src/components/avatar/avatar.d.ts +24 -2
  91. package/dist/src/components/avatar/index.d.ts +1 -1
  92. package/dist/src/components/button/button.d.ts +58 -44
  93. package/dist/src/components/button/index.d.ts +1 -1
  94. package/dist/src/components/dialog/dialog.d.ts +50 -7
  95. package/dist/src/components/dialog/index.d.ts +1 -1
  96. package/dist/src/components/menu/index.d.ts +1 -1
  97. package/dist/src/components/menu/menu-pending.d.ts +43 -0
  98. package/dist/src/components/spinner/index.d.ts +1 -0
  99. package/dist/src/components/spinner/spinner.d.ts +32 -0
  100. package/dist/src/components/theme-toggle/index.d.ts +1 -0
  101. package/dist/src/components/theme-toggle/theme-toggle.d.ts +77 -0
  102. package/dist/src/sections/sidebar/sidebar.d.ts +5 -6
  103. package/dist/utils.js +1 -1
  104. package/package.json +9 -1
  105. package/src/styles/fonts.css +14 -18
  106. package/src/styles/pho.css +11 -0
  107. package/src/styles/theme.css +182 -146
  108. package/dist/chunks/avatar-Bb4RZQIa.js +0 -53
  109. package/dist/chunks/avatar-Bb4RZQIa.js.map +0 -1
  110. package/dist/chunks/button-CQ4cZvkC.js +0 -365
  111. package/dist/chunks/button-CQ4cZvkC.js.map +0 -1
  112. package/dist/chunks/close-button-CNhn8z0w.js +0 -29
  113. package/dist/chunks/close-button-CNhn8z0w.js.map +0 -1
  114. package/dist/chunks/dialog-7oOe-eaO.js +0 -63
  115. package/dist/chunks/dialog-7oOe-eaO.js.map +0 -1
  116. package/dist/chunks/input-DbJpdu6v.js.map +0 -1
  117. package/dist/chunks/menu-BfaNHnOp.js +0 -101
  118. package/dist/chunks/menu-BfaNHnOp.js.map +0 -1
  119. package/dist/chunks/sidebar-CivriTLb.js.map +0 -1
  120. package/dist/src/components/context-menu/context-menu.d.ts +0 -34
  121. package/dist/src/components/menu/menu.d.ts +0 -47
@@ -0,0 +1,141 @@
1
+ "use client";
2
+ import { t as g } from "./cn-DTiB6ek_.js";
3
+ import { o as T, t as j } from "./close-button-8f-oRJXt.js";
4
+ import { createContext as R, useCallback as z, useContext as x, useEffect as v, useMemo as A, useRef as m, useState as C } from "react";
5
+ import { jsx as t, jsxs as f } from "react/jsx-runtime";
6
+ import { Dialog as i } from "@base-ui/react/dialog";
7
+ var y = R(null);
8
+ function G() {
9
+ return x(y)?.pending ?? !1;
10
+ }
11
+ function E({ onOpenChange: e, actionsRef: n, ...s }) {
12
+ const [u, r] = C(!1), l = m(!1), a = m(null);
13
+ v(() => {
14
+ if (n)
15
+ return n.current = a.current, () => {
16
+ n.current = null;
17
+ };
18
+ }, [n]);
19
+ const o = z((c, p) => {
20
+ if (!c && l.current) {
21
+ p.cancel();
22
+ return;
23
+ }
24
+ e?.(c, p);
25
+ }, [e]), d = A(() => ({
26
+ pending: u,
27
+ beginPending: () => {
28
+ l.current = !0, r(!0);
29
+ },
30
+ endPending: () => {
31
+ l.current = !1, r(!1);
32
+ },
33
+ close: () => a.current?.close()
34
+ }), [u]);
35
+ return /* @__PURE__ */ t(y.Provider, {
36
+ value: d,
37
+ children: /* @__PURE__ */ t(i.Root, {
38
+ actionsRef: a,
39
+ onOpenChange: o,
40
+ ...s
41
+ })
42
+ });
43
+ }
44
+ var O = i.Trigger, N = i.Portal, P = i.Close;
45
+ function V(e) {
46
+ return e != null && typeof e.then == "function";
47
+ }
48
+ function H({ onClick: e, loading: n, disabled: s, ...u }) {
49
+ const r = x(y), [l, a] = C(!1), o = m(!0);
50
+ v(() => (o.current = !0, () => {
51
+ o.current = !1;
52
+ }), []);
53
+ function d(p) {
54
+ if (l || n) return;
55
+ const h = e?.(p);
56
+ if (!V(h)) {
57
+ r?.close();
58
+ return;
59
+ }
60
+ a(!0), r?.beginPending(), h.then(() => {
61
+ r?.endPending(), o.current && a(!1), r?.close();
62
+ }, (w) => {
63
+ r?.endPending(), o.current && a(!1), typeof process < "u" && process.env.NODE_ENV !== "production" && console.error("Dialog.Action: async onClick rejected —", w);
64
+ });
65
+ }
66
+ const c = l || n;
67
+ return /* @__PURE__ */ t(T, {
68
+ ...u,
69
+ disabled: s || c,
70
+ loading: c,
71
+ onClick: d
72
+ });
73
+ }
74
+ function b({ className: e, ...n }) {
75
+ return /* @__PURE__ */ t(i.Backdrop, {
76
+ className: g("bg-pho-overlay fixed inset-0 z-50 transition-opacity duration-200 ease-out", "data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:opacity-0", e),
77
+ ...n
78
+ });
79
+ }
80
+ function B({ className: e, ...n }) {
81
+ return /* @__PURE__ */ t(i.Popup, {
82
+ className: g("border-pho-secondary bg-pho-primary shadow-pho-xl fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg border outline-none", "transition-[opacity,scale] duration-200 ease-out", "data-[starting-style]:scale-95 data-[starting-style]:opacity-0", "data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-150", e),
83
+ ...n
84
+ });
85
+ }
86
+ function D({ className: e, ...n }) {
87
+ return /* @__PURE__ */ t(i.Title, {
88
+ className: g("text-pho-primary font-display text-display-sm font-medium text-balance", e),
89
+ ...n
90
+ });
91
+ }
92
+ function k({ className: e, ...n }) {
93
+ return /* @__PURE__ */ t(i.Description, {
94
+ className: g("text-pho-description text-display-xs font-normal", e),
95
+ ...n
96
+ });
97
+ }
98
+ function M({ title: e, description: n, actions: s, showClose: u = !0, children: r, className: l, ...a }) {
99
+ const o = s == null && u, d = !!(e || n || o), c = r != null || s != null;
100
+ return /* @__PURE__ */ f(N, { children: [/* @__PURE__ */ t(b, {}), /* @__PURE__ */ f(B, {
101
+ className: l,
102
+ ...a,
103
+ children: [d && /* @__PURE__ */ f("div", {
104
+ className: "flex flex-col gap-1 px-6 pt-6",
105
+ children: [(e || o) && /* @__PURE__ */ f("div", {
106
+ className: "relative",
107
+ children: [e ? /* @__PURE__ */ t(D, {
108
+ className: o ? "pr-12" : void 0,
109
+ children: e
110
+ }) : /* @__PURE__ */ t("div", {
111
+ className: "h-[1.625rem]",
112
+ "aria-hidden": "true"
113
+ }), o && /* @__PURE__ */ t(P, { render: /* @__PURE__ */ t(j, { className: "absolute top-1/2 right-0 z-10 -translate-y-1/2" }) })]
114
+ }), n && /* @__PURE__ */ t(k, { children: n })]
115
+ }), c && /* @__PURE__ */ f("div", {
116
+ className: "flex flex-col gap-5 px-6 py-5",
117
+ children: [r, s != null && /* @__PURE__ */ t("div", {
118
+ className: "flex justify-end gap-2",
119
+ children: s
120
+ })]
121
+ })]
122
+ })] });
123
+ }
124
+ var I = {
125
+ Root: E,
126
+ Trigger: O,
127
+ Portal: N,
128
+ Backdrop: b,
129
+ Popup: B,
130
+ Title: D,
131
+ Description: k,
132
+ Close: P,
133
+ Action: H,
134
+ Content: M
135
+ };
136
+ export {
137
+ G as n,
138
+ I as t
139
+ };
140
+
141
+ //# sourceMappingURL=dialog-Bgb2Z1_v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dialog-Bgb2Z1_v.js","names":[],"sources":["../../src/components/dialog/dialog.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentProps,\n type ElementType,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n} from \"react\";\nimport { Dialog as BaseDialog } from \"@base-ui/react/dialog\";\nimport { cn } from \"../../utils/cn\";\nimport { Button, type ButtonProps } from \"../button/button\";\nimport { CloseButton } from \"../button/close-button\";\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\"\n> & {\n className?: string;\n};\n\n/* ========================== Async pending context ========================== */\n\n/** Imperative actions exposed by Base UI's `actionsRef`. */\ninterface RootActions {\n unmount: () => void;\n close: () => void;\n}\n\ninterface DialogPendingContextValue {\n /** True while a `Dialog.Action` promise is in flight. */\n pending: boolean;\n beginPending: () => void;\n endPending: () => void;\n /** Close the dialog imperatively (used by `Dialog.Action` on resolve). */\n close: () => void;\n}\n\nconst DialogPendingContext = createContext<DialogPendingContextValue | null>(\n null,\n);\n\n/**\n * Whether the surrounding dialog has a `Dialog.Action` promise in flight —\n * use it to disable secondary actions (Cancel etc.) while work is pending.\n * Returns `false` outside a `Dialog.Root`.\n */\nexport function useDialogPending(): boolean {\n return useContext(DialogPendingContext)?.pending ?? false;\n}\n\ntype RootProps = ComponentProps<typeof BaseDialog.Root>;\n\n/**\n * `Dialog.Root` with async awareness: while a `Dialog.Action` promise is\n * pending, every close request (outside press, Escape, `Dialog.Close`) is\n * cancelled so the dialog stays open until the work settles. Props pass\n * through to Base UI's `Dialog.Root` unchanged.\n */\nfunction Root({ onOpenChange, actionsRef, ...props }: RootProps) {\n const [pending, setPending] = useState(false);\n // Guard reads a ref so a resolve → close() in the same tick isn't blocked\n // by a not-yet-flushed state update.\n const pendingRef = useRef(false);\n const internalActionsRef = useRef<RootActions | null>(null);\n\n // Keep a caller-supplied actionsRef working alongside our internal one.\n useEffect(() => {\n if (!actionsRef) return;\n actionsRef.current = internalActionsRef.current;\n return () => {\n actionsRef.current = null;\n };\n }, [actionsRef]);\n\n const handleOpenChange = useCallback<NonNullable<RootProps[\"onOpenChange\"]>>(\n (open, eventDetails) => {\n if (!open && pendingRef.current) {\n eventDetails.cancel();\n return;\n }\n onOpenChange?.(open, eventDetails);\n },\n [onOpenChange],\n );\n\n const contextValue = useMemo<DialogPendingContextValue>(\n () => ({\n pending,\n beginPending: () => {\n pendingRef.current = true;\n setPending(true);\n },\n endPending: () => {\n pendingRef.current = false;\n setPending(false);\n },\n close: () => internalActionsRef.current?.close(),\n }),\n [pending],\n );\n\n return (\n <DialogPendingContext.Provider value={contextValue}>\n <BaseDialog.Root\n actionsRef={internalActionsRef}\n onOpenChange={handleOpenChange}\n {...props}\n />\n </DialogPendingContext.Provider>\n );\n}\n\nconst Trigger = BaseDialog.Trigger;\nconst Portal = BaseDialog.Portal;\nconst Close = BaseDialog.Close;\n\n/* ============================== Dialog.Action ============================== */\n\nexport interface DialogActionProps extends Omit<ButtonProps, \"onClick\"> {\n /**\n * Confirm handler. Return a promise to keep the dialog open while it runs:\n * the button shows `loading`, all dismissal is locked, and the dialog\n * closes when the promise resolves. On rejection the dialog stays open —\n * surface errors inside the handler. A non-promise return closes\n * immediately, like `Dialog.Close`.\n */\n onClick?: (\n event: ReactMouseEvent<HTMLButtonElement>,\n ) => void | Promise<unknown>;\n}\n\nfunction isThenable(value: unknown): value is Promise<unknown> {\n return (\n value != null && typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\n/**\n * The confirm button of an action row, with native promise support — a\n * `Button` that runs its (possibly async) `onClick` and closes the dialog\n * when the work settles successfully.\n */\nfunction Action({ onClick, loading, disabled, ...props }: DialogActionProps) {\n const pendingContext = useContext(DialogPendingContext);\n const [busy, setBusy] = useState(false);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n function handleClick(event: ReactMouseEvent<HTMLButtonElement>) {\n if (busy || loading) return;\n const result = onClick?.(event);\n if (!isThenable(result)) {\n pendingContext?.close();\n return;\n }\n setBusy(true);\n pendingContext?.beginPending();\n result.then(\n () => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n pendingContext?.close();\n },\n (error: unknown) => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.error(\"Dialog.Action: async onClick rejected —\", error);\n }\n },\n );\n }\n\n const inert = busy || loading;\n return (\n <Button\n {...props}\n disabled={disabled || inert}\n loading={inert}\n onClick={handleClick}\n />\n );\n}\n\nfunction Backdrop({\n className,\n ...props\n}: StyledProps<typeof BaseDialog.Backdrop>) {\n return (\n <BaseDialog.Backdrop\n className={cn(\n \"bg-pho-overlay fixed inset-0 z-50 transition-opacity duration-200 ease-out\",\n \"data-[ending-style]:opacity-0 data-[ending-style]:duration-150 data-[starting-style]:opacity-0\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Popup({ className, ...props }: StyledProps<typeof BaseDialog.Popup>) {\n return (\n <BaseDialog.Popup\n className={cn(\n // Floating layer: bg-pho-primary + border-pho-secondary hairline, elevation kept.\n \"border-pho-secondary bg-pho-primary shadow-pho-xl fixed top-1/2 left-1/2 z-50 w-[calc(100%-2rem)] max-w-lg -translate-x-1/2 -translate-y-1/2 overflow-hidden rounded-lg border outline-none\",\n // Opacity + scale only — leave translate centering alone (no transition-all).\n \"transition-[opacity,scale] duration-200 ease-out\",\n \"data-[starting-style]:scale-95 data-[starting-style]:opacity-0\",\n \"data-[ending-style]:scale-95 data-[ending-style]:opacity-0 data-[ending-style]:duration-150\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Title({ className, ...props }: StyledProps<typeof BaseDialog.Title>) {\n return (\n <BaseDialog.Title\n className={cn(\n \"text-pho-primary font-display text-display-sm font-medium text-balance\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Description({\n className,\n ...props\n}: StyledProps<typeof BaseDialog.Description>) {\n return (\n <BaseDialog.Description\n className={cn(\n \"text-pho-description text-display-xs font-normal\",\n className,\n )}\n {...props}\n />\n );\n}\n\ninterface ContentProps extends Omit<\n StyledProps<typeof BaseDialog.Popup>,\n \"title\"\n> {\n /** Heading rendered in the panel header. */\n title?: ReactNode;\n /** Supporting text under the title. */\n description?: ReactNode;\n /**\n * Footer action row (Cancel / Confirm, etc.). Iron rule: when `actions` is\n * set, the header close button is never shown — dismiss via the actions.\n */\n actions?: ReactNode;\n /**\n * Header close control. Only applies when `actions` is absent.\n * @default true\n */\n showClose?: boolean;\n children?: ReactNode;\n}\n\n/**\n * Convenience panel: renders the portal, backdrop, and styled popup with an\n * optional header (title/description + close) and optional action row. For\n * full control, compose the parts directly (`Dialog.Portal` /\n * `Dialog.Backdrop` / `Dialog.Popup`).\n */\nfunction Content({\n title,\n description,\n actions,\n showClose = true,\n children,\n className,\n ...props\n}: ContentProps) {\n // Iron rule: action dialogs dismiss via their actions — never a header X.\n const showCloseButton = actions == null && showClose;\n const hasHeader = Boolean(title || description || showCloseButton);\n const hasBody = children != null || actions != null;\n\n return (\n <Portal>\n <Backdrop />\n <Popup className={className} {...props}>\n {hasHeader && (\n <div className=\"flex flex-col gap-1 px-6 pt-6\">\n {(title || showCloseButton) && (\n // Title row height = title only. Close is out of flow, centered\n // on the row, and may paint outside it (no clip, no stretch).\n <div className=\"relative\">\n {title ? (\n <Title className={showCloseButton ? \"pr-12\" : undefined}>\n {title}\n </Title>\n ) : (\n <div className=\"h-[1.625rem]\" aria-hidden=\"true\" />\n )}\n {showCloseButton && (\n <Close\n render={\n <CloseButton className=\"absolute top-1/2 right-0 z-10 -translate-y-1/2\" />\n }\n />\n )}\n </div>\n )}\n {description && <Description>{description}</Description>}\n </div>\n )}\n {hasBody && (\n <div className=\"flex flex-col gap-5 px-6 py-5\">\n {children}\n {actions != null && (\n <div className=\"flex justify-end gap-2\">{actions}</div>\n )}\n </div>\n )}\n </Popup>\n </Portal>\n );\n}\n\n/**\n * Modal dialog built on Base UI `Dialog`. Controlled or uncontrolled via\n * `Dialog.Root` (`open` / `onOpenChange` / `defaultOpen`). `Dialog.Action`\n * adds native promise support: an async confirm keeps the dialog open and\n * undismissable until the work resolves.\n */\nexport const Dialog = {\n Root,\n Trigger,\n Portal,\n Backdrop,\n Popup,\n Title,\n Description,\n Close,\n Action,\n Content,\n};\n"],"mappings":";;;;;;AA2CA,IAAM,IAAuB,EAC3B,IACF;AAOA,SAAg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,KAAW,QACV,gBAAA,EAAC,OAAD;AAAA,QAAK,WAAU;AAAA,kBAA0B;AAAA,MAAa,CAAA,CAErD;AAAA,MAEF;AAAA,IACD,EAAA,CAAA;AAEZ;AAQA,IAAa,IAAS;AAAA,EACpB,MAAA;AAAA,EACA,SAAA;AAAA,EACA,QAAA;AAAA,EACA,UAAA;AAAA,EACA,OAAA;AAAA,EACA,OAAA;AAAA,EACA,aAAA;AAAA,EACA,OAAA;AAAA,EACA,QAAA;AAAA,EACA,SAAA;AACF"}
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { t as r } from "./cn-7uGUzCOM.js";
2
+ import { t as r } from "./cn-DTiB6ek_.js";
3
3
  import { t as n } from "./createReactComponent-BqCmnqfX.js";
4
4
  import { useState as A } from "react";
5
- import { jsx as e, jsxs as l } from "react/jsx-runtime";
6
- import { Field as s } from "@base-ui/react/field";
5
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
6
+ import { Field as l } from "@base-ui/react/field";
7
7
  var S = [
8
8
  ["path", {
9
9
  d: "M10.585 10.587a2 2 0 0 0 2.829 2.828",
@@ -27,7 +27,7 @@ var S = [
27
27
  d: "M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z",
28
28
  key: "svg-0"
29
29
  }]], L = n("filled", "alert-circle-filled", "AlertCircleFilled", R), M = {
30
- sm: "px-2.5 py-1.5 text-sm",
30
+ sm: "px-2.5 py-1.5 text-md md:text-base",
31
31
  md: "px-2.5 py-1.5 text-md",
32
32
  lg: "px-3 py-2 text-md"
33
33
  }, O = {
@@ -39,61 +39,61 @@ var S = [
39
39
  md: "left-3 size-5",
40
40
  lg: "left-3.5 size-5"
41
41
  }, F = {
42
- sm: "rounded-lg",
43
- md: "rounded-lg",
44
- lg: "squircle rounded-xl"
42
+ sm: "rounded-base",
43
+ md: "rounded-base",
44
+ lg: "squircle rounded-base"
45
45
  }, P = {
46
46
  sm: "",
47
47
  md: "",
48
- lg: r("isolate before:pointer-events-none before:absolute before:-z-10 before:content-['']", "before:bg-pho-primary before:inset-px before:rounded-[11px]", "has-[input:focus-visible]:before:inset-0.5 has-[input:focus-visible]:before:rounded-[10px]", "before:transition-[inset,border-radius] before:duration-100 before:ease-linear")
48
+ lg: r("isolate before:pointer-events-none before:absolute before:-z-10 before:content-['']", "before:bg-pho-primary before:inset-px before:rounded-[calc(var(--radius-base)-1px)]", "has-[input:focus-visible]:before:inset-0.5 has-[input:focus-visible]:before:rounded-[calc(var(--radius-base)-2px)]", "before:transition-[inset,border-radius] before:duration-100 before:ease-linear")
49
49
  }, T = {
50
- sm: "autofill:rounded-md",
51
- md: "autofill:rounded-md",
52
- lg: "autofill:rounded-[10px]"
50
+ sm: "autofill:rounded-[calc(var(--radius-base)-2px)]",
51
+ md: "autofill:rounded-[calc(var(--radius-base)-2px)]",
52
+ lg: "autofill:rounded-[calc(var(--radius-base)-2px)]"
53
53
  };
54
- function Z({ label: d, hint: p, size: t = "md", invalid: a, icon: i, labelTrailing: m, disabled: h, required: c, type: u = "text", className: g, wrapperClassName: v, id: b, ref: x, ...y }) {
55
- const [f, N] = A(!1), o = u === "password", I = o && f ? "text" : u, _ = !!i, E = o || a;
56
- return /* @__PURE__ */ l(s.Root, {
57
- disabled: h,
54
+ function Z({ label: d, hint: c, size: a = "md", invalid: t, icon: i, labelTrailing: f, disabled: b, required: p, type: u = "text", className: v, wrapperClassName: h, id: x, ref: g, ...y }) {
55
+ const [m, N] = A(!1), o = u === "password", I = o && m ? "text" : u, _ = !!i, E = o || t;
56
+ return /* @__PURE__ */ s(l.Root, {
57
+ disabled: b,
58
58
  className: "group/field flex w-full flex-col gap-1.5",
59
59
  children: [
60
- d && /* @__PURE__ */ l("div", {
60
+ d && /* @__PURE__ */ s("div", {
61
61
  className: "flex items-center justify-between gap-2",
62
- children: [/* @__PURE__ */ l(s.Label, {
63
- className: "text-pho-secondary flex cursor-default items-center gap-0.5 text-sm font-medium",
64
- children: [d, c && /* @__PURE__ */ e("span", {
62
+ children: [/* @__PURE__ */ s(l.Label, {
63
+ className: "text-pho-secondary flex cursor-default items-center gap-0.5 text-base font-medium",
64
+ children: [d, p && /* @__PURE__ */ e("span", {
65
65
  className: "text-pho-brand",
66
66
  children: "*"
67
67
  })]
68
- }), m]
68
+ }), f]
69
69
  }),
70
- /* @__PURE__ */ l("div", {
71
- "data-invalid": a || void 0,
72
- className: r("bg-pho-primary ring-pho-primary relative flex w-full items-center p-0.5 ring-1 transition-shadow duration-100 ease-linear ring-inset", F[t], P[t], "has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2", "data-[invalid]:ring-pho-error-subtle data-[invalid]:has-[input:focus-visible]:ring-pho-error", "group-data-[disabled]/field:cursor-not-allowed group-data-[disabled]/field:opacity-50", v),
70
+ /* @__PURE__ */ s("div", {
71
+ "data-invalid": t || void 0,
72
+ className: r("bg-pho-primary ring-pho-primary relative flex w-full items-center p-0.5 ring-1 transition-shadow duration-100 ease-linear ring-inset", F[a], P[a], "has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2", "data-[invalid]:ring-pho-error-subtle data-[invalid]:has-[input:focus-visible]:ring-pho-error", "group-data-[disabled]/field:cursor-not-allowed group-data-[disabled]/field:opacity-50", h),
73
73
  children: [
74
- i && /* @__PURE__ */ e(i, { className: r("text-fg-pho-quaternary pointer-events-none absolute", z[t]) }),
75
- /* @__PURE__ */ e(s.Control, {
76
- ref: x,
77
- id: b,
74
+ i && /* @__PURE__ */ e(i, { className: r("text-pho-secondary pointer-events-none absolute", z[a]) }),
75
+ /* @__PURE__ */ e(l.Control, {
76
+ ref: g,
77
+ id: x,
78
78
  type: I,
79
- required: c,
79
+ required: p,
80
80
  ...y,
81
- className: r("text-pho-primary placeholder:text-pho-placeholder m-0 w-full bg-transparent outline-none disabled:cursor-not-allowed", M[t], T[t], _ && O[t], E && "pr-8.5", g)
81
+ className: r("text-pho-primary placeholder:text-pho-placeholder m-0 w-full bg-transparent outline-none disabled:cursor-not-allowed", M[a], T[a], _ && O[a], E && "pr-8.5", v)
82
82
  }),
83
- a && !o && /* @__PURE__ */ e(L, { className: "text-fg-pho-error pointer-events-none absolute right-3 size-4" }),
83
+ t && !o && /* @__PURE__ */ e(L, { className: "text-pho-error pointer-events-none absolute right-3 size-4" }),
84
84
  o && /* @__PURE__ */ e("button", {
85
85
  type: "button",
86
86
  tabIndex: -1,
87
87
  "aria-label": "Toggle password visibility",
88
88
  onClick: () => N((w) => !w),
89
- className: "text-fg-pho-quaternary hover:text-fg-pho-quaternary-hover absolute right-3 flex cursor-pointer items-center transition duration-100 ease-linear focus:outline-none",
90
- children: f ? /* @__PURE__ */ e(k, { className: "size-4" }) : /* @__PURE__ */ e(D, { className: "size-4" })
89
+ className: "text-pho-secondary hover:text-pho-secondary-hover absolute right-3 flex cursor-pointer items-center transition duration-100 ease-linear focus:outline-none",
90
+ children: m ? /* @__PURE__ */ e(k, { className: "size-4" }) : /* @__PURE__ */ e(D, { className: "size-4" })
91
91
  })
92
92
  ]
93
93
  }),
94
- p && /* @__PURE__ */ e(s.Description, {
95
- className: r("text-pho-tertiary text-sm", a && "text-pho-error"),
96
- children: p
94
+ c && /* @__PURE__ */ e(l.Description, {
95
+ className: r("text-pho-description text-base", t && "text-pho-error"),
96
+ children: c
97
97
  })
98
98
  ]
99
99
  });
@@ -103,4 +103,4 @@ export {
103
103
  Z as t
104
104
  };
105
105
 
106
- //# sourceMappingURL=input-DbJpdu6v.js.map
106
+ //# sourceMappingURL=input-BSJGBUbf.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"input-BSJGBUbf.js","names":["__iconNode","__iconNode"],"sources":["../../../../node_modules/.pnpm/@tabler+icons-react@3.44.0_react@19.2.7/node_modules/@tabler/icons-react/dist/esm/icons/IconEyeOff.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.44.0_react@19.2.7/node_modules/@tabler/icons-react/dist/esm/icons/IconEye.mjs","../../../../node_modules/.pnpm/@tabler+icons-react@3.44.0_react@19.2.7/node_modules/@tabler/icons-react/dist/esm/icons/IconAlertCircleFilled.mjs","../../src/components/input/input.tsx"],"sourcesContent":["/**\n * @license @tabler/icons-react v3.44.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M10.585 10.587a2 2 0 0 0 2.829 2.828\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M16.681 16.673a8.717 8.717 0 0 1 -4.681 1.327c-3.6 0 -6.6 -2 -9 -6c1.272 -2.12 2.712 -3.678 4.32 -4.674m2.86 -1.146a9.055 9.055 0 0 1 1.82 -.18c3.6 0 6.6 2 9 6c-.666 1.11 -1.379 2.067 -2.138 2.87\", \"key\": \"svg-1\" }], [\"path\", { \"d\": \"M3 3l18 18\", \"key\": \"svg-2\" }]];\nconst IconEyeOff = createReactComponent(\"outline\", \"eye-off\", \"EyeOff\", __iconNode);\n\nexport { __iconNode, IconEyeOff as default };\n//# sourceMappingURL=IconEyeOff.mjs.map\n","/**\n * @license @tabler/icons-react v3.44.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M10 12a2 2 0 1 0 4 0a2 2 0 0 0 -4 0\", \"key\": \"svg-0\" }], [\"path\", { \"d\": \"M21 12c-2.4 4 -5.4 6 -9 6c-3.6 0 -6.6 -2 -9 -6c2.4 -4 5.4 -6 9 -6c3.6 0 6.6 2 9 6\", \"key\": \"svg-1\" }]];\nconst IconEye = createReactComponent(\"outline\", \"eye\", \"Eye\", __iconNode);\n\nexport { __iconNode, IconEye as default };\n//# sourceMappingURL=IconEye.mjs.map\n","/**\n * @license @tabler/icons-react v3.44.0 - MIT\n *\n * This source code is licensed under the MIT license.\n * See the LICENSE file in the root directory of this source tree.\n */\n\nimport createReactComponent from '../createReactComponent.mjs';\n\nconst __iconNode = [[\"path\", { \"d\": \"M12 2c5.523 0 10 4.477 10 10a10 10 0 0 1 -19.995 .324l-.005 -.324l.004 -.28c.148 -5.393 4.566 -9.72 9.996 -9.72zm.01 13l-.127 .007a1 1 0 0 0 0 1.986l.117 .007l.127 -.007a1 1 0 0 0 0 -1.986l-.117 -.007zm-.01 -8a1 1 0 0 0 -.993 .883l-.007 .117v4l.007 .117a1 1 0 0 0 1.986 0l.007 -.117v-4l-.007 -.117a1 1 0 0 0 -.993 -.883z\", \"key\": \"svg-0\" }]];\nconst IconAlertCircleFilled = createReactComponent(\"filled\", \"alert-circle-filled\", \"AlertCircleFilled\", __iconNode);\n\nexport { __iconNode, IconAlertCircleFilled as default };\n//# sourceMappingURL=IconAlertCircleFilled.mjs.map\n","import {\n useState,\n type ComponentType,\n type InputHTMLAttributes,\n type ReactNode,\n type Ref,\n} from \"react\";\nimport {\n IconAlertCircleFilled,\n IconEye,\n IconEyeOff,\n} from \"@tabler/icons-react\";\nimport { Field } from \"@base-ui/react/field\";\nimport { cn } from \"../../utils/cn\";\n\nexport type InputSize = \"sm\" | \"md\" | \"lg\";\n\n// Control padding per size. The wrapper carries a 2px inset (`p-0.5`) so the\n// control's border box — and the browser's autofill fill it paints — sits\n// inside the ring instead of over it; these paddings are the documented\n// effective padding (sm/md 12/8px, lg 14/10px) minus that 2px inset, so the\n// text position and total field height are unchanged.\nconst SIZE_PAD: Record<InputSize, string> = {\n // 16px on small viewports — iOS zooms into any focused field under 16px.\n sm: \"px-2.5 py-1.5 text-md md:text-base\",\n md: \"px-2.5 py-1.5 text-md\",\n lg: \"px-3 py-2 text-md\",\n};\n// Effective icon clearance minus the wrapper's 2px inset.\nconst LEADING_PAD: Record<InputSize, string> = {\n sm: \"pl-8.5\",\n md: \"pl-9.5\",\n lg: \"pl-10\",\n};\n// Icons are absolutely positioned, so they're placed from the wrapper's\n// padding edge — which, with no border, is the visible field edge; the\n// wrapper's `p-0.5` does not offset them.\nconst LEADING_ICON_POS: Record<InputSize, string> = {\n sm: \"left-3 size-4\",\n md: \"left-3 size-5\",\n lg: \"left-3.5 size-5\",\n};\n// Wrapper corner radius — `rounded-base` (12px) at every size; `lg` also gets\n// `squircle` superellipse smoothing (the ring is a box-shadow on this wrapper,\n// so it follows the border-radius automatically).\nconst SIZE_RADIUS: Record<InputSize, string> = {\n sm: \"rounded-base\",\n md: \"rounded-base\",\n lg: \"squircle rounded-base\",\n};\n// Concentric inner-curve cover, `lg` only. Nested corner radii must follow\n// innerRadius = outerRadius − inset, so the hairline's inner edge at a 12px\n// outer radius is 11px at rest (ring-1) and 10px when focused (ring-2).\n// Browsers derive that automatically for plain round corners, but with\n// `corner-shape: superellipse(...)` shipping engines still scale (rather than\n// offset) the inner shadow curve, which renders the ring visibly thicker at\n// the four corners (see w3c/csswg-drafts#12961). This ::before repaints the\n// field surface over everything inside the correct concentric curve — a round\n// radius is the right parallel-offset approximation of the mild superellipse —\n// so the ring reads as a uniform hairline in every engine. `isolate` +\n// `-z-10` slot the cover above the wrapper's background/ring but below the\n// control's text, icons, and autofill fill. `sm`/`md` have no corner-shape,\n// so the native (already concentric) rendering is kept there.\n// The ::before is absolutely positioned, so its inset is measured from the\n// wrapper's border box (border 0): 1px in at rest, 2px in when focused.\nconst SIZE_RING_COVER: Record<InputSize, string> = {\n sm: \"\",\n md: \"\",\n lg: cn(\n \"isolate before:pointer-events-none before:absolute before:-z-10 before:content-['']\",\n \"before:bg-pho-primary before:inset-px before:rounded-[calc(var(--radius-base)-1px)]\",\n \"has-[input:focus-visible]:before:inset-0.5 has-[input:focus-visible]:before:rounded-[calc(var(--radius-base)-2px)]\",\n \"before:transition-[inset,border-radius] before:duration-100 before:ease-linear\",\n ),\n};\n// The control's border box sits 2px inside the wrapper (its `p-0.5` inset),\n// clear of both ring widths, so the browser's autofill fill paints inside the\n// hairline instead of over it. Rounding follows inner = outer − gap, derived\n// from the token with calc. Round (not squircle) — the parallel offset of\n// the wrapper's mild superellipse is effectively circular.\nconst SIZE_AUTOFILL_RADIUS: Record<InputSize, string> = {\n sm: \"autofill:rounded-[calc(var(--radius-base)-2px)]\",\n md: \"autofill:rounded-[calc(var(--radius-base)-2px)]\",\n lg: \"autofill:rounded-[calc(var(--radius-base)-2px)]\",\n};\n\nexport interface InputProps extends Omit<\n InputHTMLAttributes<HTMLInputElement>,\n \"size\"\n> {\n /** Field label (associated for accessibility). */\n label?: ReactNode;\n /** Helper text below the field; rendered in the error color when `invalid`. */\n hint?: ReactNode;\n /** Size variant. @default \"md\" */\n size?: InputSize;\n /** Render the invalid state (ring + icon + error-colored hint). */\n invalid?: boolean;\n /** Leading icon component (e.g. a Tabler icon). */\n icon?: ComponentType<{ className?: string }>;\n /** Node rendered at the right edge of the label row (e.g. \"Forgot?\"). */\n labelTrailing?: ReactNode;\n /** Class applied to the input wrapper. */\n wrapperClassName?: string;\n ref?: Ref<HTMLInputElement>;\n}\n\n/**\n * Text input built on Base UI `Field` (label/description a11y wiring) with\n * Pho's bordered surface, leading icon, invalid state, and a built-in password\n * reveal toggle.\n */\nexport function Input({\n label,\n hint,\n size = \"md\",\n invalid,\n icon: Icon,\n labelTrailing,\n disabled,\n required,\n type = \"text\",\n className,\n wrapperClassName,\n id,\n ref,\n ...props\n}: InputProps) {\n const [reveal, setReveal] = useState(false);\n const isPassword = type === \"password\";\n const resolvedType = isPassword && reveal ? \"text\" : type;\n const hasLeadingIcon = Boolean(Icon);\n const hasTrailingIcon = isPassword || invalid;\n\n return (\n <Field.Root\n disabled={disabled}\n className=\"group/field flex w-full flex-col gap-1.5\"\n >\n {label && (\n <div className=\"flex items-center justify-between gap-2\">\n <Field.Label className=\"text-pho-secondary flex cursor-default items-center gap-0.5 text-base font-medium\">\n {label}\n {required && <span className=\"text-pho-brand\">*</span>}\n </Field.Label>\n {labelTrailing}\n </div>\n )}\n\n <div\n data-invalid={invalid || undefined}\n className={cn(\n // Flat field surface — hairline ring only; elevation shadows are\n // reserved for floating layers (menus/popovers/dialogs). `p-0.5`\n // insets the control 2px (the focused ring width) so its background\n // and the browser's autofill fill nest inside the ring; the size\n // maps compensate so effective padding/height are unchanged.\n \"bg-pho-primary ring-pho-primary relative flex w-full items-center p-0.5 ring-1 transition-shadow duration-100 ease-linear ring-inset\",\n SIZE_RADIUS[size],\n SIZE_RING_COVER[size],\n \"has-[input:focus-visible]:ring-pho-brand has-[input:focus-visible]:ring-2\",\n \"data-[invalid]:ring-pho-error-subtle data-[invalid]:has-[input:focus-visible]:ring-pho-error\",\n \"group-data-[disabled]/field:cursor-not-allowed group-data-[disabled]/field:opacity-50\",\n wrapperClassName,\n )}\n >\n {Icon && (\n <Icon\n className={cn(\n \"text-pho-secondary pointer-events-none absolute\",\n LEADING_ICON_POS[size],\n )}\n />\n )}\n\n <Field.Control\n ref={ref}\n id={id}\n type={resolvedType}\n required={required}\n {...props}\n className={cn(\n \"text-pho-primary placeholder:text-pho-placeholder m-0 w-full bg-transparent outline-none disabled:cursor-not-allowed\",\n SIZE_PAD[size],\n SIZE_AUTOFILL_RADIUS[size],\n hasLeadingIcon && LEADING_PAD[size],\n // 34px + the wrapper's 2px inset = the previous 36px clearance.\n hasTrailingIcon && \"pr-8.5\",\n className,\n )}\n />\n\n {invalid && !isPassword && (\n <IconAlertCircleFilled className=\"text-pho-error pointer-events-none absolute right-3 size-4\" />\n )}\n\n {isPassword && (\n <button\n type=\"button\"\n // Reachable by click but skipped in tab order so Tab moves field→field.\n tabIndex={-1}\n aria-label=\"Toggle password visibility\"\n onClick={() => setReveal((v) => !v)}\n className=\"text-pho-secondary hover:text-pho-secondary-hover absolute right-3 flex cursor-pointer items-center transition duration-100 ease-linear focus:outline-none\"\n >\n {reveal ? (\n <IconEyeOff className=\"size-4\" />\n ) : (\n <IconEye className=\"size-4\" />\n )}\n </button>\n )}\n </div>\n\n {hint && (\n <Field.Description\n className={cn(\n \"text-pho-description text-base\",\n invalid && \"text-pho-error\",\n )}\n >\n {hint}\n </Field.Description>\n )}\n </Field.Root>\n );\n}\n\nInput.displayName = \"Input\";\n"],"x_google_ignoreList":[0,1,2],"mappings":";;;;;;AASA,IAAMA,IAAa;AAAA,EAAC,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAwC,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAuM,KAAO;AAAA,EAAQ,CAAC;AAAA,EAAG,CAAC,QAAQ;AAAA,IAAE,GAAK;AAAA,IAAc,KAAO;AAAA,EAAQ,CAAC;AAAC,GAClX,IAAa,EAAqB,WAAW,WAAW,UAAUA,CAAU,GCD5EC,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAuC,KAAO;AAAQ,CAAC,GAAG,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAqF,KAAO;AAAQ,CAAC,CAAC,GAC9M,IAAU,EAAqB,WAAW,OAAO,OAAOA,CAAU,GCDlE,IAAa,CAAC,CAAC,QAAQ;AAAA,EAAE,GAAK;AAAA,EAAoU,KAAO;AAAQ,CAAC,CAAC,GACnX,IAAwB,EAAqB,UAAU,uBAAuB,qBAAqB,CAAU,GCY7G,IAAsC;AAAA,EAE1C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAEM,IAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAIM,IAA8C;AAAA,EAClD,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AACN,GAIM,IAAyC;AAAA,EAC7C,IAAI;AAAA,EACJ,IAAI;AA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J,WAAW,EACT,wHACA,EAAS,CAAA,GACT,EAAqB,CAAA,GACrB,KAAkB,EAAY,CAAA,GAE9B,KAAmB,UACnB,CACF;AAAA,UACD,CAAA;AAAA,UAEA,KAAW,CAAC,KACX,gBAAA,EAAC,GAAD,EAAuB,WAAU,6DAA8D,CAAA;AAAA,UAGhG,KACC,gBAAA,EAAC,UAAD;AAAA,YACE,MAAK;AAAA,YAEL,UAAU;AAAA,YACV,cAAW;AAAA,YACX,SAAA,MAAe,EAAA,CAAW,MAAM,CAAC,CAAC;AAAA,YAClC,WAAU;AAAA,sBAET,IACC,gBAAA,EAAC,GAAD,EAAY,WAAU,SAAU,CAAA,IAEhC,gBAAA,EAAC,GAAD,EAAS,WAAU,SAAU,CAAA;AAAA,UAEzB,CAAA;AAAA,QAEP;AAAA;MAEJ,KACC,gBAAA,EAAC,EAAM,aAAP;AAAA,QACE,WAAW,EACT,kCACA,KAAW,gBACb;AAAA,kBAEC;AAAA,MACgB,CAAA;AAAA,IAEX;AAAA;AAEhB;AAEA,EAAM,cAAc"}
@@ -0,0 +1,205 @@
1
+ "use client";
2
+ import { t as a } from "./cn-DTiB6ek_.js";
3
+ import { t as v } from "./resolve-variant-CcD8iG5l.js";
4
+ import { n as k } from "./spinner-Cy8bkyJf.js";
5
+ import { createContext as S, useCallback as E, useContext as I, useEffect as P, useMemo as T, useRef as b, useState as C } from "react";
6
+ import { jsx as r, jsxs as G } from "react/jsx-runtime";
7
+ import { Menu as t } from "@base-ui/react/menu";
8
+ import { Separator as U } from "@base-ui/react/separator";
9
+ var y = S(null);
10
+ function ue() {
11
+ return I(y)?.pending ?? !1;
12
+ }
13
+ function _(e) {
14
+ return e != null && typeof e.then == "function";
15
+ }
16
+ function L(e) {
17
+ function n({ onOpenChange: i, actionsRef: s, ...u }) {
18
+ const [d, l] = C(!1), c = b(!1), o = b(null);
19
+ P(() => {
20
+ if (s)
21
+ return s.current = {
22
+ unmount: () => o.current?.unmount(),
23
+ close: () => o.current?.close()
24
+ }, () => {
25
+ s.current = null;
26
+ };
27
+ }, [s]);
28
+ const p = E((h, m) => {
29
+ if (!h && c.current) {
30
+ m.cancel();
31
+ return;
32
+ }
33
+ i?.(h, m);
34
+ }, [i]), f = T(() => ({
35
+ pending: d,
36
+ beginPending: () => {
37
+ c.current = !0, l(!0);
38
+ },
39
+ endPending: () => {
40
+ c.current = !1, l(!1);
41
+ },
42
+ close: () => o.current?.close()
43
+ }), [d]);
44
+ return /* @__PURE__ */ r(y.Provider, {
45
+ value: f,
46
+ children: /* @__PURE__ */ r(e, {
47
+ ...u,
48
+ actionsRef: o,
49
+ onOpenChange: p
50
+ })
51
+ });
52
+ }
53
+ return n;
54
+ }
55
+ function O({ onClick: e, closeOnClick: n = !0, loading: i = !1, disabled: s = !1 }) {
56
+ const u = I(y), d = u?.pending ?? !1, [l, c] = C(!1), o = b(!0);
57
+ P(() => (o.current = !0, () => {
58
+ o.current = !1;
59
+ }), []);
60
+ const p = l || i, f = s || p || d;
61
+ function h(m) {
62
+ if (p || d && !l) {
63
+ m.preventBaseUIHandler?.();
64
+ return;
65
+ }
66
+ const x = e?.(m);
67
+ _(x) && (m.preventBaseUIHandler?.(), c(!0), u?.beginPending(), x.then(() => {
68
+ u?.endPending(), o.current && c(!1), n && u?.close();
69
+ }, (M) => {
70
+ u?.endPending(), o.current && c(!1), typeof process < "u" && process.env.NODE_ENV !== "production" && console.error("Menu.Item: async onClick rejected —", M);
71
+ }));
72
+ }
73
+ return {
74
+ inert: p,
75
+ blocked: f,
76
+ handleClick: h
77
+ };
78
+ }
79
+ function w() {
80
+ return /* @__PURE__ */ r(k, {
81
+ "data-menu-spinner": "",
82
+ size: "md"
83
+ });
84
+ }
85
+ var z = "bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary origin-[var(--transform-origin)] min-w-44 rounded-base p-1 ring-1 ring-inset outline-none transition-[transform,opacity] duration-150 ease-out data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0", g = "relative flex cursor-pointer items-center gap-2 rounded-base py-1.5 pr-2.5 pl-2.5 text-base text-pho-secondary outline-none select-none data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-loading:data-[disabled]:opacity-100 data-loading:[&>svg:not([data-menu-spinner])]:hidden [&>svg]:size-4 [&>svg]:text-current", N = {
86
+ default: {
87
+ classes: "",
88
+ description: "Secondary → primary on highlight"
89
+ },
90
+ destructive: {
91
+ classes: "text-pho-error data-[highlighted]:bg-pho-error-primary data-[highlighted]:text-pho-error",
92
+ description: "Error ink + error wash on highlight"
93
+ }
94
+ }, j = L(t.Root), A = t.Trigger, B = t.Portal, H = t.Group, V = t.RadioGroup, $ = t.SubmenuRoot;
95
+ function D({ className: e, sideOffset: n = 6, ...i }) {
96
+ return /* @__PURE__ */ r(t.Positioner, {
97
+ sideOffset: n,
98
+ className: a("z-50", e),
99
+ ...i
100
+ });
101
+ }
102
+ function K({ className: e, ...n }) {
103
+ return /* @__PURE__ */ r(t.Popup, {
104
+ className: a(z, e),
105
+ ...n
106
+ });
107
+ }
108
+ function q({ className: e, color: n = "default", onClick: i, closeOnClick: s = !0, loading: u = !1, disabled: d = !1, children: l, ...c }) {
109
+ const { inert: o, blocked: p, handleClick: f } = O({
110
+ onClick: i,
111
+ closeOnClick: s,
112
+ loading: u,
113
+ disabled: d
114
+ });
115
+ return /* @__PURE__ */ G(t.Item, {
116
+ className: a(g, v(N, n), e),
117
+ closeOnClick: s,
118
+ disabled: p,
119
+ "data-loading": o || void 0,
120
+ "aria-busy": o || void 0,
121
+ onClick: f,
122
+ ...c,
123
+ children: [o ? /* @__PURE__ */ r(w, {}) : null, l]
124
+ });
125
+ }
126
+ function F({ className: e, color: n = "default", ...i }) {
127
+ return /* @__PURE__ */ r(t.LinkItem, {
128
+ className: a(g, v(N, n), e),
129
+ ...i
130
+ });
131
+ }
132
+ function J({ className: e, ...n }) {
133
+ return /* @__PURE__ */ r(t.GroupLabel, {
134
+ className: a("text-pho-secondary px-2.5 py-1.5 text-xs font-medium", e),
135
+ ...n
136
+ });
137
+ }
138
+ function Q({ className: e, ...n }) {
139
+ return /* @__PURE__ */ r(U, {
140
+ className: a("-mx-1 my-1 h-px bg-[var(--border-color-pho-secondary)]", e),
141
+ ...n
142
+ });
143
+ }
144
+ function W({ className: e, ...n }) {
145
+ return /* @__PURE__ */ r(t.SubmenuTrigger, {
146
+ className: a(g, "data-[popup-open]:bg-pho-ghost-hover", e),
147
+ ...n
148
+ });
149
+ }
150
+ function X({ className: e, ...n }) {
151
+ return /* @__PURE__ */ r(t.CheckboxItem, {
152
+ className: a(g, "pl-8", e),
153
+ ...n
154
+ });
155
+ }
156
+ function Y({ className: e, ...n }) {
157
+ return /* @__PURE__ */ r(t.RadioItem, {
158
+ className: a(g, "pl-8", e),
159
+ ...n
160
+ });
161
+ }
162
+ var R = "text-pho-brand absolute left-2.5 flex items-center [&>svg]:size-4";
163
+ function Z({ className: e, ...n }) {
164
+ return /* @__PURE__ */ r(t.CheckboxItemIndicator, {
165
+ className: a(R, e),
166
+ ...n
167
+ });
168
+ }
169
+ function ee({ className: e, ...n }) {
170
+ return /* @__PURE__ */ r(t.RadioItemIndicator, {
171
+ className: a(R, e),
172
+ ...n
173
+ });
174
+ }
175
+ var ce = {
176
+ Root: j,
177
+ Trigger: A,
178
+ Portal: B,
179
+ Positioner: D,
180
+ Popup: K,
181
+ Item: q,
182
+ LinkItem: F,
183
+ Group: H,
184
+ GroupLabel: J,
185
+ Separator: Q,
186
+ SubmenuRoot: $,
187
+ SubmenuTrigger: W,
188
+ CheckboxItem: X,
189
+ CheckboxItemIndicator: Z,
190
+ RadioGroup: V,
191
+ RadioItem: Y,
192
+ RadioItemIndicator: ee
193
+ };
194
+ export {
195
+ w as a,
196
+ L as c,
197
+ ce as i,
198
+ N as n,
199
+ O as o,
200
+ z as r,
201
+ ue as s,
202
+ g as t
203
+ };
204
+
205
+ //# sourceMappingURL=menu-COLB_liS.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"menu-COLB_liS.js","names":[],"sources":["../../src/components/menu/menu-pending.tsx","../../src/components/menu/menu.tsx"],"sourcesContent":["import {\n createContext,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ComponentType,\n type MouseEvent as ReactMouseEvent,\n type ReactNode,\n type RefObject,\n} from \"react\";\nimport { Spinner } from \"../spinner/spinner\";\n\n/** Imperative actions exposed by Base UI menu `actionsRef`. */\ninterface RootActions {\n unmount: () => void;\n close: () => void;\n}\n\ninterface MenuPendingContextValue {\n /** True while a menu item promise is in flight. */\n pending: boolean;\n beginPending: () => void;\n endPending: () => void;\n /** Close the menu imperatively (used by async items on resolve). */\n close: () => void;\n}\n\nconst MenuPendingContext = createContext<MenuPendingContextValue | null>(null);\n\n/**\n * Whether the surrounding menu has an async item promise in flight —\n * use it to disable sibling items while work is pending.\n * Returns `false` outside a `Menu.Root` / `ContextMenu.Root`.\n */\nexport function useMenuPending(): boolean {\n return useContext(MenuPendingContext)?.pending ?? false;\n}\n\nexport function isThenable(value: unknown): value is Promise<unknown> {\n return (\n value != null && typeof (value as { then?: unknown }).then === \"function\"\n );\n}\n\ntype PreventableMouseEvent = ReactMouseEvent<HTMLElement> & {\n preventBaseUIHandler?: () => void;\n};\n\ntype RootWithPendingProps = {\n onOpenChange?: (open: boolean, eventDetails: { cancel: () => void }) => void;\n actionsRef?: RefObject<RootActions | null>;\n children?: ReactNode;\n};\n\n/**\n * Wraps a Base UI menu root so async `Menu.Item` clicks can lock dismissal\n * (outside press, Escape) until the promise settles.\n */\nexport function withMenuPendingRoot<P extends RootWithPendingProps>(\n BaseRoot: ComponentType<P>,\n): ComponentType<P> {\n function PendingRoot({ onOpenChange, actionsRef, ...props }: P) {\n const [pending, setPending] = useState(false);\n // Guard reads a ref so a resolve → close() in the same tick isn't blocked\n // by a not-yet-flushed state update.\n const pendingRef = useRef(false);\n const internalActionsRef = useRef<RootActions | null>(null);\n\n useEffect(() => {\n if (!actionsRef) return;\n // Proxy so callers always hit the live Base UI actions, even if the\n // popup remounts after this effect runs.\n actionsRef.current = {\n unmount: () => internalActionsRef.current?.unmount(),\n close: () => internalActionsRef.current?.close(),\n };\n return () => {\n actionsRef.current = null;\n };\n }, [actionsRef]);\n\n const handleOpenChange = useCallback(\n (open: boolean, eventDetails: { cancel: () => void }) => {\n if (!open && pendingRef.current) {\n eventDetails.cancel();\n return;\n }\n onOpenChange?.(open, eventDetails);\n },\n [onOpenChange],\n );\n\n const contextValue = useMemo<MenuPendingContextValue>(\n () => ({\n pending,\n beginPending: () => {\n pendingRef.current = true;\n setPending(true);\n },\n endPending: () => {\n pendingRef.current = false;\n setPending(false);\n },\n close: () => internalActionsRef.current?.close(),\n }),\n [pending],\n );\n\n return (\n <MenuPendingContext.Provider value={contextValue}>\n <BaseRoot\n {...(props as P)}\n actionsRef={internalActionsRef}\n onOpenChange={handleOpenChange}\n />\n </MenuPendingContext.Provider>\n );\n }\n\n return PendingRoot as ComponentType<P>;\n}\n\nexport type AsyncMenuItemClick = (\n event: ReactMouseEvent<HTMLElement>,\n) => void | Promise<unknown>;\n\n/**\n * Shared click handler for `Menu.Item` / `ContextMenu.Item` promise support.\n * Returns whether the item should show its loading state.\n */\nexport function useAsyncMenuItem({\n onClick,\n closeOnClick = true,\n loading = false,\n disabled = false,\n}: {\n onClick?: AsyncMenuItemClick;\n closeOnClick?: boolean;\n loading?: boolean;\n disabled?: boolean;\n}) {\n const pendingContext = useContext(MenuPendingContext);\n const menuPending = pendingContext?.pending ?? false;\n const [busy, setBusy] = useState(false);\n const mountedRef = useRef(true);\n\n useEffect(() => {\n mountedRef.current = true;\n return () => {\n mountedRef.current = false;\n };\n }, []);\n\n const inert = busy || loading;\n // Disable siblings while any item promise is in flight.\n const blocked = disabled || inert || menuPending;\n\n function handleClick(event: ReactMouseEvent<HTMLElement>) {\n if (inert || (menuPending && !busy)) {\n (event as PreventableMouseEvent).preventBaseUIHandler?.();\n return;\n }\n const result = onClick?.(event);\n if (!isThenable(result)) {\n return;\n }\n // Stop Base UI's closeOnClick for this press; close on resolve instead.\n (event as PreventableMouseEvent).preventBaseUIHandler?.();\n setBusy(true);\n pendingContext?.beginPending();\n result.then(\n () => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (closeOnClick) pendingContext?.close();\n },\n (error: unknown) => {\n pendingContext?.endPending();\n if (mountedRef.current) setBusy(false);\n if (\n typeof process !== \"undefined\" &&\n process.env?.NODE_ENV !== \"production\"\n ) {\n console.error(\"Menu.Item: async onClick rejected —\", error);\n }\n },\n );\n }\n\n return { inert, blocked, handleClick };\n}\n\n/** Menu-row spinner — keeps `data-menu-spinner` for the hide-siblings CSS. */\nexport function MenuItemSpinner() {\n return <Spinner data-menu-spinner=\"\" size=\"md\" />;\n}\n","import {\n type ComponentProps,\n type ElementType,\n type MouseEvent as ReactMouseEvent,\n} from \"react\";\nimport { Menu as BaseMenu } from \"@base-ui/react/menu\";\nimport { Separator as BaseSeparator } from \"@base-ui/react/separator\";\nimport { cn } from \"../../utils/cn\";\nimport { resolveVariant, type VariantMap } from \"../../utils/resolve-variant\";\nimport {\n MenuItemSpinner,\n useAsyncMenuItem,\n useMenuPending,\n withMenuPendingRoot,\n type AsyncMenuItemClick,\n} from \"./menu-pending\";\n\nexport { useMenuPending };\n\n/** Override Base UI's `string | (state) => string` className with plain string. */\ntype StyledProps<T extends ElementType> = Omit<\n ComponentProps<T>,\n \"className\" | \"color\"\n> & {\n className?: string;\n};\n\n/** Shared popup + item styles, reused by `ContextMenu` and `Menubar` menus. */\n// Floating layer: keeps its elevation shadow, sits on the primary surface\n// with the site's hairline (ring-pho-secondary, #eee/#202020) as its edge.\nexport const MENU_POPUP =\n \"bg-pho-primary text-pho-primary shadow-pho-lg ring-pho-secondary origin-[var(--transform-origin)] min-w-44 rounded-base p-1 ring-1 ring-inset outline-none transition-[transform,opacity] duration-150 ease-out data-[starting-style]:scale-95 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[ending-style]:opacity-0\";\n// Rest at secondary; highlighted lifts to primary with the quiet ghost wash.\n// Icons use `text-current` so they follow the row ink (including destructive).\n// While loading, the spinner is first; hide the rest of the leading icons.\nexport const MENU_ITEM =\n \"relative flex cursor-pointer items-center gap-2 rounded-base py-1.5 pr-2.5 pl-2.5 text-base text-pho-secondary outline-none select-none data-[highlighted]:bg-pho-ghost-hover data-[highlighted]:text-pho-primary data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-loading:data-[disabled]:opacity-100 data-loading:[&>svg:not([data-menu-spinner])]:hidden [&>svg]:size-4 [&>svg]:text-current\";\n\n/** Semantic ink for `Menu.Item` / `LinkItem` / `ContextMenu.Item`. */\nexport const MENU_ITEM_COLORS = {\n default: { classes: \"\", description: \"Secondary → primary on highlight\" },\n destructive: {\n classes:\n \"text-pho-error data-[highlighted]:bg-pho-error-primary data-[highlighted]:text-pho-error\",\n description: \"Error ink + error wash on highlight\",\n },\n} satisfies VariantMap;\n\nexport type MenuItemColor = keyof typeof MENU_ITEM_COLORS;\n\ntype ItemColorProps = {\n /** Semantic ink. @default \"default\" */\n color?: MenuItemColor;\n};\n\nexport type MenuItemProps = Omit<StyledProps<typeof BaseMenu.Item>, \"onClick\"> &\n ItemColorProps & {\n /**\n * Action handler. Return a promise to keep the menu open while it runs:\n * the item shows a spinner, dismissal is locked, and the menu closes when\n * the promise resolves (if `closeOnClick`). On rejection the menu stays\n * open — surface errors inside the handler.\n */\n onClick?: AsyncMenuItemClick;\n /**\n * Declarative loading state (same visual as an in-flight promise).\n * @default false\n */\n loading?: boolean;\n };\n\nconst Root = withMenuPendingRoot(BaseMenu.Root);\nconst Trigger = BaseMenu.Trigger;\nconst Portal = BaseMenu.Portal;\nconst Group = BaseMenu.Group;\nconst RadioGroup = BaseMenu.RadioGroup;\n// Don't wrap SubmenuRoot — nested pending context would shadow the parent\n// Root and fail to lock dismissal for async items inside a submenu.\nconst SubmenuRoot = BaseMenu.SubmenuRoot;\n\nfunction Positioner({\n className,\n sideOffset = 6,\n ...props\n}: StyledProps<typeof BaseMenu.Positioner>) {\n return (\n <BaseMenu.Positioner\n sideOffset={sideOffset}\n className={cn(\"z-50\", className)}\n {...props}\n />\n );\n}\n\nfunction Popup({ className, ...props }: StyledProps<typeof BaseMenu.Popup>) {\n return <BaseMenu.Popup className={cn(MENU_POPUP, className)} {...props} />;\n}\n\nfunction Item({\n className,\n color = \"default\",\n onClick,\n closeOnClick = true,\n loading = false,\n disabled = false,\n children,\n ...props\n}: MenuItemProps) {\n const { inert, blocked, handleClick } = useAsyncMenuItem({\n onClick,\n closeOnClick,\n loading,\n disabled,\n });\n\n return (\n <BaseMenu.Item\n className={cn(\n MENU_ITEM,\n resolveVariant(MENU_ITEM_COLORS, color),\n className,\n )}\n closeOnClick={closeOnClick}\n disabled={blocked}\n data-loading={inert || undefined}\n aria-busy={inert || undefined}\n onClick={handleClick as (event: ReactMouseEvent<HTMLElement>) => void}\n {...props}\n >\n {inert ? <MenuItemSpinner /> : null}\n {children}\n </BaseMenu.Item>\n );\n}\n\nfunction LinkItem({\n className,\n color = \"default\",\n ...props\n}: StyledProps<typeof BaseMenu.LinkItem> & ItemColorProps) {\n return (\n <BaseMenu.LinkItem\n className={cn(\n MENU_ITEM,\n resolveVariant(MENU_ITEM_COLORS, color),\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction GroupLabel({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.GroupLabel>) {\n return (\n <BaseMenu.GroupLabel\n className={cn(\n \"text-pho-secondary px-2.5 py-1.5 text-xs font-medium\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction Separator({ className, ...props }: StyledProps<typeof BaseSeparator>) {\n return (\n <BaseSeparator\n className={cn(\n \"-mx-1 my-1 h-px bg-[var(--border-color-pho-secondary)]\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction SubmenuTrigger({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.SubmenuTrigger>) {\n return (\n <BaseMenu.SubmenuTrigger\n className={cn(\n MENU_ITEM,\n \"data-[popup-open]:bg-pho-ghost-hover\",\n className,\n )}\n {...props}\n />\n );\n}\n\nfunction CheckboxItem({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.CheckboxItem>) {\n return (\n <BaseMenu.CheckboxItem\n className={cn(MENU_ITEM, \"pl-8\", className)}\n {...props}\n />\n );\n}\n\nfunction RadioItem({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.RadioItem>) {\n return (\n <BaseMenu.RadioItem\n className={cn(MENU_ITEM, \"pl-8\", className)}\n {...props}\n />\n );\n}\n\nconst CHECK_INDICATOR =\n \"text-pho-brand absolute left-2.5 flex items-center [&>svg]:size-4\";\n\nfunction CheckboxItemIndicator({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.CheckboxItemIndicator>) {\n return (\n <BaseMenu.CheckboxItemIndicator\n className={cn(CHECK_INDICATOR, className)}\n {...props}\n />\n );\n}\n\nfunction RadioItemIndicator({\n className,\n ...props\n}: StyledProps<typeof BaseMenu.RadioItemIndicator>) {\n return (\n <BaseMenu.RadioItemIndicator\n className={cn(CHECK_INDICATOR, className)}\n {...props}\n />\n );\n}\n\n/**\n * Dropdown menu built on Base UI `Menu` — a list of actions opened from a\n * trigger. Supports grouped items, separators, submenus\n * (`SubmenuRoot` + `SubmenuTrigger`), and stateful `CheckboxItem` /\n * `RadioItem`s. `Menu.Item` has native promise support (spinner + locked\n * dismissal while pending). For a right-click menu use `ContextMenu`.\n */\nexport const Menu = {\n Root,\n Trigger,\n Portal,\n Positioner,\n Popup,\n Item,\n LinkItem,\n Group,\n GroupLabel,\n Separator,\n SubmenuRoot,\n SubmenuTrigger,\n CheckboxItem,\n CheckboxItemIndicator,\n RadioGroup,\n RadioItem,\n RadioItemIndicator,\n};\n"],"mappings":";;;;;;;;AA8BA,IAAM,IAAqB,EAA8C,IAAI;AAO7E,SAAgB,KAA0B;AACxC,SAAO,E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