tfy-web-components 0.0.41 → 0.0.43

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 (83) hide show
  1. package/dist/{Button-CHzl5RaT.js → Button-CPJYHldw.js} +3 -2
  2. package/dist/{Button-CHzl5RaT.js.map → Button-CPJYHldw.js.map} +1 -1
  3. package/dist/{CompositeItem-BGwD51jI.js → CompositeItem-DJWNsIwE.js} +2 -2
  4. package/dist/{CompositeItem-BGwD51jI.js.map → CompositeItem-DJWNsIwE.js.map} +1 -1
  5. package/dist/{CompositeRoot-BxrPc7F6.js → CompositeRoot-BlljDWkR.js} +5 -5
  6. package/dist/{CompositeRoot-BxrPc7F6.js.map → CompositeRoot-BlljDWkR.js.map} +1 -1
  7. package/dist/{Input-WdhMjVoF.js → Input-Dcxu6SVO.js} +3 -3
  8. package/dist/{Input-WdhMjVoF.js.map → Input-Dcxu6SVO.js.map} +1 -1
  9. package/dist/{Modal-MUzR0rK2.js → Modal-BUWlwJcN.js} +18 -18
  10. package/dist/{Modal-MUzR0rK2.js.map → Modal-BUWlwJcN.js.map} +1 -1
  11. package/dist/{Popover-B3yBTSQa.js → Popover-BqqXJnK1.js} +10 -10
  12. package/dist/{Popover-B3yBTSQa.js.map → Popover-BqqXJnK1.js.map} +1 -1
  13. package/dist/{Tooltip-D5E-qGtP.js → Tooltip-uQIVdskf.js} +29 -132
  14. package/dist/{Tooltip-D5E-qGtP.js.map → Tooltip-uQIVdskf.js.map} +1 -1
  15. package/dist/components/atoms/Accordion.d.ts +20 -4
  16. package/dist/components/atoms/Accordion.es.js +74 -26
  17. package/dist/components/atoms/Accordion.es.js.map +1 -1
  18. package/dist/components/atoms/Button.d.ts +1 -0
  19. package/dist/components/atoms/Button.es.js +2 -2
  20. package/dist/components/atoms/ButtonGroup.d.ts +10 -5
  21. package/dist/components/atoms/ButtonGroup.es.js +95 -39
  22. package/dist/components/atoms/ButtonGroup.es.js.map +1 -1
  23. package/dist/components/atoms/IconButton.es.js +2 -2
  24. package/dist/components/atoms/Modal.es.js +6 -6
  25. package/dist/components/atoms/OverflowButton.es.js +2 -2
  26. package/dist/components/atoms/Switch.es.js +5 -5
  27. package/dist/components/atoms/Switch.es.js.map +1 -1
  28. package/dist/components/atoms/TabButton.es.js +6 -6
  29. package/dist/components/atoms/Tooltip.d.ts +3 -15
  30. package/dist/components/atoms/Tooltip.es.js +9 -10
  31. package/dist/components/molecules/Alert.es.js +3 -3
  32. package/dist/components/molecules/CopyField.es.js +2 -2
  33. package/dist/components/molecules/CustomDrawer.es.js +1 -1
  34. package/dist/components/molecules/Dialog.es.js +1 -1
  35. package/dist/components/molecules/ImagesPreview.es.js +2 -2
  36. package/dist/components/molecules/Input.es.js +2 -2
  37. package/dist/components/molecules/Markdown.es.js +2 -2
  38. package/dist/components/molecules/Markdown.es.js.map +1 -1
  39. package/dist/components/molecules/SimpleCodeEditor.es.js +2 -2
  40. package/dist/components/molecules/ToggleButton.es.js +2 -2
  41. package/dist/components/molecules/agent-chat.es.js +2 -2
  42. package/dist/{composite-DCpXNxz9.js → composite-BL4bbAWg.js} +2 -2
  43. package/dist/{composite-DCpXNxz9.js.map → composite-BL4bbAWg.js.map} +1 -1
  44. package/dist/{composite-CrCQWAKA.js → composite-C22yiNy1.js} +2 -2
  45. package/dist/{composite-CrCQWAKA.js.map → composite-C22yiNy1.js.map} +1 -1
  46. package/dist/{index-B806bfA-.js → index-C-2yrwZl.js} +3 -3
  47. package/dist/{index-B806bfA-.js.map → index-C-2yrwZl.js.map} +1 -1
  48. package/dist/index.d.ts +6 -0
  49. package/dist/index.es.js +23 -12
  50. package/dist/index.es.js.map +1 -1
  51. package/dist/new-components/atoms/Alert.d.ts +31 -0
  52. package/dist/new-components/atoms/Alert.es.js +158 -0
  53. package/dist/new-components/atoms/Alert.es.js.map +1 -0
  54. package/dist/new-components/atoms/Checkbox.es.js +4 -4
  55. package/dist/new-components/atoms/EmptyState.d.ts +44 -0
  56. package/dist/new-components/atoms/EmptyState.es.js +234 -0
  57. package/dist/new-components/atoms/EmptyState.es.js.map +1 -0
  58. package/dist/new-components/atoms/Popover.es.js +2 -2
  59. package/dist/new-components/atoms/Radio.es.js +8 -8
  60. package/dist/new-components/atoms/SegmentedControl.es.js +4 -4
  61. package/dist/new-components/atoms/Slider.es.js +5 -5
  62. package/dist/new-components/atoms/Toast.d.ts +79 -0
  63. package/dist/new-components/atoms/Toast.es.js +449 -0
  64. package/dist/new-components/atoms/Toast.es.js.map +1 -0
  65. package/dist/new-components/atoms/Toggletip.es.js +3 -3
  66. package/dist/new-components/atoms/Toggletip.es.js.map +1 -1
  67. package/dist/{shadowDom-Bq4g0Qeu.js → shadowDom-BfewIqRj.js} +2 -2
  68. package/dist/{shadowDom-Bq4g0Qeu.js.map → shadowDom-BfewIqRj.js.map} +1 -1
  69. package/dist/style.css +1 -1
  70. package/dist/tokens.css +16 -5
  71. package/dist/{useAriaLabelledBy-B6n92QBS.js → useAriaLabelledBy-Lyj6n_TU.js} +2 -2
  72. package/dist/{useAriaLabelledBy-B6n92QBS.js.map → useAriaLabelledBy-Lyj6n_TU.js.map} +1 -1
  73. package/dist/{useBaseUiId-Ch7ujXpo.js → useBaseUiId-CmLtG9DS.js} +4 -4
  74. package/dist/{useBaseUiId-Ch7ujXpo.js.map → useBaseUiId-CmLtG9DS.js.map} +1 -1
  75. package/dist/{useButton-PUBhT4Vo.js → useButton-D2BMuSfC.js} +2 -2
  76. package/dist/{useButton-PUBhT4Vo.js.map → useButton-D2BMuSfC.js.map} +1 -1
  77. package/dist/{useLabelableId-DCLzrdD-.js → useLabelableId-CcIE3RU0.js} +2 -2
  78. package/dist/{useLabelableId-DCLzrdD-.js.map → useLabelableId-CcIE3RU0.js.map} +1 -1
  79. package/dist/{useOpenInteractionType-DGWLoAqp.js → useOpenInteractionType-CDFYOw2d.js} +9 -9
  80. package/dist/{useOpenInteractionType-DGWLoAqp.js.map → useOpenInteractionType-CDFYOw2d.js.map} +1 -1
  81. package/dist/{usePopupHandleStore-BdS-xYID.js → usePopupHandleStore-CkW2IoED.js} +32 -32
  82. package/dist/{usePopupHandleStore-BdS-xYID.js.map → usePopupHandleStore-CkW2IoED.js.map} +1 -1
  83. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import IconProvider from "./IconProvider.es.js";
3
- import { D as DarkTooltip } from "../../Tooltip-D5E-qGtP.js";
3
+ import { D as DarkTooltip } from "../../Tooltip-uQIVdskf.js";
4
4
  import { c as classNames } from "../../classNames-B1XpQHle.js";
5
5
  import * as React from "react";
6
6
  import { u as useControlled } from "../../useControlled-BSyYkg5C.js";
7
7
  import { f as formatErrorMessage, u as useIsoLayoutEffect, a as useStableCallback, b as useRenderElement, E as EMPTY_ARRAY } from "../../useIsoLayoutEffect-e9VA-ICd.js";
8
8
  import { C as CompositeList, u as useCompositeListItem } from "../../CompositeList-D4xmSZ5V.js";
9
- import { c as createChangeEventDetails, i as initial, m as missing, d as disabled, u as useBaseUiId, n as none } from "../../useBaseUiId-Ch7ujXpo.js";
9
+ import { c as createChangeEventDetails, i as initial, m as missing, d as disabled, u as useBaseUiId, n as none } from "../../useBaseUiId-CmLtG9DS.js";
10
10
  import { i as inertValue } from "../../inertValue-IJM5NA30.js";
11
11
  import { u as useTransitionStatus, a as useOpenChangeComplete, t as transitionStatusMapping } from "../../useTransitionStatus-C9gg_XJ-.js";
12
- import { u as useCompositeItem, A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-BxrPc7F6.js";
13
- import { o as ownerDocument } from "../../index-B806bfA-.js";
14
- import { u as useCompositeRootContext, a as useButton } from "../../useButton-PUBhT4Vo.js";
15
- import { c as contains, a as activeElement } from "../../shadowDom-Bq4g0Qeu.js";
12
+ import { u as useCompositeItem, A as ACTIVE_COMPOSITE_ITEM, C as CompositeRoot } from "../../CompositeRoot-BlljDWkR.js";
13
+ import { o as ownerDocument } from "../../index-C-2yrwZl.js";
14
+ import { u as useCompositeRootContext, a as useButton } from "../../useButton-D2BMuSfC.js";
15
+ import { c as contains, a as activeElement } from "../../shadowDom-BfewIqRj.js";
16
16
  const TabsRootContext = /* @__PURE__ */ React.createContext(void 0);
17
17
  if (process.env.NODE_ENV !== "production") TabsRootContext.displayName = "TabsRootContext";
18
18
  function useTabsRootContext() {
@@ -10,21 +10,11 @@ declare const tooltipContentVariants: (props?: ({
10
10
  surface?: "code" | "inverse" | "card" | "unstyled" | null | undefined;
11
11
  tone?: "default" | "error" | null | undefined;
12
12
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
- type TooltipArrowProps = TooltipPrimitive.Arrow.Props & {
14
- strokeClassName?: string;
15
- overlap?: boolean;
16
- };
17
- declare function TooltipArrow({ className, strokeClassName, overlap, ...props }: TooltipArrowProps): React.JSX.Element;
18
13
  type TooltipContentProps = TooltipPrimitive.Popup.Props & VariantProps<typeof tooltipContentVariants> & Pick<TooltipPrimitive.Positioner.Props, 'align' | 'alignOffset' | 'side' | 'sideOffset'> & {
19
- arrow?: boolean;
20
- arrowClassName?: string;
21
- arrowPadding?: number;
22
- arrowStrokeClassName?: string;
23
14
  container?: TooltipPrimitive.Portal.Props['container'];
24
- overlap?: boolean;
25
15
  positionerClassName?: string;
26
16
  };
27
- declare function TooltipContent({ align, alignOffset, arrow, arrowClassName, arrowPadding, arrowStrokeClassName, children, className, container, overlap, positionerClassName, side, sideOffset, style, surface, tone, ...props }: TooltipContentProps): React.JSX.Element;
17
+ declare function TooltipContent({ align, alignOffset, children, className, container, positionerClassName, side, sideOffset, style, surface, tone, ...props }: TooltipContentProps): React.JSX.Element;
28
18
  declare function TooltipShortcut({ keys, surface }: {
29
19
  keys: string[];
30
20
  surface: Exclude<TooltipSurface, 'unstyled' | 'code'>;
@@ -56,8 +46,6 @@ export type CustomTooltipProps = {
56
46
  disableInteractive?: boolean;
57
47
  /** Legacy MUI alias; `true` keeps the popup hoverable, `false` matches `disableInteractive`. */
58
48
  interactive?: boolean;
59
- /** Origin arrow. Defaults to `true` to match Figma. */
60
- arrow?: boolean;
61
49
  /** Figma Tone. Error only when the trigger already shows a failure. */
62
50
  tone?: TooltipTone;
63
51
  /**
@@ -80,11 +68,11 @@ export type CustomTooltipProps = {
80
68
  popper?: string;
81
69
  };
82
70
  };
83
- export type TooltipProps = Partial<Pick<CustomTooltipProps, 'title' | 'placement' | 'size' | 'arrow' | 'tone' | 'heading' | 'shortcut' | 'content'>> & {
71
+ export type TooltipProps = Partial<Pick<CustomTooltipProps, 'title' | 'placement' | 'size' | 'tone' | 'heading' | 'shortcut' | 'content'>> & {
84
72
  disabledTitle?: React.ReactNode;
85
73
  };
86
74
  export declare const LightTooltip: React.MemoExoticComponent<(props: CustomTooltipProps) => React.JSX.Element>;
87
75
  export declare const DarkTooltip: React.MemoExoticComponent<(props: CustomTooltipProps) => React.JSX.Element>;
88
76
  export declare const UnstyledTooltip: React.MemoExoticComponent<(props: CustomTooltipProps) => React.JSX.Element>;
89
- export { Tooltip, TooltipArrow, TooltipBody, TooltipCode, TooltipContent, tooltipContentVariants, TooltipInlineCode, TooltipProvider, TooltipShortcut, TooltipTrigger, };
77
+ export { Tooltip, TooltipBody, TooltipCode, TooltipContent, tooltipContentVariants, TooltipInlineCode, TooltipProvider, TooltipShortcut, TooltipTrigger, };
90
78
  export type { TooltipContentProps, TooltipSurface, TooltipTone };
@@ -3,21 +3,20 @@ import "react";
3
3
  import "../../index-DSVg79g-.js";
4
4
  import "./Code.es.js";
5
5
  import "../../classNames-B1XpQHle.js";
6
- import { D, L, T, d, e, f, h, j, k, l, m, U, i, t } from "../../Tooltip-D5E-qGtP.js";
6
+ import { D, L, T, d, e, f, i, j, k, l, U, h, t } from "../../Tooltip-uQIVdskf.js";
7
7
  export {
8
8
  D as DarkTooltip,
9
9
  L as LightTooltip,
10
10
  T as Tooltip,
11
- d as TooltipArrow,
12
- e as TooltipBody,
13
- f as TooltipCode,
14
- h as TooltipContent,
15
- j as TooltipInlineCode,
16
- k as TooltipProvider,
17
- l as TooltipShortcut,
18
- m as TooltipTrigger,
11
+ d as TooltipBody,
12
+ e as TooltipCode,
13
+ f as TooltipContent,
14
+ i as TooltipInlineCode,
15
+ j as TooltipProvider,
16
+ k as TooltipShortcut,
17
+ l as TooltipTrigger,
19
18
  U as UnstyledTooltip,
20
- i as tooltipContentVariants,
19
+ h as tooltipContentVariants,
21
20
  t as tooltipTrigger
22
21
  };
23
22
  //# sourceMappingURL=Tooltip.es.js.map
@@ -1,10 +1,10 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import { B as Button } from "../../Button-CHzl5RaT.js";
4
- import { M as Modal } from "../../Modal-MUzR0rK2.js";
3
+ import { B as Button } from "../../Button-CPJYHldw.js";
4
+ import { M as Modal } from "../../Modal-BUWlwJcN.js";
5
5
  import { c as classNames } from "../../classNames-B1XpQHle.js";
6
6
  import { t as toDataTestId } from "../../conversions-CbWPvHRE.js";
7
- import { I as Input } from "../../Input-WdhMjVoF.js";
7
+ import { I as Input } from "../../Input-Dcxu6SVO.js";
8
8
  const Alert = ({
9
9
  title,
10
10
  message,
@@ -1,9 +1,9 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { b, a, C } from "../../Input-WdhMjVoF.js";
3
+ import { b, a, C } from "../../Input-Dcxu6SVO.js";
4
4
  import "../theme/useTheme.es.js";
5
5
  import "../../classNames-B1XpQHle.js";
6
- import "../../Button-CHzl5RaT.js";
6
+ import "../../Button-CPJYHldw.js";
7
7
  import "../atoms/IconButton.es.js";
8
8
  import "./Notify.es.js";
9
9
  export {
@@ -6,7 +6,7 @@ import IconProvider from "../atoms/IconProvider.es.js";
6
6
  import { t as toDataTestId } from "../../conversions-CbWPvHRE.js";
7
7
  import Alert from "./Alert.es.js";
8
8
  import { c as classNames } from "../../classNames-B1XpQHle.js";
9
- import { e as DialogTitle, f as DialogRoot, g as DialogPortal, h as DialogPopup, i as DialogClose, j as DialogBackdrop } from "../../Modal-MUzR0rK2.js";
9
+ import { D as DialogTitle, a as DialogRoot, b as DialogPortal, c as DialogPopup, d as DialogClose, e as DialogBackdrop } from "../../Modal-BUWlwJcN.js";
10
10
  function Sheet(props) {
11
11
  return /* @__PURE__ */ jsx(DialogRoot, { "data-slot": "sheet", ...props });
12
12
  }
@@ -1,5 +1,5 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { D as Dialog$1, a as DialogContent, b as DialogHeader, c as DialogTitle, d as DialogFooter } from "../../Modal-MUzR0rK2.js";
2
+ import { f as Dialog$1, g as DialogContent, h as DialogHeader, i as DialogTitle, j as DialogFooter } from "../../Modal-BUWlwJcN.js";
3
3
  import { c as classNames } from "../../classNames-B1XpQHle.js";
4
4
  const Dialog = ({
5
5
  open,
@@ -1,8 +1,8 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState, useCallback } from "react";
3
- import { B as Button } from "../../Button-CHzl5RaT.js";
3
+ import { B as Button } from "../../Button-CPJYHldw.js";
4
4
  import IconButton from "../atoms/IconButton.es.js";
5
- import { M as Modal } from "../../Modal-MUzR0rK2.js";
5
+ import { M as Modal } from "../../Modal-BUWlwJcN.js";
6
6
  import Skeleton from "../atoms/Skeleton.es.js";
7
7
  import { c as classNames } from "../../classNames-B1XpQHle.js";
8
8
  function baseToString(value) {
@@ -1,9 +1,9 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
- import { I } from "../../Input-WdhMjVoF.js";
3
+ import { I } from "../../Input-Dcxu6SVO.js";
4
4
  import "../../classNames-B1XpQHle.js";
5
5
  import "../atoms/IconProvider.es.js";
6
- import "../../Tooltip-D5E-qGtP.js";
6
+ import "../../Tooltip-uQIVdskf.js";
7
7
  export {
8
8
  I as default
9
9
  };
@@ -11,7 +11,7 @@ function lazyWithPreload(factory) {
11
11
  Component.preload = factory;
12
12
  return Component;
13
13
  }
14
- const Markdown = lazyWithPreload(() => import("../../Input-WdhMjVoF.js").then((n) => n.c));
14
+ const Markdown = lazyWithPreload(() => import("../../Input-Dcxu6SVO.js").then((n) => n.c));
15
15
  const MarkdownLazy = (props) => {
16
16
  const { spinnerProps, ...restProps } = props;
17
17
  const fallbackComponent = useMemo(() => /* @__PURE__ */ jsx(Spinner, { small: true, center: true, ...spinnerProps }), [spinnerProps]);
@@ -235,7 +235,7 @@ const ChatFileDownload = ({
235
235
  onValueChange: (v) => setExpanded(v.includes("files")),
236
236
  className: "my-2 rounded-lg border border-border-default dark:border-border-default",
237
237
  children: /* @__PURE__ */ jsxs(AccordionItem, { value: "files", className: "border-0", children: [
238
- /* @__PURE__ */ jsx(AccordionTrigger, { className: "bg-background-brand rounded-t-lg flex-row-reverse gap-2 px-3 py-2 hover:no-underline", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-2", children: [
238
+ /* @__PURE__ */ jsx(AccordionTrigger, { className: "bg-background-brand rounded-t-lg flex-row-reverse gap-2 px-3 py-2 hover:bg-background-brand hover:no-underline", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 pl-2", children: [
239
239
  /* @__PURE__ */ jsx(IconProvider, { icon: "file-lines", size: 0.75, className: "shrink-0 text-text-brand" }),
240
240
  /* @__PURE__ */ jsxs("span", { className: "text-xs font-medium text-text-brand", children: [
241
241
  files.length,
@@ -1 +1 @@
1
- {"version":3,"file":"Markdown.es.js","sources":["../../../src/components/molecules/Markdown/Markdown.utils.ts","../../../src/components/molecules/Markdown/MarkdownLazy.tsx","../../../src/components/molecules/Markdown/ChatFileDownload.tsx","../../../src/components/molecules/Markdown/parseSandboxArtifacts.ts","../../../src/components/molecules/Markdown/SandboxArtifactsFenceBlock.tsx","../../../src/components/molecules/Markdown/MarkdownWithOpenUI.tsx"],"sourcesContent":["import { ComponentType, lazy, LazyExoticComponent } from 'react'\n\nexport function lazyWithPreload<T extends ComponentType<any>>(factory: () => Promise<{ default: T }>) {\n const Component = lazy(factory) as LazyExoticComponent<T> & { preload: () => Promise<{ default: T }> }\n Component.preload = factory\n return Component\n}\n","import React, { Suspense, useMemo } from 'react'\n\nimport Spinner, { type SpinnerProps } from '@/components/atoms/Spinner'\n\nimport { type FencedCodeBlockProps, type MarkdownProps } from './Markdown'\nimport { lazyWithPreload } from './Markdown.utils'\n\nexport type { FencedCodeBlockProps, MarkdownProps }\n\nconst Markdown = lazyWithPreload(() => import('./Markdown'))\n\ninterface MarkdownLazyProps extends MarkdownProps {\n spinnerProps?: SpinnerProps\n}\n\nconst MarkdownLazy: React.FC<MarkdownLazyProps> & {\n preload?: typeof Markdown.preload\n} = (props) => {\n const { spinnerProps, ...restProps } = props\n\n const fallbackComponent = useMemo(() => <Spinner small center {...spinnerProps} />, [spinnerProps])\n\n return (\n <Suspense fallback={fallbackComponent}>\n <Markdown {...restProps}>{restProps.children}</Markdown>\n </Suspense>\n )\n}\n\nMarkdownLazy.preload = Markdown.preload\n\nexport default MarkdownLazy\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/atoms/Accordion'\nimport IconButton from '@/components/atoms/IconButton'\nimport IconProvider from '@/components/atoms/IconProvider'\nimport Spinner from '@/components/atoms/Spinner'\nimport notify from '@/components/molecules/Notify'\n\nimport classNames from '@/utils/classNames'\n\nimport type { SandboxArtifactFile } from './parseSandboxArtifacts'\n\nexport type ChatFileDownloadProps = {\n files: SandboxArtifactFile[]\n /** When set, artifact `path` is resolved against this base (unless `path` is already an absolute URL). */\n fileDownloadBaseUrl?: string\n readOnly?: boolean\n /** Tooltip shown when `readOnly` disables a download action. */\n readOnlyTooltip?: string\n /** Custom download handler that receives the original sandbox artifact path. */\n onDownloadArtifact?: (path: string, filename: string) => Promise<void>\n /**\n * Custom download handler. Receives the resolved URL and suggested filename.\n * When omitted, a basic fetch-and-save fallback is used.\n */\n onDownloadFile?: (url: string, filename: string) => Promise<void>\n}\n\nconst ABSOLUTE_URL_RE = /^https?:\\/\\//i\nconst MAX_INLINE_FILES = 2\n\ntype DownloadState = 'downloading' | 'downloaded'\n\nfunction fileNameFromPath(filePath: string): string {\n if (ABSOLUTE_URL_RE.test(filePath)) {\n try {\n const u = new URL(filePath)\n const segments = u.pathname.split('/').filter(Boolean)\n const last = segments.pop()\n if (last) return last\n } catch {\n /* ignore */\n }\n }\n const normalized = filePath.replace(/\\\\/g, '/')\n const segments = normalized.split('/').filter(Boolean)\n const last = segments.pop()\n return last ?? filePath\n}\n\nfunction buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl: string | undefined, filePath: string): string | null {\n if (ABSOLUTE_URL_RE.test(filePath)) {\n return filePath\n }\n if (!fileDownloadBaseUrl?.trim()) {\n return null\n }\n const sep = fileDownloadBaseUrl.includes('?') ? '&' : '?'\n return `${fileDownloadBaseUrl}${sep}path=${encodeURIComponent(filePath)}`\n}\n\nasync function defaultDownloadFile(url: string, filename: string): Promise<void> {\n const res = await fetch(url)\n if (!res.ok) {\n const detail = res.statusText || `HTTP ${res.status}`\n throw new Error(`Download failed: ${detail}`)\n }\n const blob = await res.blob()\n const blobUrl = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = blobUrl\n a.download = filename\n document.body.appendChild(a)\n a.click()\n a.remove()\n URL.revokeObjectURL(blobUrl)\n}\n\ntype FileItemProps = {\n file: SandboxArtifactFile\n fileDownloadBaseUrl?: string\n hasArtifactDownloadHandler: boolean\n onDownload: (file: SandboxArtifactFile) => Promise<void>\n showSeparator: boolean\n downloadState?: DownloadState\n itemRef?: (node: HTMLDivElement | null) => void\n readOnly?: boolean\n readOnlyTooltip?: string\n}\n\nconst FileItem: React.FC<FileItemProps> = ({\n file,\n fileDownloadBaseUrl,\n hasArtifactDownloadHandler,\n onDownload,\n showSeparator,\n downloadState,\n itemRef,\n readOnly = false,\n readOnlyTooltip = 'Download is not available in Traces',\n}) => {\n const resolvedUrl = buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl, file.path)\n const displayName = fileNameFromPath(file.path)\n return (\n <div className=\"flex shrink-0 items-center gap-3\">\n <div ref={itemRef} className=\"flex shrink-0 items-center gap-2 whitespace-nowrap\">\n <span className=\"font-jetbrains text-xs leading-snug text-text-primary\">{displayName}</span>\n {downloadState === 'downloading' ? (\n <div className=\"flex h-4 w-4 shrink-0 items-center justify-center\">\n <Spinner small />\n </div>\n ) : (\n <div className=\"flex h-4 w-4 shrink-0 items-center justify-center\">\n <IconButton\n icon={downloadState === 'downloaded' ? 'check' : 'download'}\n variant=\"ghost\"\n size=\"sm\"\n tooltip={readOnly ? readOnlyTooltip : downloadState === 'downloaded' ? 'Downloaded' : 'Download'}\n iconSize={0.875}\n disabled={readOnly || (!hasArtifactDownloadHandler && !resolvedUrl) || downloadState === 'downloaded'}\n onClick={() => void onDownload(file)}\n className={classNames(\n 'shrink-0',\n downloadState === 'downloaded'\n ? 'text-status-text-success hover:text-status-text-success !opacity-100'\n : 'text-text-secondary hover:text-text-primary',\n )}\n />\n </div>\n )}\n </div>\n {showSeparator && <div className=\"h-4 w-px shrink-0 bg-border-bold\" aria-hidden />}\n </div>\n )\n}\n\nconst ChatFileDownload: React.FC<ChatFileDownloadProps> = ({\n files,\n fileDownloadBaseUrl,\n readOnly = false,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n}) => {\n const [expanded, setExpanded] = useState(false)\n const [downloadStates, setDownloadStates] = useState<Record<string, DownloadState>>({})\n const [rowWiseSeparators, setRowWiseSeparators] = useState<Record<string, boolean>>({})\n const filesContainerRef = useRef<HTMLDivElement | null>(null)\n const itemRefs = useRef<Record<string, HTMLDivElement | null>>({})\n\n const filePaths = useMemo(() => files.map((file) => file.path), [files])\n\n useEffect(() => {\n const calculateSeparators = () => {\n if (filePaths.length === 0) {\n setRowWiseSeparators({})\n return\n }\n\n const nextSeparators: Record<string, boolean> = {}\n filePaths.forEach((path, index) => {\n const currentNode = itemRefs.current[path]\n if (!currentNode || index === filePaths.length - 1) {\n nextSeparators[path] = false\n return\n }\n const nextPath = filePaths[index + 1]\n const nextNode = itemRefs.current[nextPath]\n nextSeparators[path] = Boolean(nextNode && nextNode.offsetTop === currentNode.offsetTop)\n })\n setRowWiseSeparators(nextSeparators)\n }\n\n const frame = window.requestAnimationFrame(calculateSeparators)\n const resizeObserver = new ResizeObserver(() => {\n window.requestAnimationFrame(calculateSeparators)\n })\n if (filesContainerRef.current) {\n resizeObserver.observe(filesContainerRef.current)\n }\n\n return () => {\n window.cancelAnimationFrame(frame)\n resizeObserver.disconnect()\n }\n }, [filePaths, downloadStates])\n\n const downloadFn = onDownloadFile ?? defaultDownloadFile\n\n const handleDownload = useCallback(\n async (file: SandboxArtifactFile) => {\n if (readOnly) {\n return\n }\n setDownloadStates((prev) => ({\n ...prev,\n [file.path]: 'downloading',\n }))\n const url = buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl, file.path)\n if (onDownloadArtifact == null && !url) {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n notify('error', 'Download unavailable', 'Sandbox download URL is not configured.')\n return\n }\n try {\n const filename = fileNameFromPath(file.path)\n if (onDownloadArtifact != null) {\n await onDownloadArtifact(file.path, filename)\n } else {\n if (url == null) {\n throw new Error('Sandbox download URL is not configured.')\n }\n await downloadFn(url, filename)\n }\n setDownloadStates((prev) => ({\n ...prev,\n [file.path]: 'downloaded',\n }))\n setTimeout(() => {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n }, 2000)\n } catch (err) {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n notify('error', 'Download failed', err instanceof Error ? err.message : 'Unknown error')\n }\n },\n [fileDownloadBaseUrl, downloadFn, onDownloadArtifact, readOnly],\n )\n\n if (files.length === 0) {\n return null\n }\n\n const fileItems = files.map((file, index) => (\n <FileItem\n key={file.path}\n file={file}\n fileDownloadBaseUrl={fileDownloadBaseUrl}\n hasArtifactDownloadHandler={onDownloadArtifact != null}\n onDownload={handleDownload}\n showSeparator={rowWiseSeparators[file.path] ?? index < files.length - 1}\n downloadState={downloadStates[file.path]}\n itemRef={(node) => {\n itemRefs.current[file.path] = node\n }}\n readOnly={readOnly}\n readOnlyTooltip={readOnlyTooltip}\n />\n ))\n\n if (files.length <= MAX_INLINE_FILES) {\n return (\n <div className={classNames('my-2 flex w-full min-w-0 items-center gap-3')}>\n <div className=\"h-7 w-1 shrink-0 self-center rounded-sm bg-background-brand-bold-selected\" aria-hidden />\n <div className=\"flex shrink-0 items-center\">\n <IconProvider icon=\"file-lines\" size={0.875} className=\"text-text-tertiary\" />\n </div>\n <div\n ref={filesContainerRef}\n className={classNames('flex min-w-0 flex-1 items-center gap-3 overflow-x-auto scrollbar-hide')}\n >\n {fileItems}\n </div>\n </div>\n )\n }\n\n return (\n <Accordion\n value={expanded ? ['files'] : []}\n onValueChange={(v) => setExpanded(v.includes('files'))}\n className=\"my-2 rounded-lg border border-border-default dark:border-border-default\"\n >\n <AccordionItem value=\"files\" className=\"border-0\">\n <AccordionTrigger className=\"bg-background-brand rounded-t-lg flex-row-reverse gap-2 px-3 py-2 hover:no-underline\">\n <div className=\"flex items-center gap-2 pl-2\">\n <IconProvider icon=\"file-lines\" size={0.75} className=\"shrink-0 text-text-brand\" />\n <span className=\"text-xs font-medium text-text-brand\">{files.length} files generated</span>\n </div>\n </AccordionTrigger>\n <AccordionContent className=\"px-3 py-2\">\n <div\n ref={filesContainerRef}\n className={classNames('flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 py-1')}\n >\n {fileItems}\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n )\n}\n\nexport default ChatFileDownload\n","export type SandboxArtifactFile = {\n name: string\n path: string\n}\n\nconst PREFIX = 'sandbox_artifacts'\n\n/**\n * Matches `[name](path)` pairs in order (markdown link shape). Assumes `name` contains no `]`\n * and `path` contains no `)`. Revisit if real artifact paths can contain `)`.\n */\nconst PAIR_RE = /\\[([^\\]]*)\\]\\(([^)]*)\\)/g\n\n/**\n * Parses a `sandbox_artifacts` fence body into an ordered list of `{ name, path }` files.\n *\n * Expected lines look like `[add.py](/tmp/add.py)`; multiple entries may be separated by newlines.\n * The optional leading `sandbox_artifacts` literal is stripped before pair extraction for\n * backwards compatibility with inline `sandbox_artifacts[...](...)...` bodies.\n *\n * Pairs with empty `name` or empty `path` are dropped, which also ignores incomplete trailing\n * tokens like `[a]` without a following `(...)`.\n */\nexport function parseSandboxArtifacts(content: string): SandboxArtifactFile[] {\n const trimmed = content.trim()\n const body = trimmed.startsWith(PREFIX) ? trimmed.slice(PREFIX.length).trimStart() : trimmed\n\n const files: SandboxArtifactFile[] = []\n PAIR_RE.lastIndex = 0\n let match: RegExpExecArray | null = PAIR_RE.exec(body)\n while (match !== null) {\n const name = match[1].trim()\n const path = match[2].trim()\n if (name && path) {\n files.push({ name, path })\n }\n match = PAIR_RE.exec(body)\n }\n\n return files\n}\n","import React, { useMemo } from 'react'\n\nimport ChatFileDownload from './ChatFileDownload'\nimport type { FencedCodeBlockProps } from './codeFencing'\nimport { parseSandboxArtifacts } from './parseSandboxArtifacts'\n\n/**\n * Renders ```sandbox_artifacts ... ``` fences as a `ChatFileDownload` list.\n * Fence body: one `[filename](path)` markdown-link pair per line (or inline), e.g. `[add.py](/tmp/add.py)`.\n * Parsing is memoised on `content` so streaming updates only re-parse when content changes.\n */\nconst SandboxArtifactsFenceBlock: React.FC<FencedCodeBlockProps> = ({\n content,\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n}) => {\n const files = useMemo(() => parseSandboxArtifacts(content), [content])\n\n if (files.length === 0) {\n return null\n }\n\n return (\n <ChatFileDownload\n files={files}\n fileDownloadBaseUrl={fileDownloadBaseUrl}\n readOnly={readOnly}\n readOnlyTooltip={readOnlyTooltip}\n onDownloadArtifact={onDownloadArtifact}\n onDownloadFile={onDownloadFile}\n />\n )\n}\n\nexport default SandboxArtifactsFenceBlock\n","import React, { lazy, Suspense, useMemo } from 'react'\n\nimport Spinner from '@/components/atoms/Spinner'\n\nimport MarkdownLazy, { type FencedCodeBlockProps, type MarkdownProps } from './MarkdownLazy'\nimport SandboxArtifactsFenceBlock from './SandboxArtifactsFenceBlock'\n\nexport type MarkdownWithOpenUIProps = Omit<MarkdownProps, 'codeFencingConfig'> & {\n /** Forwarded into the OpenUI fence block (e.g. streaming assistant output). */\n isStreaming?: boolean\n /** Base URL for resolving sandbox artifact download paths (e.g. gateway file endpoint). */\n fileDownloadBaseUrl?: string\n /** When true, download actions in sandbox artifact blocks are hidden/disabled. */\n readOnly?: boolean\n /** Tooltip shown when `readOnly` disables a download action. */\n readOnlyTooltip?: string\n /** Custom download handler that receives the original sandbox artifact path. */\n onDownloadArtifact?: (path: string, filename: string) => Promise<void>\n /**\n * Custom download handler forwarded to sandbox artifact blocks.\n * Receives the resolved URL and suggested filename.\n */\n onDownloadFile?: (url: string, filename: string) => Promise<void>\n}\n\n/**\n * Same module as the lazy OpenUI fence block; call to preload OpenUI (react-lang, react-ui, CSS)\n * before markdown is known to contain ```openui fences — e.g. when opening the playground chat.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const preloadMarkdownOpenUI = (): Promise<{ default: React.ComponentType<any> }> => import('./OpenUiFenceBlock')\n\nconst OpenUiFenceBlockLazy = lazy(preloadMarkdownOpenUI)\n\nconst SuspensedOpenUiFenceBlock: React.FC<FencedCodeBlockProps> = (props) => {\n return (\n <Suspense fallback={<Spinner small center />}>\n <OpenUiFenceBlockLazy {...props} />\n </Suspense>\n )\n}\n\n/**\n * Markdown with optional OpenUI fenced blocks (` ```openui `).\n * OpenUI dependencies load only when the markdown string contains such a fence, or when\n * {@link preloadMarkdownOpenUI} has been called earlier.\n */\nexport const MarkdownWithOpenUI: React.FC<MarkdownWithOpenUIProps> = (props) => {\n const {\n isStreaming,\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n ...markdownProps\n } = props\n const codeFencingConfig = useMemo(\n () => ({\n openui: {\n Component: SuspensedOpenUiFenceBlock,\n componentProps: { isStreaming },\n },\n sandbox_artifacts: {\n Component: SandboxArtifactsFenceBlock,\n componentProps: {\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n },\n },\n }),\n [fileDownloadBaseUrl, isStreaming, readOnly, readOnlyTooltip, onDownloadArtifact, onDownloadFile],\n )\n return <MarkdownLazy {...markdownProps} codeFencingConfig={codeFencingConfig} />\n}\n\nexport default MarkdownWithOpenUI\n"],"names":["segments","last"],"mappings":";;;;;;;;AAEO,SAAS,gBAA8C,SAAwC;AACpG,QAAM,YAAY,KAAK,OAAO;AAC9B,YAAU,UAAU;AACpB,SAAO;AACT;ACGA,MAAM,WAAW,gBAAgB,MAAM,OAAO,yBAAY,kBAAC;AAM3D,MAAM,eAEF,CAAC,UAAU;AACb,QAAM,EAAE,cAAc,GAAG,UAAA,IAAc;AAEvC,QAAM,oBAAoB,QAAQ,MAAM,oBAAC,WAAQ,OAAK,MAAC,QAAM,MAAE,GAAG,aAAA,CAAc,GAAI,CAAC,YAAY,CAAC;AAElG,SACE,oBAAC,UAAA,EAAS,UAAU,mBAClB,UAAA,oBAAC,YAAU,GAAG,WAAY,UAAA,UAAU,SAAA,CAAS,EAAA,CAC/C;AAEJ;AAEA,aAAa,UAAU,SAAS;ACDhC,MAAM,kBAAkB;AACxB,MAAM,mBAAmB;AAIzB,SAAS,iBAAiB,UAA0B;AAClD,MAAI,gBAAgB,KAAK,QAAQ,GAAG;AAClC,QAAI;AACF,YAAM,IAAI,IAAI,IAAI,QAAQ;AAC1B,YAAMA,YAAW,EAAE,SAAS,MAAM,GAAG,EAAE,OAAO,OAAO;AACrD,YAAMC,QAAOD,UAAS,IAAA;AACtB,UAAIC,MAAM,QAAOA;AAAAA,IACnB,QAAQ;AAAA,IAER;AAAA,EACF;AACA,QAAM,aAAa,SAAS,QAAQ,OAAO,GAAG;AAC9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EAAE,YAAA;AAAA,MAAY;AAAA,MAEhC,mBAAmB;AAAA,QACjB,WAAW;AAAA,QACX,gBAAgB;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,CAAC,qBAAqB,aAAa,UAAU,iBAAiB,oBAAoB,cAAc;AAAA,EAAA;AAElG,SAAO,oBAAC,cAAA,EAAc,GAAG,eAAe,kBAAA,CAAsC;AAChF;"}
1
+ {"version":3,"file":"Markdown.es.js","sources":["../../../src/components/molecules/Markdown/Markdown.utils.ts","../../../src/components/molecules/Markdown/MarkdownLazy.tsx","../../../src/components/molecules/Markdown/ChatFileDownload.tsx","../../../src/components/molecules/Markdown/parseSandboxArtifacts.ts","../../../src/components/molecules/Markdown/SandboxArtifactsFenceBlock.tsx","../../../src/components/molecules/Markdown/MarkdownWithOpenUI.tsx"],"sourcesContent":["import { ComponentType, lazy, LazyExoticComponent } from 'react'\n\nexport function lazyWithPreload<T extends ComponentType<any>>(factory: () => Promise<{ default: T }>) {\n const Component = lazy(factory) as LazyExoticComponent<T> & { preload: () => Promise<{ default: T }> }\n Component.preload = factory\n return Component\n}\n","import React, { Suspense, useMemo } from 'react'\n\nimport Spinner, { type SpinnerProps } from '@/components/atoms/Spinner'\n\nimport { type FencedCodeBlockProps, type MarkdownProps } from './Markdown'\nimport { lazyWithPreload } from './Markdown.utils'\n\nexport type { FencedCodeBlockProps, MarkdownProps }\n\nconst Markdown = lazyWithPreload(() => import('./Markdown'))\n\ninterface MarkdownLazyProps extends MarkdownProps {\n spinnerProps?: SpinnerProps\n}\n\nconst MarkdownLazy: React.FC<MarkdownLazyProps> & {\n preload?: typeof Markdown.preload\n} = (props) => {\n const { spinnerProps, ...restProps } = props\n\n const fallbackComponent = useMemo(() => <Spinner small center {...spinnerProps} />, [spinnerProps])\n\n return (\n <Suspense fallback={fallbackComponent}>\n <Markdown {...restProps}>{restProps.children}</Markdown>\n </Suspense>\n )\n}\n\nMarkdownLazy.preload = Markdown.preload\n\nexport default MarkdownLazy\n","import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\n\nimport { Accordion, AccordionContent, AccordionItem, AccordionTrigger } from '@/components/atoms/Accordion'\nimport IconButton from '@/components/atoms/IconButton'\nimport IconProvider from '@/components/atoms/IconProvider'\nimport Spinner from '@/components/atoms/Spinner'\nimport notify from '@/components/molecules/Notify'\n\nimport classNames from '@/utils/classNames'\n\nimport type { SandboxArtifactFile } from './parseSandboxArtifacts'\n\nexport type ChatFileDownloadProps = {\n files: SandboxArtifactFile[]\n /** When set, artifact `path` is resolved against this base (unless `path` is already an absolute URL). */\n fileDownloadBaseUrl?: string\n readOnly?: boolean\n /** Tooltip shown when `readOnly` disables a download action. */\n readOnlyTooltip?: string\n /** Custom download handler that receives the original sandbox artifact path. */\n onDownloadArtifact?: (path: string, filename: string) => Promise<void>\n /**\n * Custom download handler. Receives the resolved URL and suggested filename.\n * When omitted, a basic fetch-and-save fallback is used.\n */\n onDownloadFile?: (url: string, filename: string) => Promise<void>\n}\n\nconst ABSOLUTE_URL_RE = /^https?:\\/\\//i\nconst MAX_INLINE_FILES = 2\n\ntype DownloadState = 'downloading' | 'downloaded'\n\nfunction fileNameFromPath(filePath: string): string {\n if (ABSOLUTE_URL_RE.test(filePath)) {\n try {\n const u = new URL(filePath)\n const segments = u.pathname.split('/').filter(Boolean)\n const last = segments.pop()\n if (last) return last\n } catch {\n /* ignore */\n }\n }\n const normalized = filePath.replace(/\\\\/g, '/')\n const segments = normalized.split('/').filter(Boolean)\n const last = segments.pop()\n return last ?? filePath\n}\n\nfunction buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl: string | undefined, filePath: string): string | null {\n if (ABSOLUTE_URL_RE.test(filePath)) {\n return filePath\n }\n if (!fileDownloadBaseUrl?.trim()) {\n return null\n }\n const sep = fileDownloadBaseUrl.includes('?') ? '&' : '?'\n return `${fileDownloadBaseUrl}${sep}path=${encodeURIComponent(filePath)}`\n}\n\nasync function defaultDownloadFile(url: string, filename: string): Promise<void> {\n const res = await fetch(url)\n if (!res.ok) {\n const detail = res.statusText || `HTTP ${res.status}`\n throw new Error(`Download failed: ${detail}`)\n }\n const blob = await res.blob()\n const blobUrl = URL.createObjectURL(blob)\n const a = document.createElement('a')\n a.href = blobUrl\n a.download = filename\n document.body.appendChild(a)\n a.click()\n a.remove()\n URL.revokeObjectURL(blobUrl)\n}\n\ntype FileItemProps = {\n file: SandboxArtifactFile\n fileDownloadBaseUrl?: string\n hasArtifactDownloadHandler: boolean\n onDownload: (file: SandboxArtifactFile) => Promise<void>\n showSeparator: boolean\n downloadState?: DownloadState\n itemRef?: (node: HTMLDivElement | null) => void\n readOnly?: boolean\n readOnlyTooltip?: string\n}\n\nconst FileItem: React.FC<FileItemProps> = ({\n file,\n fileDownloadBaseUrl,\n hasArtifactDownloadHandler,\n onDownload,\n showSeparator,\n downloadState,\n itemRef,\n readOnly = false,\n readOnlyTooltip = 'Download is not available in Traces',\n}) => {\n const resolvedUrl = buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl, file.path)\n const displayName = fileNameFromPath(file.path)\n return (\n <div className=\"flex shrink-0 items-center gap-3\">\n <div ref={itemRef} className=\"flex shrink-0 items-center gap-2 whitespace-nowrap\">\n <span className=\"font-jetbrains text-xs leading-snug text-text-primary\">{displayName}</span>\n {downloadState === 'downloading' ? (\n <div className=\"flex h-4 w-4 shrink-0 items-center justify-center\">\n <Spinner small />\n </div>\n ) : (\n <div className=\"flex h-4 w-4 shrink-0 items-center justify-center\">\n <IconButton\n icon={downloadState === 'downloaded' ? 'check' : 'download'}\n variant=\"ghost\"\n size=\"sm\"\n tooltip={readOnly ? readOnlyTooltip : downloadState === 'downloaded' ? 'Downloaded' : 'Download'}\n iconSize={0.875}\n disabled={readOnly || (!hasArtifactDownloadHandler && !resolvedUrl) || downloadState === 'downloaded'}\n onClick={() => void onDownload(file)}\n className={classNames(\n 'shrink-0',\n downloadState === 'downloaded'\n ? 'text-status-text-success hover:text-status-text-success !opacity-100'\n : 'text-text-secondary hover:text-text-primary',\n )}\n />\n </div>\n )}\n </div>\n {showSeparator && <div className=\"h-4 w-px shrink-0 bg-border-bold\" aria-hidden />}\n </div>\n )\n}\n\nconst ChatFileDownload: React.FC<ChatFileDownloadProps> = ({\n files,\n fileDownloadBaseUrl,\n readOnly = false,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n}) => {\n const [expanded, setExpanded] = useState(false)\n const [downloadStates, setDownloadStates] = useState<Record<string, DownloadState>>({})\n const [rowWiseSeparators, setRowWiseSeparators] = useState<Record<string, boolean>>({})\n const filesContainerRef = useRef<HTMLDivElement | null>(null)\n const itemRefs = useRef<Record<string, HTMLDivElement | null>>({})\n\n const filePaths = useMemo(() => files.map((file) => file.path), [files])\n\n useEffect(() => {\n const calculateSeparators = () => {\n if (filePaths.length === 0) {\n setRowWiseSeparators({})\n return\n }\n\n const nextSeparators: Record<string, boolean> = {}\n filePaths.forEach((path, index) => {\n const currentNode = itemRefs.current[path]\n if (!currentNode || index === filePaths.length - 1) {\n nextSeparators[path] = false\n return\n }\n const nextPath = filePaths[index + 1]\n const nextNode = itemRefs.current[nextPath]\n nextSeparators[path] = Boolean(nextNode && nextNode.offsetTop === currentNode.offsetTop)\n })\n setRowWiseSeparators(nextSeparators)\n }\n\n const frame = window.requestAnimationFrame(calculateSeparators)\n const resizeObserver = new ResizeObserver(() => {\n window.requestAnimationFrame(calculateSeparators)\n })\n if (filesContainerRef.current) {\n resizeObserver.observe(filesContainerRef.current)\n }\n\n return () => {\n window.cancelAnimationFrame(frame)\n resizeObserver.disconnect()\n }\n }, [filePaths, downloadStates])\n\n const downloadFn = onDownloadFile ?? defaultDownloadFile\n\n const handleDownload = useCallback(\n async (file: SandboxArtifactFile) => {\n if (readOnly) {\n return\n }\n setDownloadStates((prev) => ({\n ...prev,\n [file.path]: 'downloading',\n }))\n const url = buildSandboxArtifactDownloadUrl(fileDownloadBaseUrl, file.path)\n if (onDownloadArtifact == null && !url) {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n notify('error', 'Download unavailable', 'Sandbox download URL is not configured.')\n return\n }\n try {\n const filename = fileNameFromPath(file.path)\n if (onDownloadArtifact != null) {\n await onDownloadArtifact(file.path, filename)\n } else {\n if (url == null) {\n throw new Error('Sandbox download URL is not configured.')\n }\n await downloadFn(url, filename)\n }\n setDownloadStates((prev) => ({\n ...prev,\n [file.path]: 'downloaded',\n }))\n setTimeout(() => {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n }, 2000)\n } catch (err) {\n setDownloadStates((prev) => {\n const next = { ...prev }\n delete next[file.path]\n return next\n })\n notify('error', 'Download failed', err instanceof Error ? err.message : 'Unknown error')\n }\n },\n [fileDownloadBaseUrl, downloadFn, onDownloadArtifact, readOnly],\n )\n\n if (files.length === 0) {\n return null\n }\n\n const fileItems = files.map((file, index) => (\n <FileItem\n key={file.path}\n file={file}\n fileDownloadBaseUrl={fileDownloadBaseUrl}\n hasArtifactDownloadHandler={onDownloadArtifact != null}\n onDownload={handleDownload}\n showSeparator={rowWiseSeparators[file.path] ?? index < files.length - 1}\n downloadState={downloadStates[file.path]}\n itemRef={(node) => {\n itemRefs.current[file.path] = node\n }}\n readOnly={readOnly}\n readOnlyTooltip={readOnlyTooltip}\n />\n ))\n\n if (files.length <= MAX_INLINE_FILES) {\n return (\n <div className={classNames('my-2 flex w-full min-w-0 items-center gap-3')}>\n <div className=\"h-7 w-1 shrink-0 self-center rounded-sm bg-background-brand-bold-selected\" aria-hidden />\n <div className=\"flex shrink-0 items-center\">\n <IconProvider icon=\"file-lines\" size={0.875} className=\"text-text-tertiary\" />\n </div>\n <div\n ref={filesContainerRef}\n className={classNames('flex min-w-0 flex-1 items-center gap-3 overflow-x-auto scrollbar-hide')}\n >\n {fileItems}\n </div>\n </div>\n )\n }\n\n return (\n <Accordion\n value={expanded ? ['files'] : []}\n onValueChange={(v) => setExpanded(v.includes('files'))}\n className=\"my-2 rounded-lg border border-border-default dark:border-border-default\"\n >\n <AccordionItem value=\"files\" className=\"border-0\">\n <AccordionTrigger className=\"bg-background-brand rounded-t-lg flex-row-reverse gap-2 px-3 py-2 hover:bg-background-brand hover:no-underline\">\n <div className=\"flex items-center gap-2 pl-2\">\n <IconProvider icon=\"file-lines\" size={0.75} className=\"shrink-0 text-text-brand\" />\n <span className=\"text-xs font-medium text-text-brand\">{files.length} files generated</span>\n </div>\n </AccordionTrigger>\n <AccordionContent className=\"px-3 py-2\">\n <div\n ref={filesContainerRef}\n className={classNames('flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-2 py-1')}\n >\n {fileItems}\n </div>\n </AccordionContent>\n </AccordionItem>\n </Accordion>\n )\n}\n\nexport default ChatFileDownload\n","export type SandboxArtifactFile = {\n name: string\n path: string\n}\n\nconst PREFIX = 'sandbox_artifacts'\n\n/**\n * Matches `[name](path)` pairs in order (markdown link shape). Assumes `name` contains no `]`\n * and `path` contains no `)`. Revisit if real artifact paths can contain `)`.\n */\nconst PAIR_RE = /\\[([^\\]]*)\\]\\(([^)]*)\\)/g\n\n/**\n * Parses a `sandbox_artifacts` fence body into an ordered list of `{ name, path }` files.\n *\n * Expected lines look like `[add.py](/tmp/add.py)`; multiple entries may be separated by newlines.\n * The optional leading `sandbox_artifacts` literal is stripped before pair extraction for\n * backwards compatibility with inline `sandbox_artifacts[...](...)...` bodies.\n *\n * Pairs with empty `name` or empty `path` are dropped, which also ignores incomplete trailing\n * tokens like `[a]` without a following `(...)`.\n */\nexport function parseSandboxArtifacts(content: string): SandboxArtifactFile[] {\n const trimmed = content.trim()\n const body = trimmed.startsWith(PREFIX) ? trimmed.slice(PREFIX.length).trimStart() : trimmed\n\n const files: SandboxArtifactFile[] = []\n PAIR_RE.lastIndex = 0\n let match: RegExpExecArray | null = PAIR_RE.exec(body)\n while (match !== null) {\n const name = match[1].trim()\n const path = match[2].trim()\n if (name && path) {\n files.push({ name, path })\n }\n match = PAIR_RE.exec(body)\n }\n\n return files\n}\n","import React, { useMemo } from 'react'\n\nimport ChatFileDownload from './ChatFileDownload'\nimport type { FencedCodeBlockProps } from './codeFencing'\nimport { parseSandboxArtifacts } from './parseSandboxArtifacts'\n\n/**\n * Renders ```sandbox_artifacts ... ``` fences as a `ChatFileDownload` list.\n * Fence body: one `[filename](path)` markdown-link pair per line (or inline), e.g. `[add.py](/tmp/add.py)`.\n * Parsing is memoised on `content` so streaming updates only re-parse when content changes.\n */\nconst SandboxArtifactsFenceBlock: React.FC<FencedCodeBlockProps> = ({\n content,\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n}) => {\n const files = useMemo(() => parseSandboxArtifacts(content), [content])\n\n if (files.length === 0) {\n return null\n }\n\n return (\n <ChatFileDownload\n files={files}\n fileDownloadBaseUrl={fileDownloadBaseUrl}\n readOnly={readOnly}\n readOnlyTooltip={readOnlyTooltip}\n onDownloadArtifact={onDownloadArtifact}\n onDownloadFile={onDownloadFile}\n />\n )\n}\n\nexport default SandboxArtifactsFenceBlock\n","import React, { lazy, Suspense, useMemo } from 'react'\n\nimport Spinner from '@/components/atoms/Spinner'\n\nimport MarkdownLazy, { type FencedCodeBlockProps, type MarkdownProps } from './MarkdownLazy'\nimport SandboxArtifactsFenceBlock from './SandboxArtifactsFenceBlock'\n\nexport type MarkdownWithOpenUIProps = Omit<MarkdownProps, 'codeFencingConfig'> & {\n /** Forwarded into the OpenUI fence block (e.g. streaming assistant output). */\n isStreaming?: boolean\n /** Base URL for resolving sandbox artifact download paths (e.g. gateway file endpoint). */\n fileDownloadBaseUrl?: string\n /** When true, download actions in sandbox artifact blocks are hidden/disabled. */\n readOnly?: boolean\n /** Tooltip shown when `readOnly` disables a download action. */\n readOnlyTooltip?: string\n /** Custom download handler that receives the original sandbox artifact path. */\n onDownloadArtifact?: (path: string, filename: string) => Promise<void>\n /**\n * Custom download handler forwarded to sandbox artifact blocks.\n * Receives the resolved URL and suggested filename.\n */\n onDownloadFile?: (url: string, filename: string) => Promise<void>\n}\n\n/**\n * Same module as the lazy OpenUI fence block; call to preload OpenUI (react-lang, react-ui, CSS)\n * before markdown is known to contain ```openui fences — e.g. when opening the playground chat.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const preloadMarkdownOpenUI = (): Promise<{ default: React.ComponentType<any> }> => import('./OpenUiFenceBlock')\n\nconst OpenUiFenceBlockLazy = lazy(preloadMarkdownOpenUI)\n\nconst SuspensedOpenUiFenceBlock: React.FC<FencedCodeBlockProps> = (props) => {\n return (\n <Suspense fallback={<Spinner small center />}>\n <OpenUiFenceBlockLazy {...props} />\n </Suspense>\n )\n}\n\n/**\n * Markdown with optional OpenUI fenced blocks (` ```openui `).\n * OpenUI dependencies load only when the markdown string contains such a fence, or when\n * {@link preloadMarkdownOpenUI} has been called earlier.\n */\nexport const MarkdownWithOpenUI: React.FC<MarkdownWithOpenUIProps> = (props) => {\n const {\n isStreaming,\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n ...markdownProps\n } = props\n const codeFencingConfig = useMemo(\n () => ({\n openui: {\n Component: SuspensedOpenUiFenceBlock,\n componentProps: { isStreaming },\n },\n sandbox_artifacts: {\n Component: SandboxArtifactsFenceBlock,\n componentProps: {\n fileDownloadBaseUrl,\n readOnly,\n readOnlyTooltip,\n onDownloadArtifact,\n onDownloadFile,\n },\n },\n }),\n [fileDownloadBaseUrl, isStreaming, readOnly, readOnlyTooltip, onDownloadArtifact, onDownloadFile],\n )\n return <MarkdownLazy {...markdownProps} codeFencingConfig={codeFencingConfig} />\n}\n\nexport default MarkdownWithOpenUI\n"],"names":["segments","last"],"mappings":";;;;;;;;AAEO,SAAS,gBAA8C,SAAwC;AACpG,QAAM,YAAY,KAAK,OAAO;AAC9B,YAAU,UAAU;AACpB,SAAO;AACT;ACGA,MAAM,WAAW,gBAAgB,MA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AAQ,MAAM,sBAAsB,OAAO,GAAG,CAAC,OAAO,CAAC;AAErE,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO;AAAA,EACT;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAAA;AAGN;ACLO,MAAM,wBAAwB,MAAsD,OAAO,oCAAoB;AAEtH,MAAM,uBAAuB,KAAK,qBAAqB;AAEvD,MAAM,4BAA4D,CAAC,UAAU;AAC3E,SACE,oBAAC,UAAA,EAAS,UAAU,oBAAC,WAAQ,OAAK,MAAC,QAAM,KAAA,CAAC,GACxC,UAAA,oBAAC,sBAAA,EAAsB,GAAG,OAAO,GACnC;AAEJ;AAOO,MAAM,qBAAwD,CAAC,UAAU;AAC9E,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EAAA,IACD;AACJ,QAAM,oBAAoB;AAAA,IACxB,OAAO;AAAA,MACL,QAAQ;AAAA,QACN,WAAW;AAAA,QACX,gBAAgB,EAAE,YAAA;AAAA,MAAY;AAAA,MAEhC,mBAAmB;AAAA,QACjB,WAAW;AAAA,QACX,gBAAgB;AAAA,UACd;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QAAA;AAAA,MACF;AAAA,IACF;AAAA,IAEF,CAAC,qBAAqB,aAAa,UAAU,iBAAiB,oBAAoB,cAAc;AAAA,EAAA;AAElG,SAAO,oBAAC,cAAA,EAAc,GAAG,eAAe,kBAAA,CAAsC;AAChF;"}
@@ -4,12 +4,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
4
4
  import { jsxs, jsx } from "react/jsx-runtime";
5
5
  import { useRef, useEffect, useMemo, useContext, createContext, lazy, useState, useCallback, Suspense } from "react";
6
6
  import { createPortal } from "react-dom";
7
- import { B as Button } from "../../Button-CHzl5RaT.js";
7
+ import { B as Button } from "../../Button-CPJYHldw.js";
8
8
  import Spinner from "../atoms/Spinner.es.js";
9
9
  import { useTheme } from "../theme/useTheme.es.js";
10
10
  import { c as classNames } from "../../classNames-B1XpQHle.js";
11
11
  import { t as toDataTestId } from "../../conversions-CbWPvHRE.js";
12
- import { C as CopyField } from "../../Input-WdhMjVoF.js";
12
+ import { C as CopyField } from "../../Input-Dcxu6SVO.js";
13
13
  import { CustomDrawerContext } from "./CustomDrawer.es.js";
14
14
  import Dialog from "./Dialog.es.js";
15
15
  import notify from "./Notify.es.js";
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import { c as cva } from "../../index-DSVg79g-.js";
4
- import { B as Button } from "../../Button-CHzl5RaT.js";
4
+ import { B as Button } from "../../Button-CPJYHldw.js";
5
5
  import IconProvider from "../atoms/IconProvider.es.js";
6
- import { D as DarkTooltip } from "../../Tooltip-D5E-qGtP.js";
6
+ import { D as DarkTooltip } from "../../Tooltip-uQIVdskf.js";
7
7
  import { c as classNames } from "../../classNames-B1XpQHle.js";
8
8
  const segmentedControlVariants = cva("inline-flex rounded-md border border-border-default bg-background-sunken p-0.5", {
9
9
  variants: {
@@ -3,10 +3,10 @@ import { c as classNames } from "../../classNames-B1XpQHle.js";
3
3
  import { t as toDataTestId } from "../../conversions-CbWPvHRE.js";
4
4
  import IconProvider from "../atoms/IconProvider.es.js";
5
5
  import Spinner from "../atoms/Spinner.es.js";
6
- import { B as Button } from "../../Button-CHzl5RaT.js";
6
+ import { B as Button } from "../../Button-CPJYHldw.js";
7
7
  import IconButton from "../atoms/IconButton.es.js";
8
8
  import OutlinedRadio from "../atoms/OutlinedRadio.es.js";
9
- import { I as Input, M as Markdown } from "../../Input-WdhMjVoF.js";
9
+ import { I as Input, M as Markdown } from "../../Input-Dcxu6SVO.js";
10
10
  import Badge from "../atoms/Badge.es.js";
11
11
  import { default as default2 } from "./agent-chat/UserMessage.es.js";
12
12
  import { default as default3 } from "./agent-chat/UserMessageEdit.es.js";
@@ -1,4 +1,4 @@
1
- import { w as getComputedStyle } from "./useBaseUiId-Ch7ujXpo.js";
1
+ import { w as getComputedStyle } from "./useBaseUiId-CmLtG9DS.js";
2
2
  function isIndexOutOfListBounds(list, index) {
3
3
  return index < 0 || index >= list.length;
4
4
  }
@@ -63,4 +63,4 @@ export {
63
63
  getMinListIndex as g,
64
64
  isElementVisible as i
65
65
  };
66
- //# sourceMappingURL=composite-DCpXNxz9.js.map
66
+ //# sourceMappingURL=composite-BL4bbAWg.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"composite-DCpXNxz9.js","sources":["../node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs"],"sourcesContent":["import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nimport { closest } from \"./element.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\n/**\n * The index one arrow step moves the highlight to from `currentIndex`, or `-1` when the step\n * leaves the list. `wrapped` reports a jump from one end of the list to the other.\n */\nexport function getNextListIndex(list, currentIndex, options) {\n const {\n decrement,\n loopFocus,\n allowEscape,\n disabledIndices,\n minIndex,\n maxIndex\n } = options;\n const step = () => findNonDisabledListIndex(list, {\n startingIndex: currentIndex,\n decrement,\n disabledIndices\n });\n let index;\n let wrapped = false;\n if (!loopFocus) {\n index = decrement ? Math.max(minIndex, step()) : Math.min(maxIndex, step());\n } else if (decrement ? currentIndex <= minIndex : currentIndex >= maxIndex) {\n // Escaping is only possible from inside the list: from outside it, a step enters at the far\n // end.\n const outside = decrement ? -1 : list.length;\n if (allowEscape && currentIndex !== outside) {\n index = -1;\n } else {\n index = decrement ? maxIndex : minIndex;\n wrapped = true;\n }\n } else {\n index = step();\n }\n return {\n index: isIndexOutOfListBounds(list, index) ? -1 : index,\n wrapped\n };\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = closest(el, '[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}"],"names":[],"mappings":";AAQO,SAAS,uBAAuB,MAAM,OAAO;AAClD,SAAO,QAAQ,KAAK,SAAS,KAAK;AACpC;AACO,SAAS,gBAAgB,SAAS,iBAAiB;AACxD,SAAO,yBAAyB,QAAQ,SAAS;AAAA,IAC/C;AAAA,EACJ,CAAG;AACH;AACO,SAAS,gBAAgB,SAAS,iBAAiB;AACxD,SAAO,yBAAyB,QAAQ,SAAS;AAAA,IAC/C,WAAW;AAAA,IACX,eAAe,QAAQ,QAAQ;AAAA,IAC/B;AAAA,EACJ,CAAG;AACH;AAyCO,SAAS,yBAAyB,MAAM;AAAA,EAC7C,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ;AAAA,EACA,SAAS;AACX,IAAI,IAAI;AACN,MAAI,QAAQ;AACZ,KAAG;AACD,aAAS,YAAY,CAAC,SAAS;AAAA,EACjC,SAAS,SAAS,KAAK,SAAS,KAAK,SAAS,KAAK,oBAAoB,MAAM,OAAO,eAAe;AACnG,SAAO;AACT;AAuUO,SAAS,oBAAoB,MAAM,OAAO,iBAAiB;AAChE,QAAM,uBAAuB,OAAO,oBAAoB,aAAa,gBAAgB,KAAK,KAAI,mDAAiB,SAAS,WAAU;AAClI,MAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AACA,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,MAAI,CAAC,iBAAiB,OAAO,GAAG;AAC9B,WAAO;AAAA,EACT;AAKA,MAAI,QAAQ,QAAQ,WAAW,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO,CAAC,oBAAoB,QAAQ,aAAa,UAAU,KAAK,QAAQ,aAAa,eAAe,MAAM;AAC5G;AACO,SAAS,iBAAiB,QAAQ;AACvC,SAAO,OAAO,eAAe,YAAY,OAAO,eAAe;AACjE;AACO,SAAS,iBAAiB,SAAS,SAAS,UAAU,iBAAiB,OAAO,IAAI,MAAM;AAC7F,MAAI,CAAC,WAAW,CAAC,QAAQ,eAAe,CAAC,UAAU,iBAAiB,MAAM,GAAG;AAC3E,WAAO;AAAA,EACT;AACA,MAAI,OAAO,QAAQ,oBAAoB,YAAY;AACjD,WAAO,QAAQ,gBAAe;AAAA,EAChC;AACA,SAAO,OAAO,YAAY,UAAU,OAAO,YAAY;AACzD;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"composite-BL4bbAWg.js","sources":["../node_modules/@base-ui/react/floating-ui-react/utils/composite.mjs"],"sourcesContent":["import { floor } from '@floating-ui/utils';\nimport { getComputedStyle } from '@floating-ui/utils/dom';\nimport { stopEvent } from \"./event.mjs\";\nimport { ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP } from \"./constants.mjs\";\nimport { closest } from \"./element.mjs\";\nexport function isDifferentGridRow(index, cols, prevRow) {\n return Math.floor(index / cols) !== prevRow;\n}\nexport function isIndexOutOfListBounds(list, index) {\n return index < 0 || index >= list.length;\n}\nexport function getMinListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n disabledIndices\n });\n}\nexport function getMaxListIndex(listRef, disabledIndices) {\n return findNonDisabledListIndex(listRef.current, {\n decrement: true,\n startingIndex: listRef.current.length,\n disabledIndices\n });\n}\n/**\n * The index one arrow step moves the highlight to from `currentIndex`, or `-1` when the step\n * leaves the list. `wrapped` reports a jump from one end of the list to the other.\n */\nexport function getNextListIndex(list, currentIndex, options) {\n const {\n decrement,\n loopFocus,\n allowEscape,\n disabledIndices,\n minIndex,\n maxIndex\n } = options;\n const step = () => findNonDisabledListIndex(list, {\n startingIndex: currentIndex,\n decrement,\n disabledIndices\n });\n let index;\n let wrapped = false;\n if (!loopFocus) {\n index = decrement ? Math.max(minIndex, step()) : Math.min(maxIndex, step());\n } else if (decrement ? currentIndex <= minIndex : currentIndex >= maxIndex) {\n // Escaping is only possible from inside the list: from outside it, a step enters at the far\n // end.\n const outside = decrement ? -1 : list.length;\n if (allowEscape && currentIndex !== outside) {\n index = -1;\n } else {\n index = decrement ? maxIndex : minIndex;\n wrapped = true;\n }\n } else {\n index = step();\n }\n return {\n index: isIndexOutOfListBounds(list, index) ? -1 : index,\n wrapped\n };\n}\nexport function findNonDisabledListIndex(list, {\n startingIndex = -1,\n decrement = false,\n disabledIndices,\n amount = 1\n} = {}) {\n let index = startingIndex;\n do {\n index += decrement ? -amount : amount;\n } while (index >= 0 && index <= list.length - 1 && isListIndexDisabled(list, index, disabledIndices));\n return index;\n}\nexport function getGridNavigatedIndex(list, {\n event,\n orientation,\n loopFocus,\n onLoop,\n rtl,\n cols,\n disabledIndices,\n minIndex,\n maxIndex,\n prevIndex,\n stopEvent: stop = false\n}) {\n let nextIndex = prevIndex;\n let verticalDirection;\n if (event.key === ARROW_UP) {\n verticalDirection = 'up';\n } else if (event.key === ARROW_DOWN) {\n verticalDirection = 'down';\n }\n if (verticalDirection) {\n // -------------------------------------------------------------------------\n // Detect row structure only when handling vertical navigation. This keeps\n // the non-vertical key paths free from row inference work.\n // -------------------------------------------------------------------------\n const rows = [];\n const rowIndexMap = [];\n let hasRoleRow = false;\n let visibleItemCount = 0;\n {\n let currentRowEl = null;\n let currentRowIndex = -1;\n list.forEach((el, idx) => {\n if (el == null) {\n return;\n }\n visibleItemCount += 1;\n const rowEl = closest(el, '[role=\"row\"]');\n if (rowEl) {\n hasRoleRow = true;\n }\n if (rowEl !== currentRowEl || currentRowIndex === -1) {\n currentRowEl = rowEl;\n currentRowIndex += 1;\n rows[currentRowIndex] = [];\n }\n rows[currentRowIndex].push(idx);\n rowIndexMap[idx] = currentRowIndex;\n });\n }\n let hasDomRows = false;\n let inferredDomCols = 0;\n if (hasRoleRow) {\n for (const row of rows) {\n const rowLength = row.length;\n if (rowLength > inferredDomCols) {\n inferredDomCols = rowLength;\n }\n if (rowLength !== cols) {\n hasDomRows = true;\n }\n }\n }\n const hasVirtualizedGaps = hasDomRows && visibleItemCount < list.length;\n const verticalCols = inferredDomCols || cols;\n const navigateVertically = direction => {\n if (!hasDomRows || prevIndex === -1) {\n return undefined;\n }\n const currentRow = rowIndexMap[prevIndex];\n if (currentRow == null) {\n return undefined;\n }\n const colInRow = rows[currentRow].indexOf(prevIndex);\n const step = direction === 'up' ? -1 : 1;\n for (let nextRow = currentRow + step, i = 0; i < rows.length; i += 1, nextRow += step) {\n if (nextRow < 0 || nextRow >= rows.length) {\n if (!loopFocus || hasVirtualizedGaps) {\n return undefined;\n }\n nextRow = nextRow < 0 ? rows.length - 1 : 0;\n if (onLoop) {\n const clampedCol = Math.min(colInRow, rows[nextRow].length - 1);\n const targetItemIndex = rows[nextRow][clampedCol] ?? rows[nextRow][0];\n const returnedItemIndex = onLoop(event, prevIndex, targetItemIndex);\n nextRow = rowIndexMap[returnedItemIndex] ?? nextRow;\n }\n }\n const targetRow = rows[nextRow];\n for (let col = Math.min(colInRow, targetRow.length - 1); col >= 0; col -= 1) {\n const candidate = targetRow[col];\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n const navigateVerticallyWithInferredRows = direction => {\n if (!hasVirtualizedGaps || prevIndex === -1) {\n return undefined;\n }\n const colInRow = prevIndex % verticalCols;\n const rowStep = direction === 'up' ? -verticalCols : verticalCols;\n const lastRowStart = maxIndex - maxIndex % verticalCols;\n const rowCount = floor(maxIndex / verticalCols) + 1;\n for (let rowStart = prevIndex - colInRow + rowStep, i = 0; i < rowCount; i += 1, rowStart += rowStep) {\n if (rowStart < 0 || rowStart > maxIndex) {\n if (!loopFocus) {\n return undefined;\n }\n rowStart = rowStart < 0 ? lastRowStart : 0;\n }\n const rowEnd = Math.min(rowStart + verticalCols - 1, maxIndex);\n for (let candidate = Math.min(rowStart + colInRow, rowEnd); candidate >= rowStart; candidate -= 1) {\n if (!isListIndexDisabled(list, candidate, disabledIndices)) {\n return candidate;\n }\n }\n }\n return undefined;\n };\n if (stop) {\n stopEvent(event);\n }\n const verticalCandidate = navigateVertically(verticalDirection) ?? navigateVerticallyWithInferredRows(verticalDirection);\n if (verticalCandidate !== undefined) {\n nextIndex = verticalCandidate;\n } else if (prevIndex === -1) {\n nextIndex = verticalDirection === 'up' ? maxIndex : minIndex;\n } else {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n amount: verticalCols,\n decrement: verticalDirection === 'up',\n disabledIndices\n });\n if (loopFocus) {\n if (verticalDirection === 'up' && (prevIndex - verticalCols < minIndex || nextIndex < 0)) {\n const col = prevIndex % verticalCols;\n const maxCol = maxIndex % verticalCols;\n const offset = maxIndex - (maxCol - col);\n if (maxCol === col) {\n nextIndex = maxIndex;\n } else {\n nextIndex = maxCol > col ? offset : offset - verticalCols;\n }\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (verticalDirection === 'down' && prevIndex + verticalCols > maxIndex) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex % verticalCols - verticalCols,\n amount: verticalCols,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n }\n }\n if (isIndexOutOfListBounds(list, nextIndex)) {\n nextIndex = prevIndex;\n }\n }\n\n // Remains on the same row/column.\n if (orientation === 'both') {\n const prevRow = floor(prevIndex / cols);\n if (event.key === (rtl ? ARROW_LEFT : ARROW_RIGHT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== cols - 1) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n if (event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT)) {\n if (stop) {\n stopEvent(event);\n }\n if (prevIndex % cols !== 0) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex,\n decrement: true,\n disabledIndices\n });\n if (loopFocus && isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n } else if (loopFocus) {\n nextIndex = findNonDisabledListIndex(list, {\n startingIndex: prevIndex + (cols - prevIndex % cols),\n decrement: true,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n }\n if (isDifferentGridRow(nextIndex, cols, prevRow)) {\n nextIndex = prevIndex;\n }\n }\n const lastRow = floor(maxIndex / cols) === prevRow;\n if (isIndexOutOfListBounds(list, nextIndex)) {\n if (loopFocus && lastRow) {\n nextIndex = event.key === (rtl ? ARROW_RIGHT : ARROW_LEFT) ? maxIndex : findNonDisabledListIndex(list, {\n startingIndex: prevIndex - prevIndex % cols - 1,\n disabledIndices\n });\n if (onLoop) {\n nextIndex = onLoop(event, prevIndex, nextIndex);\n }\n } else {\n nextIndex = prevIndex;\n }\n }\n }\n return nextIndex;\n}\n\n/** For each cell index, gets the item index that occupies that cell */\nexport function createGridCellMap(sizes, cols, dense) {\n const cellMap = [];\n let startIndex = 0;\n sizes.forEach(({\n width,\n height\n }, index) => {\n if (width > cols) {\n if (process.env.NODE_ENV !== 'production') {\n // TODO: fix mui/no-guarded-throw\n // eslint-disable-next-line mui/no-guarded-throw\n throw new Error(`[Floating UI]: Invalid grid - item width at index ${index} is greater than grid columns`);\n }\n }\n let itemPlaced = false;\n if (dense) {\n startIndex = 0;\n }\n while (!itemPlaced) {\n const targetCells = [];\n for (let i = 0; i < width; i += 1) {\n for (let j = 0; j < height; j += 1) {\n targetCells.push(startIndex + i + j * cols);\n }\n }\n if (startIndex % cols + width <= cols && targetCells.every(cell => cellMap[cell] == null)) {\n targetCells.forEach(cell => {\n cellMap[cell] = index;\n });\n itemPlaced = true;\n } else {\n startIndex += 1;\n }\n }\n });\n\n // convert into a non-sparse array\n return [...cellMap];\n}\n\n/** Gets cell index of an item's corner or -1 when index is -1. */\nexport function getGridCellIndexOfCorner(index, sizes, cellMap, cols, corner) {\n if (index === -1) {\n return -1;\n }\n const firstCellIndex = cellMap.indexOf(index);\n const sizeItem = sizes[index];\n switch (corner) {\n case 'tl':\n return firstCellIndex;\n case 'tr':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + sizeItem.width - 1;\n case 'bl':\n if (!sizeItem) {\n return firstCellIndex;\n }\n return firstCellIndex + (sizeItem.height - 1) * cols;\n case 'br':\n return cellMap.lastIndexOf(index);\n default:\n return -1;\n }\n}\n\n/** Gets all cell indices that correspond to the specified indices */\nexport function getGridCellIndices(indices, cellMap) {\n return cellMap.flatMap((index, cellIndex) => indices.includes(index) ? [cellIndex] : []);\n}\nexport function isListIndexDisabled(list, index, disabledIndices) {\n const isExplicitlyDisabled = typeof disabledIndices === 'function' ? disabledIndices(index) : disabledIndices?.includes(index) ?? false;\n if (isExplicitlyDisabled) {\n return true;\n }\n const element = list[index];\n if (!element) {\n return false;\n }\n if (!isElementVisible(element)) {\n return true;\n }\n\n // A natively disabled element can never receive focus, so it must always be\n // skipped, even when `disabledIndices` marks it as enabled. Only\n // `aria-disabled` items can be focusable-while-disabled.\n if (element.matches(':disabled')) {\n return true;\n }\n return !disabledIndices && (element.hasAttribute('disabled') || element.getAttribute('aria-disabled') === 'true');\n}\nexport function isHiddenByStyles(styles) {\n return styles.visibility === 'hidden' || styles.visibility === 'collapse';\n}\nexport function isElementVisible(element, styles = element ? getComputedStyle(element) : null) {\n if (!element || !element.isConnected || !styles || isHiddenByStyles(styles)) {\n return false;\n }\n if (typeof element.checkVisibility === 'function') {\n return element.checkVisibility();\n }\n return styles.display !== 'none' && styles.display !== 'contents';\n}"],"names":[],"mappings":";AAQO,SAAS,uBAAuB,MAAM,OAAO;AAClD,SAAO,QAAQ,KAAK,SAAS,KAAK;AACpC;AACO,SAAS,gBAAgB,SAAS,iBAAiB;AACxD,SAAO,yBAAyB,QAAQ,SAAS;AAAA,IAC/C;AAAA,EACJ,CAAG;AACH;AACO,SAAS,gBAAgB,SAAS,iBAAiB;AACxD,SAAO,yBAAyB,QAAQ,SAAS;AAAA,IAC/C,WAAW;AAAA,IACX,eAAe,QAAQ,QAAQ;AAAA,IAC/B;AAAA,EACJ,CAAG;AACH;AAyCO,SAAS,yBAAyB,MAAM;AAAA,EAC7C,gBAAgB;AAAA,EAChB,YAAY;AAAA,EACZ;AAAA,EACA,SAAS;AACX,IAAI,IAAI;AACN,MAAI,QAAQ;AACZ,KAAG;AACD,aAAS,YAAY,CAAC,SAAS;AAAA,EACjC,SAAS,SAAS,KAAK,SAAS,KAAK,SAAS,KAAK,oBAAoB,MAAM,OAAO,eAAe;AACnG,SAAO;AACT;AAuUO,SAAS,oBAAoB,MAAM,OAAO,iBAAiB;AAChE,QAAM,uBAAuB,OAAO,oBAAoB,aAAa,gBAAgB,KAAK,KAAI,mDAAiB,SAAS,WAAU;AAClI,MAAI,sBAAsB;AACxB,WAAO;AAAA,EACT;AACA,QAAM,UAAU,KAAK,KAAK;AAC1B,MAAI,CAAC,SAAS;AACZ,WAAO;AAAA,EACT;AACA,MAAI,CAAC,iBAAiB,OAAO,GAAG;AAC9B,WAAO;AAAA,EACT;AAKA,MAAI,QAAQ,QAAQ,WAAW,GAAG;AAChC,WAAO;AAAA,EACT;AACA,SAAO,CAAC,oBAAoB,QAAQ,aAAa,UAAU,KAAK,QAAQ,aAAa,eAAe,MAAM;AAC5G;AACO,SAAS,iBAAiB,QAAQ;AACvC,SAAO,OAAO,eAAe,YAAY,OAAO,eAAe;AACjE;AACO,SAAS,iBAAiB,SAAS,SAAS,UAAU,iBAAiB,OAAO,IAAI,MAAM;AAC7F,MAAI,CAAC,WAAW,CAAC,QAAQ,eAAe,CAAC,UAAU,iBAAiB,MAAM,GAAG;AAC3E,WAAO;AAAA,EACT;AACA,MAAI,OAAO,QAAQ,oBAAoB,YAAY;AACjD,WAAO,QAAQ,gBAAe;AAAA,EAChC;AACA,SAAO,OAAO,YAAY,UAAU,OAAO,YAAY;AACzD;","x_google_ignoreList":[0]}
@@ -1,4 +1,4 @@
1
- import { j as isHTMLElement } from "./useBaseUiId-Ch7ujXpo.js";
1
+ import { j as isHTMLElement } from "./useBaseUiId-CmLtG9DS.js";
2
2
  const ARROW_UP = "ArrowUp";
3
3
  const ARROW_DOWN = "ArrowDown";
4
4
  const ARROW_LEFT = "ArrowLeft";
@@ -105,4 +105,4 @@ export {
105
105
  isNativeInput as i,
106
106
  scrollIntoViewIfNeeded as s
107
107
  };
108
- //# sourceMappingURL=composite-CrCQWAKA.js.map
108
+ //# sourceMappingURL=composite-C22yiNy1.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"composite-CrCQWAKA.js","sources":["../node_modules/@base-ui/react/internals/composite/composite.mjs"],"sourcesContent":["import { isHTMLElement } from '@floating-ui/utils/dom';\nexport { stopEvent, isIndexOutOfListBounds, isListIndexDisabled, findNonDisabledListIndex, getMaxListIndex, getMinListIndex } from \"../../floating-ui-react/utils.mjs\";\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const HOME = 'Home';\nexport const END = 'End';\nexport const PAGE_UP = 'PageUp';\nexport const PAGE_DOWN = 'PageDown';\nexport const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);\nexport const SHIFT = 'Shift';\nexport const MODIFIER_KEYS = [SHIFT, 'Control', 'Alt', 'Meta'];\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName === 'INPUT';\n}\nexport function isNativeInput(element) {\n if (isInputElement(element) && element.selectionStart != null) {\n return true;\n }\n if (isHTMLElement(element) && element.tagName === 'TEXTAREA') {\n return true;\n }\n return false;\n}\nexport function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {\n if (!scrollContainer || !element || !element.scrollTo) {\n return;\n }\n let targetX = scrollContainer.scrollLeft;\n let targetY = scrollContainer.scrollTop;\n const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;\n const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;\n if (isOverflowingX && orientation !== 'vertical') {\n const elementOffsetLeft = getOffset(scrollContainer, element, 'left');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (direction === 'ltr') {\n if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n }\n }\n if (direction === 'rtl') {\n if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n }\n }\n }\n if (isOverflowingY && orientation !== 'horizontal') {\n const elementOffsetTop = getOffset(scrollContainer, element, 'top');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {\n // overflow upwards, align top edges\n targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;\n } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {\n // overflow downwards, align bottom edges\n targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;\n }\n }\n scrollContainer.scrollTo({\n left: targetX,\n top: targetY,\n behavior: 'auto'\n });\n}\nfunction getOffset(ancestor, element, side) {\n const propName = side === 'left' ? 'offsetLeft' : 'offsetTop';\n let result = 0;\n while (element.offsetParent) {\n result += element[propName];\n if (element.offsetParent === ancestor) {\n break;\n }\n element = element.offsetParent;\n }\n return result;\n}\nfunction getStyles(element) {\n const styles = getComputedStyle(element);\n return {\n scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,\n scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,\n scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,\n scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,\n scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,\n scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,\n scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,\n scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0\n };\n}"],"names":[],"mappings":";AAEY,MAAC,WAAW;AACZ,MAAC,aAAa;AACd,MAAC,aAAa;AACd,MAAC,cAAc;AACf,MAAC,OAAO;AACR,MAAC,MAAM;AACP,MAAC,UAAU;AACX,MAAC,YAAY;AACb,MAAC,iBAAiB,oBAAI,IAAI,CAAC,UAAU,YAAY,YAAY,aAAa,MAAM,GAAG,CAAC;AACpF,MAAC,QAAQ;AACT,MAAC,gBAAgB,CAAC,OAAO,WAAW,OAAO,MAAM;AAC7D,SAAS,eAAe,SAAS;AAC/B,SAAO,cAAc,OAAO,KAAK,QAAQ,YAAY;AACvD;AACO,SAAS,cAAc,SAAS;AACrC,MAAI,eAAe,OAAO,KAAK,QAAQ,kBAAkB,MAAM;AAC7D,WAAO;AAAA,EACT;AACA,MAAI,cAAc,OAAO,KAAK,QAAQ,YAAY,YAAY;AAC5D,WAAO;AAAA,EACT;AACA,SAAO;AACT;AACO,SAAS,uBAAuB,iBAAiB,SAAS,WAAW,aAAa;AACvF,MAAI,CAAC,mBAAmB,CAAC,WAAW,CAAC,QAAQ,UAAU;AACrD;AAAA,EACF;AACA,MAAI,UAAU,gBAAgB;AAC9B,MAAI,UAAU,gBAAgB;AAC9B,QAAM,iBAAiB,gBAAgB,cAAc,gBAAgB;AACrE,QAAM,iBAAiB,gBAAgB,eAAe,gBAAgB;AACtE,MAAI,kBAAkB,gBAAgB,YAAY;AAChD,UAAM,oBAAoB,UAAU,iBAAiB,SAAS,MAAM;AACpE,UAAM,kBAAkB,UAAU,eAAe;AACjD,UAAM,gBAAgB,UAAU,OAAO;AACvC,QAAI,cAAc,OAAO;AACvB,UAAI,oBAAoB,QAAQ,cAAc,cAAc,oBAAoB,gBAAgB,aAAa,gBAAgB,cAAc,gBAAgB,oBAA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U,QAAQ,QAAQ;AAC1B,QAAI,QAAQ,iBAAiB,UAAU;AACrC;AAAA,IACF;AACA,cAAU,QAAQ;AAAA,EACpB;AACA,SAAO;AACT;AACA,SAAS,UAAU,SAAS;AAC1B,QAAM,SAAS,iBAAiB,OAAO;AACvC,SAAO;AAAA,IACL,iBAAiB,WAAW,OAAO,eAAe,KAAK;AAAA,IACvD,mBAAmB,WAAW,OAAO,iBAAiB,KAAK;AAAA,IAC3D,oBAAoB,WAAW,OAAO,kBAAkB,KAAK;AAAA,IAC7D,kBAAkB,WAAW,OAAO,gBAAgB,KAAK;AAAA,IACzD,kBAAkB,WAAW,OAAO,gBAAgB,KAAK;AAAA,IACzD,oBAAoB,WAAW,OAAO,kBAAkB,KAAK;AAAA,IAC7D,qBAAqB,WAAW,OAAO,mBAAmB,KAAK;AAAA,IAC/D,mBAAmB,WAAW,OAAO,iBAAiB,KAAK;AAAA,EAC/D;AACA;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"composite-C22yiNy1.js","sources":["../node_modules/@base-ui/react/internals/composite/composite.mjs"],"sourcesContent":["import { isHTMLElement } from '@floating-ui/utils/dom';\nexport { stopEvent, isIndexOutOfListBounds, isListIndexDisabled, findNonDisabledListIndex, getMaxListIndex, getMinListIndex } from \"../../floating-ui-react/utils.mjs\";\nexport const ARROW_UP = 'ArrowUp';\nexport const ARROW_DOWN = 'ArrowDown';\nexport const ARROW_LEFT = 'ArrowLeft';\nexport const ARROW_RIGHT = 'ArrowRight';\nexport const HOME = 'Home';\nexport const END = 'End';\nexport const PAGE_UP = 'PageUp';\nexport const PAGE_DOWN = 'PageDown';\nexport const COMPOSITE_KEYS = new Set([ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, HOME, END]);\nexport const SHIFT = 'Shift';\nexport const MODIFIER_KEYS = [SHIFT, 'Control', 'Alt', 'Meta'];\nfunction isInputElement(element) {\n return isHTMLElement(element) && element.tagName === 'INPUT';\n}\nexport function isNativeInput(element) {\n if (isInputElement(element) && element.selectionStart != null) {\n return true;\n }\n if (isHTMLElement(element) && element.tagName === 'TEXTAREA') {\n return true;\n }\n return false;\n}\nexport function scrollIntoViewIfNeeded(scrollContainer, element, direction, orientation) {\n if (!scrollContainer || !element || !element.scrollTo) {\n return;\n }\n let targetX = scrollContainer.scrollLeft;\n let targetY = scrollContainer.scrollTop;\n const isOverflowingX = scrollContainer.clientWidth < scrollContainer.scrollWidth;\n const isOverflowingY = scrollContainer.clientHeight < scrollContainer.scrollHeight;\n if (isOverflowingX && orientation !== 'vertical') {\n const elementOffsetLeft = getOffset(scrollContainer, element, 'left');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (direction === 'ltr') {\n if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n } else if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n }\n }\n if (direction === 'rtl') {\n if (elementOffsetLeft - elementStyles.scrollMarginLeft < scrollContainer.scrollLeft + containerStyles.scrollPaddingLeft) {\n // overflow to the left, scroll to align left edges\n targetX = elementOffsetLeft - elementStyles.scrollMarginLeft - containerStyles.scrollPaddingLeft;\n } else if (elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight > scrollContainer.scrollLeft + scrollContainer.clientWidth - containerStyles.scrollPaddingRight) {\n // overflow to the right, scroll to align right edges\n targetX = elementOffsetLeft + element.offsetWidth + elementStyles.scrollMarginRight - scrollContainer.clientWidth + containerStyles.scrollPaddingRight;\n }\n }\n }\n if (isOverflowingY && orientation !== 'horizontal') {\n const elementOffsetTop = getOffset(scrollContainer, element, 'top');\n const containerStyles = getStyles(scrollContainer);\n const elementStyles = getStyles(element);\n if (elementOffsetTop - elementStyles.scrollMarginTop < scrollContainer.scrollTop + containerStyles.scrollPaddingTop) {\n // overflow upwards, align top edges\n targetY = elementOffsetTop - elementStyles.scrollMarginTop - containerStyles.scrollPaddingTop;\n } else if (elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom > scrollContainer.scrollTop + scrollContainer.clientHeight - containerStyles.scrollPaddingBottom) {\n // overflow downwards, align bottom edges\n targetY = elementOffsetTop + element.offsetHeight + elementStyles.scrollMarginBottom - scrollContainer.clientHeight + containerStyles.scrollPaddingBottom;\n }\n }\n scrollContainer.scrollTo({\n left: targetX,\n top: targetY,\n behavior: 'auto'\n });\n}\nfunction getOffset(ancestor, element, side) {\n const propName = side === 'left' ? 'offsetLeft' : 'offsetTop';\n let result = 0;\n while (element.offsetParent) {\n result += element[propName];\n if (element.offsetParent === ancestor) {\n break;\n }\n element = element.offsetParent;\n }\n return result;\n}\nfunction getStyles(element) {\n const styles = getComputedStyle(element);\n return {\n scrollMarginTop: parseFloat(styles.scrollMarginTop) || 0,\n scrollMarginRight: parseFloat(styles.scrollMarginRight) || 0,\n scrollMarginBottom: parseFloat(styles.scrollMarginBottom) || 0,\n scrollMarginLeft: parseFloat(styles.scrollMarginLeft) || 0,\n scrollPaddingTop: parseFloat(styles.scrollPaddingTop) || 0,\n scrollPaddingRight: parseFloat(styles.scrollPaddingRight) || 0,\n scrollPaddingBottom: parseFloat(styles.scrollPaddingBottom) || 0,\n scrollPaddingLeft: parseFloat(styles.scrollPaddingLeft) || 0\n };\n}"],"names":[],"mappings":";AAEY,MAAC,WAAW;AACZ,MAAC,aAAa;AACd,MAAC,aAAa;AACd,MAAC,cAAc;AACf,MAAC,OAAO;AACR,MAAC,MAAM;AACP,MAAC,UAAU;AACX,MAAC,YAAY;AACb,MAAC,iBAAiB,oBAAI,IAAI,CAAC,UAAU,YAA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W,OAAO,gBAAgB,KAAK;AAAA,IACzD,kBAAkB,WAAW,OAAO,gBAAgB,KAAK;AAAA,IACzD,oBAAoB,WAAW,OAAO,kBAAkB,KAAK;AAAA,IAC7D,qBAAqB,WAAW,OAAO,mBAAmB,KAAK;AAAA,IAC/D,mBAAmB,WAAW,OAAO,iBAAiB,KAAK;AAAA,EAC/D;AACA;","x_google_ignoreList":[0]}
@@ -1,5 +1,5 @@
1
- import { j as isHTMLElement, p as isElement } from "./useBaseUiId-Ch7ujXpo.js";
2
- import { c as contains, b as closest } from "./shadowDom-Bq4g0Qeu.js";
1
+ import { j as isHTMLElement, p as isElement } from "./useBaseUiId-CmLtG9DS.js";
2
+ import { c as contains, b as closest } from "./shadowDom-BfewIqRj.js";
3
3
  import React__default from "react";
4
4
  function ownerDocument(node) {
5
5
  return (node == null ? void 0 : node.ownerDocument) || document;
@@ -254,4 +254,4 @@ export {
254
254
  shimExports as s,
255
255
  triggerDisabled as t
256
256
  };
257
- //# sourceMappingURL=index-B806bfA-.js.map
257
+ //# sourceMappingURL=index-C-2yrwZl.js.map