@oomol-lab/open-flow 0.1.0-beta.76 → 0.1.0-beta.77

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 (71) hide show
  1. package/README.md +1 -0
  2. package/dist/browser/{ContentIcon-Cm1hbVzW.js → ContentIcon-VZQO8VZU.js} +8 -5
  3. package/dist/browser/{FlowCanvas-NzKtla_c.js → FlowCanvas-BNGDMaWr.js} +15 -3
  4. package/dist/browser/{createResourceDialog-BgdedQqu.js → createResourceDialog-BmtakfVg.js} +63 -57
  5. package/dist/browser/{dialog-aSElFFw2.js → dialog-BcFBfRB1.js} +84 -15
  6. package/dist/browser/{exportSvg-Dcz4HTo_.js → exportSvg-CG8hEUNk.js} +2 -2
  7. package/dist/browser/{flowChanges-NZyS7HSp.js → flowChanges-BGo_4Ypo.js} +5849 -10882
  8. package/dist/browser/{flowWorkspace-Bl0SDehy.js → flowWorkspace-BFHGev7s.js} +1025 -2607
  9. package/dist/browser/preview.css +112 -5
  10. package/dist/browser/preview.js +1630 -9295
  11. package/dist/browser/theme.css +4 -2
  12. package/dist/browser/{tooltip-3XMK9jkr.js → tooltip-BAWSUexx.js} +1 -1
  13. package/dist/browser/{typeScriptSession-C9sBGOKZ.js → typeScriptSession-CRoezJPN.js} +1 -1
  14. package/dist/browser/ui.css +111 -4
  15. package/dist/browser/ui.js +3 -2
  16. package/dist/browser/workbench.css +9906 -9778
  17. package/dist/browser/workbench.d.ts +6 -2
  18. package/dist/browser/workbench.js +838 -499
  19. package/dist/browser/{workbenchSelect-DBGP7Y4Z.js → workbenchSelect-CjK-xdm3.js} +2 -2
  20. package/dist/command/index.js +48 -48
  21. package/dist/common/authoring.d.ts +4 -4
  22. package/dist/common/authoringExamples.d.ts +3 -2
  23. package/dist/common/authoringSchema.d.ts +23 -4
  24. package/dist/common/control-api-conformance.js +162 -15
  25. package/dist/common/control-api-errors.d.ts +12 -0
  26. package/dist/common/control-api.d.ts +35 -2
  27. package/dist/common/control-api.js +187 -37
  28. package/dist/common/control-requests.d.ts +22 -3
  29. package/dist/common/control-requests.js +152 -14
  30. package/dist/common/engine-contract.d.ts +3 -2
  31. package/dist/common/flow-authoring.js +55 -7
  32. package/dist/common/flow-change-schema.d.ts +1 -1
  33. package/dist/common/flow-change.d.ts +2 -2
  34. package/dist/common/flow-change.js +56 -8
  35. package/dist/common/flow-encoding.js +55 -7
  36. package/dist/common/flow-semantics.js +91 -7
  37. package/dist/common/flow-state.d.ts +123 -0
  38. package/dist/common/flow-state.js +5852 -0
  39. package/dist/common/mcp.d.ts +96 -3
  40. package/dist/common/mcp.js +165 -13
  41. package/dist/common/run-events.js +1 -0
  42. package/dist/common/runtime-contract.d.ts +14 -0
  43. package/dist/common/runtime-contract.js +118 -5
  44. package/dist/common/scheduler-node-execution.d.ts +1 -0
  45. package/dist/common/scheduler.d.ts +1 -1
  46. package/dist/common/scheduler.js +52 -3
  47. package/dist/common/state-conformance.d.ts +16 -0
  48. package/dist/common/tags.d.ts +4 -0
  49. package/dist/index.d.ts +11 -0
  50. package/package.json +5 -1
  51. package/src/control/common/api.ts +84 -11
  52. package/src/control/common/authoring.ts +6 -1
  53. package/src/control/common/authoringExamples.ts +8 -0
  54. package/src/control/common/authoringSchema.ts +18 -12
  55. package/src/control/common/errors.ts +6 -0
  56. package/src/control/common/flowDecoders.ts +1 -0
  57. package/src/control/common/mcp.ts +16 -0
  58. package/src/control/common/requests.ts +10 -2
  59. package/src/control/common/tags.ts +20 -0
  60. package/src/execution/common/events.ts +3 -0
  61. package/src/execution/common/node-execution.ts +3 -0
  62. package/src/execution/common/scheduler.ts +2 -0
  63. package/src/flow/common/change.ts +2 -1
  64. package/src/flow/common/changeSchema.ts +11 -1
  65. package/src/flow/common/errorHandling.ts +1 -1
  66. package/src/flow/common/semantics.ts +20 -0
  67. package/src/runtime/common/engineContract.ts +6 -3
  68. package/src/runtime/common/runtime.ts +116 -0
  69. package/src/state/common/conformance.ts +86 -0
  70. package/src/state/common/state.ts +169 -0
  71. package/src/types/index.ts +11 -0
@@ -1,20 +1,147 @@
1
1
  import { i as __require, o as __toESM, r as __exportAll, t as __commonJSMin } from "./rolldown-runtime-CEgmsyvS.js";
2
- import { A as DropdownMenuSub, C as DropdownMenuContent, D as DropdownMenuRadioGroup, E as DropdownMenuLabel, I as useCompositeItem, J as waitBranchDescription, M as DropdownMenuSubTrigger, N as DropdownMenuTrigger, O as DropdownMenuRadioItem, P as isElementDisabled, S as DropdownMenuCheckboxItem, T as DropdownMenuItem, _ as NativeScrollArea, at as Checkbox, b as Z$1, c as useIconifyData, d as PopoverContent, f as PopoverDescription, g as PopoverTrigger, h as PopoverTitle, j as DropdownMenuSubContent, k as DropdownMenuSeparator, m as PopoverPanelContent, o as IconifyProvider, ot as useAriaLabelledBy, p as PopoverHeader, s as useIconifyCollectionLoader, t as ContentIcon, u as Popover, v as ScrollArea, w as DropdownMenuGroup, x as DropdownMenu, y as VirtualScrollArea } from "./ContentIcon-Cm1hbVzW.js";
2
+ import { A as DropdownMenuSub, C as DropdownMenuContent, D as DropdownMenuRadioGroup, E as DropdownMenuLabel, I as useCompositeItem, J as waitBranchDescription, M as DropdownMenuSubTrigger, N as DropdownMenuTrigger, O as DropdownMenuRadioItem, P as isElementDisabled, S as DropdownMenuCheckboxItem, T as DropdownMenuItem, _ as NativeScrollArea, at as Checkbox, b as Z$1, c as useIconifyData, d as PopoverContent, f as PopoverDescription, g as PopoverTrigger, h as PopoverTitle, j as DropdownMenuSubContent, k as DropdownMenuSeparator, m as PopoverPanelContent, o as IconifyProvider, ot as useAriaLabelledBy, p as PopoverHeader, s as useIconifyCollectionLoader, t as ContentIcon, u as Popover, v as ScrollArea, w as DropdownMenuGroup, x as DropdownMenu, y as VirtualScrollArea } from "./ContentIcon-VZQO8VZU.js";
3
3
  import { i as compute, l as val } from "./dist-bO8nvHFH.js";
4
4
  import { c as useLang, l as useTranslate, o as I18nProvider, r as isPlainObject, s as useI18n, u as useVal } from "./dist-BFmpkX4P.js";
5
- import { $ as useAnchoredPopupScrollLock, $n as listNavigation, A as string, An as ownerDocument, Ar as CompositeRootContext, B as ARROW_LEFT, Bn as useValueChanged, Br as isElement, Cn as activeElement, Cr as useRenderElement, Dn as isFirefox, En as isAndroid, Er as NOOP, F as IndexGuessBehavior, Ft as FloatingFocusManager, G as HORIZONTAL_KEYS, Gn as closePress, H as ARROW_UP, Hn as createGenericEventDetails, Ht as FloatingPortal, I as useCompositeListItem, In as TransitionStatusDataAttributes, Ir as useStableCallback, J as VERTICAL_KEYS, K as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, Kn as escapeKey, L as ALL_KEYS, Ln as transitionStatusMapping, Lr as useRefWithInit, Mr as formatErrorMessage, Nn as useTransitionStatus, Nr as mergeProps, Nt as useDismiss, Or as useMergedRefs, Pn as useOpenChangeComplete, Pr as useIsoLayoutEffect, Pt as useClick, Qn as itemPress, R as ARROW_DOWN, Sn as isInteractiveElement, Sr as clsx, Tn as getTarget, Tr as EMPTY_OBJECT, V as ARROW_RIGHT, Vn as createChangeEventDetails, Wn as clearPress, Wt as DROPDOWN_COLLISION_AVOIDANCE, X as isNativeInput, Xn as inputClear, Xt as useStore, Y as VERTICAL_KEYS_WITH_EXTRA_KEYS, Yn as inputChange, Yt as Store, Z as scrollIntoViewIfNeeded, Zn as inputPress, _n as isIndexOutOfListBounds, _r as useControlled, a as createTooltipHandle, an as useTimeout, bn as stopEvent, br as cn, c as TooltipPositioner, cr as useFormContext, ct as inertValue, d as TooltipRoot, dn as findNonDisabledListIndex, dr as useBaseUiId, dt as popupStateMapping, en as require_builtin_esm_external_require_react, er as none, fn as getGridCellIndexOfCorner, ft as pressableTriggerOpenStateMapping, gn as getMinListIndex, gr as visuallyHiddenInput, gt as useTypeahead, hn as getMaxListIndex, hr as visuallyHidden, i as TooltipTrigger, it as useAnchorPositioning, kr as useButton, l as TooltipPortal, lr as useRegisterFieldControl, lt as getPseudoElementBounds, mn as getGridNavigatedIndex, mr as fieldValidityMapping, mt as useOpenInteractionType, n as TooltipContent, nn as useValueAsRef, nt as getDisabledMountTransitionStyles, o as TooltipArrow, ot as useDirection, p as timeZoneOffsetMinutes, pn as getGridCellIndices, pr as DEFAULT_FIELD_STATE_ATTRIBUTES, pt as triggerOpenStateMapping, q as MODIFIER_KEYS, r as TooltipProvider, rn as useOnFirstRender, rt as InternalBackdrop, s as TooltipPopup, sr as useLabelableContext, st as CompositeList, t as Tooltip, tn as createSelector, tt as usePositioner, u as TooltipTrigger$1, un as createGridCellMap, ur as useFieldRootContext, vn as isListIndexDisabled, vr as Button$1, vt as useListNavigation, wn as contains, wr as EMPTY_ARRAY$1, wt as useFloatingRootContext, xr as cva, yr as buttonVariants, yt as useInteractions, z as ARROW_KEYS } from "./tooltip-3XMK9jkr.js";
6
- import { $ as waitAutoContinueSchema, $t as Input, A as comparisonIssue, At as variableInputCompatible, Bt as SelectTrigger, Ct as limitDecisionQuestions, D as nodeSystemOutputPorts, Dt as matchesSchema, E as nodeErrorSchema, F as operatorsForType, Ft as SelectChevron, Gt as stringifyAsLabel, Ht as resolveAriaLabelledBy, It as SelectContent, J as webhookResponseAllowsBody, Jt as defaultItemEquality, K as webhookHeaderValuePort, Kt as stringifyAsValue, L as unaryOperator, Lt as SelectGroup, Nt as dequal, O as supportsNodeErrorHandling, Ot as portsAssignable, P as operandHandle, Pt as Select$1, Q as workflowOutputsPort, Qt as Label, R as valueType, Rt as SelectItem, St as defaultDecisionQuestion, T as workflowToolNameIssue, Tt as webhookSupportsBody, U as decodeRevisionContent, Ut as hasNullItemLabel, Vt as SelectValue, Wt as isGroupedItems, X as webhookResponseTimeout, Xt as removeItem, Y as webhookResponseInputs, Yt as findItemIndex, Z as webhookStatusCodePort, Zt as selectedValueIncludes, _t as isHttpHost, at as httpHeaderSchema, b as nodeNameIssue, bt as decisionQuestionIssues, c as DialogTrigger, d as Field, en as useLabelableId, et as defaultNodeRetry, f as FieldDescription, h as FieldLabel, i as DialogDescription, kt as schemaObject, l as Icon, lt as httpRequestIssues, m as FieldGroup, nt as retryConfigurationSchema, o as DialogHeader, ot as httpQuerySchema, p as FieldError, pt as httpHeaderNameIssue, q as webhookHeadersPort, qt as compareItemEquality, r as DialogContent, rt as supportsNodeRetry, s as DialogTitle, t as Dialog, tn as ChevronDown, tt as nodeRetryLimits, u as Spinner, ut as httpRequestTask, vt as decisionLimits, wt as webhookMethods, xt as decisionTask, zt as SelectSeparator } from "./dialog-aSElFFw2.js";
7
- import { C as isSameViewport, S as isMac, _ as CanvasTooltip, a as collapseAllNested, b as toManifestHandleName, c as defaultTriggerIcon, d as selectableTimeZones, f as timeZoneLabel, g as E$1, h as cronDescription, i as JSONViewer, l as useDebouncedValue, m as timeZoneOffset, n as setAddItemId, o as formatDuration, p as timeZoneLongLabel, r as Textarea, s as CanvasNodeIcon, t as FlowCanvas, u as IconStack, v as CanvasStore, x as toManifestNodeId, y as toViewEdge } from "./FlowCanvas-NzKtla_c.js";
8
- import { $t as FeishuEventPicker, A as schemaForEditor, An as securityOptions, B as datePickerValue, Bt as InputGroupAddon, Cn as triggerConfigValue, D as defaultValueEditorSchema, Dn as object$1, E as supportsFeishuChatFilter, En as listOperations, F as calendarChange, Fn as workflowAgentTool, Ft as dequal$1, G as indexAddNodeOptions, Gn as controlErrorCode, Gt as EmptyHeader, H as isDateFormat, Ht as Empty, I as calendarDate, It as WorkflowExportMenuItem, Jt as Badge, Kn as eventSourceKind, Kt as EmptyMedia, L as dateFromTimeZone, Ln as workflowCandidateGroup, Lt as IdTooltip, M as getDefaultValue, Mn as serverAddress, N as isUnconstrainedSchema, Nn as servers, O as editorComponent, On as openApiFieldIssues, P as typeOfSchema, Pn as sameWorkflowInterface, Q as resourceValue, Qt as createI18n, R as dateInTimeZone, Rn as workflowCapability, Rt as followWorkbenchLink, T as feishuResourceKind, Tn as inputValue, Ut as EmptyContent, V as dateTimeWall, Vt as InputGroupInput, Wt as EmptyDescription, X as observeResource, Xt as SourceForm, Z as resourceData, Zt as SourceSelect, _t as connectionCatalog, an as decodeResultList, cn as inputSourceCandidates, ct as revisionView, dn as sourceOutputLabel, en as EventSourceSetup, et as designerGraph, fn as sourcePort, gn as isJsonObject, hn as triggerOutputDefinitions, ht as schemaMismatchMessage, it as providerIcon, j as valueForEditor, jn as selectOperation, k as editorGroups, kn as openApiTask, ln as resolutionOutputPorts, mt as diagnosticNodeId, n as agentTool, nt as triggerNodeIcon, ot as canCancelRun, pt as diagnosticMessage, q as mapSource, qt as EmptyTitle, rt as actionSummary, sn as executionReachableNodes, st as hasRunFilter, tn as errorNotice, tt as semanticNodeIcon, un as webhookResponseDiagnostics, wn as triggerConfigValues, z as datePickerChange, zn as workflowSelectionTask, zt as InputGroup } from "./flowChanges-NZyS7HSp.js";
5
+ import { Ar as useButton, B as ARROW_KEYS, Cr as clsx, En as getTarget, Er as EMPTY_OBJECT, Fn as useOpenChangeComplete, Fr as useIsoLayoutEffect, Gn as clearPress, H as ARROW_RIGHT, Hn as createChangeEventDetails, J as MODIFIER_KEYS, K as HORIZONTAL_KEYS, L as useCompositeListItem, Ln as TransitionStatusDataAttributes, Lr as useStableCallback, Nr as formatErrorMessage, Pn as useTransitionStatus, Pr as mergeProps, Q as scrollIntoViewIfNeeded, R as ALL_KEYS, Rn as transitionStatusMapping, Sr as cva, Tn as contains, Tr as EMPTY_ARRAY$1, U as ARROW_UP, V as ARROW_LEFT, Vn as useValueChanged, X as VERTICAL_KEYS_WITH_EXTRA_KEYS, Y as VERTICAL_KEYS, Z as isNativeInput, Zt as useStore, _n as getMinListIndex, _r as visuallyHiddenInput, a as createTooltipHandle, br as buttonVariants, c as TooltipPositioner, cr as useLabelableContext, ct as CompositeList, d as TooltipRoot, dn as createGridCellMap, dr as useFieldRootContext, fn as findNonDisabledListIndex, fr as useBaseUiId, gn as getMaxListIndex, gr as visuallyHidden, hn as getGridNavigatedIndex, hr as fieldValidityMapping, i as TooltipTrigger, j as string, jn as ownerDocument, jr as CompositeRootContext, kr as useMergedRefs, l as TooltipPortal, lr as useFormContext, lt as inertValue, mn as getGridCellIndices, mt as triggerOpenStateMapping, n as TooltipContent, o as TooltipArrow, p as timeZoneOffsetMinutes, pn as getGridCellIndexOfCorner, q as HORIZONTAL_KEYS_WITH_EXTRA_KEYS, r as TooltipProvider, s as TooltipPopup, st as useDirection, t as Tooltip, tn as require_builtin_esm_external_require_react, tr as none, u as TooltipTrigger$1, ur as useRegisterFieldControl, vn as isIndexOutOfListBounds, vr as useControlled, wn as activeElement, wr as useRenderElement, xr as cn, yn as isListIndexDisabled, yr as Button$1, z as ARROW_DOWN } from "./tooltip-BAWSUexx.js";
6
+ import { $ as waitAutoContinueSchema, A as comparisonIssue, At as variableInputCompatible, Bt as SelectGroup, Ct as limitDecisionQuestions, D as nodeSystemOutputPorts, Dt as matchesSchema, E as nodeErrorSchema, F as operatorsForType, Ht as SelectSeparator, It as dequal, J as webhookResponseAllowsBody, K as webhookHeaderValuePort, L as unaryOperator, Lt as Select$1, O as supportsNodeErrorHandling, Ot as portsAssignable, P as operandHandle, Q as workflowOutputsPort, R as valueType, Rt as SelectChevron, St as defaultDecisionQuestion, T as workflowToolNameIssue, Tt as webhookSupportsBody, U as decodeRevisionContent, Ut as SelectTrigger, Vt as SelectItem, Wt as SelectValue, X as webhookResponseTimeout, Y as webhookResponseInputs, Z as webhookStatusCodePort, _t as isHttpHost, a as DialogFooter, at as httpHeaderSchema, b as nodeNameIssue, bt as decisionQuestionIssues, c as DialogTrigger, d as Field, et as defaultNodeRetry, f as FieldDescription, h as FieldLabel, i as DialogDescription, in as ChevronDown, kt as schemaObject, l as Icon, lt as httpRequestIssues, m as FieldGroup, nn as Input, nt as retryConfigurationSchema, o as DialogHeader, ot as httpQuerySchema, p as FieldError, pt as httpHeaderNameIssue, q as webhookHeadersPort, r as DialogContent, rn as useLabelableId, rt as supportsNodeRetry, s as DialogTitle, t as Dialog, tn as Label, tt as nodeRetryLimits, u as Spinner, ut as httpRequestTask, vt as decisionLimits, wt as webhookMethods, xt as decisionTask, zt as SelectContent } from "./dialog-BcFBfRB1.js";
7
+ import { C as isMac, S as toManifestNodeId, _ as E$1, a as JSONViewer, b as toViewEdge, c as CanvasNodeIcon, d as IconStack, f as selectableTimeZones, g as cronDescription, h as timeZoneOffset, i as Textarea, l as defaultTriggerIcon, m as timeZoneLongLabel, n as setAddItemId, o as collapseAllNested, p as timeZoneLabel, r as NodeHistoryContext, s as formatDuration, t as FlowCanvas, u as useDebouncedValue, v as CanvasTooltip, w as isSameViewport, x as toManifestHandleName, y as CanvasStore } from "./FlowCanvas-BNGDMaWr.js";
8
+ import { $n as openApiFieldIssues, $t as GroupCollectionProvider, A as schemaForEditor, An as decodeResultList, B as datePickerValue, Bn as triggerOutputDefinitions, Cn as FeishuEventPicker, D as defaultValueEditorSchema, E as supportsFeishuChatFilter, F as calendarChange, Fn as webhookResponseDiagnostics, Ft as dequal$1, G as indexAddNodeOptions, Gt as ValueEditorFeedback, H as isDateFormat, Ht as selectionMenuContentClass, I as calendarDate, In as sourceOutputLabel, It as WorkflowExportMenuItem, Jn as triggerConfigValue, Jt as ComboboxItem, Kt as valueEditor_module_default, L as dateFromTimeZone, Ln as sourcePort, Lt as IdTooltip, M as getDefaultValue, Mn as executionReachableNodes, N as isUnconstrainedSchema, Nn as inputSourceCandidates, O as editorComponent, P as typeOfSchema, Pn as resolutionOutputPorts, Q as resourceValue, Qn as object$1, Qt as ComboboxList, R as dateInTimeZone, Rt as FlowSettingsButton, Sn as createI18n, T as feishuResourceKind, Tn as errorNotice, Ut as selectionMenuItemClass, V as dateTimeWall, Vn as isJsonObject, Wt as ValueControl, X as observeResource, Xn as inputValue, Xt as ComboboxPositioner, Yn as triggerConfigValues, Yt as ComboboxPopup, Z as resourceData, Zn as listOperations, Zt as ComboboxPortal, _n as EmptyTitle, _r as eventSourceKind, _t as connectionCatalog, an as useComboboxInputValueContext, ar as sameWorkflowInterface, bn as SourceForm, cn as followWorkbenchLink, cr as workflowCandidateGroup, ct as revisionView, dn as InputGroupInput, en as ComboboxTrigger, er as openApiTask, et as designerGraph, fn as Empty, gn as EmptyMedia, gr as controlErrorCode, hn as EmptyHeader, ht as schemaMismatchMessage, in as selectors, ir as servers, it as providerIcon, j as valueForEditor, k as editorGroups, ln as InputGroup, lr as workflowCapability, mn as EmptyDescription, mt as diagnosticNodeId, n as agentTool, nn as ComboboxInput, nr as selectOperation, nt as triggerNodeIcon, on as useComboboxRootContext, or as workflowAgentTool, ot as canCancelRun, pn as EmptyContent, pt as diagnosticMessage, q as mapSource, qt as ComboboxItemIndicator, rn as ComboboxRoot, rr as serverAddress, rt as actionSummary, st as hasRunFilter, tn as ComboboxInputGroup, tr as securityOptions, tt as semanticNodeIcon, un as InputGroupAddon, ur as workflowSelectionTask, vn as Badge, wn as EventSourceSetup, xn as SourceSelect, z as datePickerChange } from "./flowChanges-BGo_4Ypo.js";
9
9
  import { r as resolveUiLanguage } from "./languages-gYzoQqCi.js";
10
10
  import { a as renameObjectField, i as objectValue, n as isJsonValue, o as setObjectField, r as jsonDataTypes, s as valueType$1, t as initialValue } from "./value-BbFQZZ_V.js";
11
11
  import { n as compile, r as validate } from "./flowRunInputEditorStore-ys1-w9GW.js";
12
- import { t as WorkbenchSelect } from "./workbenchSelect-DBGP7Y4Z.js";
12
+ import { t as WorkbenchSelect } from "./workbenchSelect-CjK-xdm3.js";
13
13
  import * as React from "react";
14
14
  import reactExports, { Children, Fragment, Suspense, createContext, forwardRef, isValidElement, lazy, memo, useCallback, useContext, useEffect, useId, useImperativeHandle, useLayoutEffect, useMemo, useRef, useState } from "react";
15
15
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
16
- import * as ReactDOM from "react-dom";
17
16
  import { flushSync } from "react-dom";
17
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroupContext.js
18
+ var ComboboxGroupContext = /*#__PURE__*/ React.createContext(void 0);
19
+ if (process.env.NODE_ENV !== "production") ComboboxGroupContext.displayName = "ComboboxGroupContext";
20
+ //#endregion
21
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js
22
+ /**
23
+ * Groups related items with the corresponding label.
24
+ * Renders a `<div>` element.
25
+ *
26
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
27
+ */
28
+ var ComboboxGroup = /*#__PURE__*/ React.forwardRef(function ComboboxGroup(componentProps, forwardedRef) {
29
+ const { render, className, style, items, ...elementProps } = componentProps;
30
+ const [labelId, setLabelId] = React.useState();
31
+ const contextValue = React.useMemo(() => ({
32
+ labelId,
33
+ setLabelId,
34
+ items
35
+ }), [
36
+ labelId,
37
+ setLabelId,
38
+ items
39
+ ]);
40
+ const element = useRenderElement("div", componentProps, {
41
+ ref: forwardedRef,
42
+ props: [{
43
+ role: "group",
44
+ "aria-labelledby": labelId
45
+ }, elementProps]
46
+ });
47
+ const wrappedElement = /*#__PURE__*/ jsx(ComboboxGroupContext.Provider, {
48
+ value: contextValue,
49
+ children: element
50
+ });
51
+ if (items) return /*#__PURE__*/ jsx(GroupCollectionProvider, {
52
+ items,
53
+ children: wrappedElement
54
+ });
55
+ return wrappedElement;
56
+ });
57
+ if (process.env.NODE_ENV !== "production") ComboboxGroup.displayName = "ComboboxGroup";
58
+ //#endregion
59
+ //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js
60
+ var stateAttributesMapping$2 = {
61
+ ...transitionStatusMapping,
62
+ ...triggerOpenStateMapping
63
+ };
64
+ /**
65
+ * Clears the value when clicked.
66
+ * Renders a `<button>` element.
67
+ *
68
+ * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
69
+ */
70
+ var ComboboxClear = /*#__PURE__*/ React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {
71
+ const { render, className, disabled: disabledProp = false, nativeButton = true, keepMounted = false, style, ...elementProps } = componentProps;
72
+ const { disabled: fieldDisabled } = useFieldRootContext();
73
+ const store = useComboboxRootContext();
74
+ const selectionMode = useStore(store, selectors.selectionMode);
75
+ const comboboxDisabled = useStore(store, selectors.disabled);
76
+ const readOnly = useStore(store, selectors.readOnly);
77
+ const open = useStore(store, selectors.open);
78
+ const selectedValue = useStore(store, selectors.selectedValue);
79
+ const hasSelectionChips = useStore(store, selectors.hasSelectionChips);
80
+ const inputValue = useComboboxInputValueContext();
81
+ let visible = false;
82
+ if (selectionMode === "none") visible = inputValue !== "";
83
+ else if (selectionMode === "single") visible = selectedValue != null;
84
+ else visible = hasSelectionChips;
85
+ const disabled = fieldDisabled || comboboxDisabled || disabledProp;
86
+ const { buttonRef, getButtonProps } = useButton({
87
+ native: nativeButton,
88
+ disabled
89
+ });
90
+ const { mounted, transitionStatus, setMounted } = useTransitionStatus(visible);
91
+ const state = {
92
+ disabled,
93
+ open,
94
+ transitionStatus
95
+ };
96
+ useOpenChangeComplete({
97
+ open: visible,
98
+ ref: store.state.clearRef,
99
+ onComplete() {
100
+ if (!visible) setMounted(false);
101
+ }
102
+ });
103
+ const element = useRenderElement("button", componentProps, {
104
+ state,
105
+ ref: [
106
+ forwardedRef,
107
+ buttonRef,
108
+ store.state.clearRef
109
+ ],
110
+ props: [
111
+ {
112
+ tabIndex: -1,
113
+ children: "x",
114
+ onMouseDown(event) {
115
+ event.preventDefault();
116
+ },
117
+ onClick(event) {
118
+ if (disabled || readOnly) return;
119
+ const keyboardActiveRef = store.state.keyboardActiveRef;
120
+ store.state.setInputValue("", createChangeEventDetails(clearPress, event.nativeEvent));
121
+ if (selectionMode !== "none") {
122
+ store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
123
+ store.state.setIndices({
124
+ activeIndex: null,
125
+ selectedIndex: null,
126
+ type: keyboardActiveRef.current ? "keyboard" : "pointer"
127
+ });
128
+ } else store.state.setIndices({
129
+ activeIndex: null,
130
+ type: keyboardActiveRef.current ? "keyboard" : "pointer"
131
+ });
132
+ store.state.inputRef.current?.focus();
133
+ }
134
+ },
135
+ elementProps,
136
+ getButtonProps
137
+ ],
138
+ stateAttributesMapping: stateAttributesMapping$2
139
+ });
140
+ if (!(keepMounted || mounted)) return null;
141
+ return element;
142
+ });
143
+ if (process.env.NODE_ENV !== "production") ComboboxClear.displayName = "ComboboxClear";
144
+ //#endregion
18
145
  //#region ../../node_modules/.bun/@iconify+utils@3.1.4/node_modules/@iconify/utils/lib/icon/defaults.js
19
146
  /** Default values for dimensions */
20
147
  var defaultIconDimensions = Object.freeze({
@@ -792,7 +919,7 @@ var TabsPanelDataAttributes = function(TabsPanelDataAttributes) {
792
919
  }({});
793
920
  //#endregion
794
921
  //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/tabs/panel/TabsPanel.js
795
- var stateAttributesMapping$3 = {
922
+ var stateAttributesMapping$1 = {
796
923
  ...tabsStateAttributesMapping,
797
924
  ...transitionStatusMapping
798
925
  };
@@ -838,7 +965,7 @@ var TabsPanel = /*#__PURE__*/ React.forwardRef(function TabPanel(componentProps,
838
965
  inert: inertValue(!open),
839
966
  [TabsPanelDataAttributes.index]: index
840
967
  }, elementProps],
841
- stateAttributesMapping: stateAttributesMapping$3
968
+ stateAttributesMapping: stateAttributesMapping$1
842
969
  });
843
970
  useOpenChangeComplete({
844
971
  open,
@@ -1392,10 +1519,6 @@ function FieldTypeDisplay({ id, label, accessibleLabel, icon, compact = true, ad
1392
1519
  });
1393
1520
  }
1394
1521
  //#endregion
1395
- //#region src/form/browser/selectionMenuStyles.ts
1396
- var selectionMenuContentClass = "rounded-[calc(var(--ui-control-radius,var(--ui-radius))_+_2px)] p-1";
1397
- var selectionMenuItemClass = "mt-1 first-of-type:mt-0 min-h-7 rounded-[var(--ui-control-radius,var(--ui-radius))] py-1 text-xs leading-5 font-normal";
1398
- //#endregion
1399
1522
  //#region src/form/browser/fieldSelect.tsx
1400
1523
  var fieldSelectTriggerClass = "w-full min-w-0 px-2 text-xs font-normal text-foreground";
1401
1524
  /** The field editor uses the product selection surface instead of the browser menu. */
@@ -2559,6 +2682,7 @@ function fallbackIcon$1(item) {
2559
2682
  case "agent": return "llm";
2560
2683
  case "condition": return "condition";
2561
2684
  case "decision": return "decision";
2685
+ case "dedupe":
2562
2686
  case "http-request":
2563
2687
  case "openapi":
2564
2688
  case "connector":
@@ -5607,80 +5731,343 @@ function FlowNodeList({ nodes, onFocusNode, onSelect, groupTriggers = false }) {
5607
5731
  })
5608
5732
  });
5609
5733
  }
5610
- var valueEditor_module_default = {
5611
- root: "valueEditor_root_4a4f1",
5612
- errorAnchor: "valueEditor_errorAnchor_4a4f1",
5613
- body: "valueEditor_body_4a4f1",
5614
- valueTools: "valueEditor_valueTools_4a4f1",
5615
- options: "valueEditor_options_4a4f1",
5616
- toolbar: "valueEditor_toolbar_4a4f1",
5617
- presence: "valueEditor_presence_4a4f1",
5618
- actions: "valueEditor_actions_4a4f1",
5619
- collection: "valueEditor_collection_4a4f1",
5620
- fieldName: "valueEditor_fieldName_4a4f1",
5621
- fieldType: "valueEditor_fieldType_4a4f1",
5622
- json: "valueEditor_json_4a4f1",
5623
- description: "valueEditor_description_4a4f1",
5624
- error: "valueEditor_error_4a4f1",
5625
- summary: "valueEditor_summary_4a4f1",
5626
- summaryError: "valueEditor_summaryError_4a4f1",
5627
- srOnly: "valueEditor_srOnly_4a4f1",
5628
- option: "valueEditor_option_4a4f1",
5629
- header: "valueEditor_header_4a4f1",
5630
- leadingControl: "valueEditor_leadingControl_4a4f1",
5631
- toggleControl: "valueEditor_toggleControl_4a4f1",
5632
- valueAddon: "valueEditor_valueAddon_4a4f1",
5633
- summaryText: "valueEditor_summaryText_4a4f1",
5634
- clearValue: "valueEditor_clearValue_4a4f1",
5635
- resetValue: "valueEditor_resetValue_4a4f1",
5636
- unsetValue: "valueEditor_unsetValue_4a4f1",
5637
- arrayIndex: "valueEditor_arrayIndex_4a4f1",
5638
- nullValue: "valueEditor_nullValue_4a4f1",
5639
- nullChip: "valueEditor_nullChip_4a4f1",
5640
- collectionActions: "valueEditor_collectionActions_4a4f1",
5641
- emptyObjectContent: "valueEditor_emptyObjectContent_4a4f1",
5642
- emptyObjectConstraint: "valueEditor_emptyObjectConstraint_4a4f1",
5643
- jsonCode: "valueEditor_jsonCode_4a4f1",
5644
- emptyString: "valueEditor_emptyString_4a4f1",
5645
- booleanControl: "valueEditor_booleanControl_4a4f1",
5646
- booleanIndicator: "valueEditor_booleanIndicator_4a4f1",
5647
- objectNotice: "valueEditor_objectNotice_4a4f1",
5648
- valuePrefix: "valueEditor_valuePrefix_4a4f1"
5649
- };
5650
5734
  //#endregion
5651
- //#region src/form/browser/fieldControl.tsx
5652
- /** Gives custom value controls the same attached validation feedback as built-in editors. */
5653
- function ValueEditorFeedback({ children, error }) {
5654
- const id = useId();
5655
- const errorId = error == null ? void 0 : `${id}-error`;
5735
+ //#region src/ui/browser/native-select.tsx
5736
+ function NativeSelect({ className, size = "default", ...props }) {
5656
5737
  return /* @__PURE__ */ jsxs("div", {
5657
- className: valueEditor_module_default.errorAnchor,
5658
- "data-feedback": error != null || void 0,
5659
- children: [children(errorId), error != null && /* @__PURE__ */ jsx("div", {
5660
- id: errorId,
5661
- className: valueEditor_module_default.error,
5662
- role: "alert",
5663
- children: error
5738
+ className: cn("group/native-select relative w-fit has-[select:disabled]:opacity-50", className),
5739
+ "data-slot": "native-select-wrapper",
5740
+ "data-size": size,
5741
+ children: [/* @__PURE__ */ jsx("select", {
5742
+ "data-slot": "native-select",
5743
+ "data-size": size,
5744
+ className: "h-8 w-full min-w-0 appearance-none rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground data-[slot=native-select]:focus-visible:text-field-focus data-[slot=native-select]:focus-visible:aria-invalid:invalid-text-field-focus disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive data-[size=sm]:h-7 data-[size=sm]:rounded-[var(--ui-control-radius,var(--ui-radius))] data-[size=sm]:py-0.5 dark:bg-[var(--ui-control-background,var(--ui-muted))] dark:hover:bg-input/50",
5745
+ ...props
5746
+ }), /* @__PURE__ */ jsx(ChevronDown, {
5747
+ className: "pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none",
5748
+ "aria-hidden": "true",
5749
+ "data-slot": "native-select-icon"
5664
5750
  })]
5665
5751
  });
5666
5752
  }
5667
- /** A custom value control uses the same attached source layout as schema editors. */
5668
- function ValueControl({ addon, children }) {
5669
- if (addon == null) return children;
5753
+ function NativeSelectOption({ className, ...props }) {
5754
+ return /* @__PURE__ */ jsx("option", {
5755
+ "data-slot": "native-select-option",
5756
+ className: cn("bg-[Canvas] text-[CanvasText]", className),
5757
+ ...props
5758
+ });
5759
+ }
5760
+ //#endregion
5761
+ //#region src/workbench/browser/runtime/editor/flowStatePanel.tsx
5762
+ function FlowStatePanel({ value, nodeIds, busy, onClearValues, onClearSpace, space }) {
5763
+ const t = useTranslate();
5764
+ const count = value.spaces.reduce((total, item) => total + item.count, 0);
5765
+ const spaces = space == null ? value.spaces : value.spaces.filter((item) => typeof space === "string" ? item.space === space : space.includes(item.space));
5670
5766
  return /* @__PURE__ */ jsxs("div", {
5671
- className: valueEditor_module_default.root,
5672
- "data-inline": true,
5673
- "data-value-addon": addon != null || void 0,
5674
- children: [addon != null && /* @__PURE__ */ jsx("div", {
5675
- className: valueEditor_module_default.valueAddon,
5676
- "data-value-addon-control": true,
5677
- children: addon
5678
- }), /* @__PURE__ */ jsx("div", {
5679
- className: valueEditor_module_default.body,
5680
- children
5767
+ className: "flex flex-col gap-4",
5768
+ children: [space == null && /* @__PURE__ */ jsxs("section", {
5769
+ className: "flex flex-col gap-2",
5770
+ children: [
5771
+ /* @__PURE__ */ jsxs("div", {
5772
+ className: "flex items-center justify-between gap-3",
5773
+ children: [
5774
+ /* @__PURE__ */ jsx("h3", {
5775
+ className: "m-0 min-w-0 flex-1 text-sm font-medium",
5776
+ children: t("flowState.values")
5777
+ }),
5778
+ /* @__PURE__ */ jsx("span", {
5779
+ className: "text-xs text-muted-foreground",
5780
+ children: t("flowState.entries", {
5781
+ count: value.values.length.toLocaleString(),
5782
+ limit: value.limits.maxValues.toLocaleString()
5783
+ })
5784
+ }),
5785
+ value.values.length > 0 && /* @__PURE__ */ jsx(Button$1, {
5786
+ variant: "outline",
5787
+ size: "sm",
5788
+ disabled: busy,
5789
+ onClick: () => onClearValues(),
5790
+ children: t("flowState.clearAll")
5791
+ })
5792
+ ]
5793
+ }),
5794
+ !value.values.length && /* @__PURE__ */ jsx("p", {
5795
+ className: "m-0 text-sm text-muted-foreground",
5796
+ children: t("flowState.emptyValues")
5797
+ }),
5798
+ value.values.map((item) => /* @__PURE__ */ jsxs("div", {
5799
+ className: "flex items-start justify-between gap-3 border-b border-border/60 py-2",
5800
+ children: [/* @__PURE__ */ jsxs("div", {
5801
+ className: "min-w-0",
5802
+ children: [/* @__PURE__ */ jsx("p", {
5803
+ className: "m-0 break-all font-medium",
5804
+ children: item.key
5805
+ }), item.value !== void 0 && /* @__PURE__ */ jsx("pre", {
5806
+ className: "max-h-40 overflow-auto whitespace-pre-wrap break-all text-xs",
5807
+ children: JSON.stringify(item.value, null, 2)
5808
+ })]
5809
+ }), /* @__PURE__ */ jsx(Button$1, {
5810
+ variant: "outline",
5811
+ size: "sm",
5812
+ disabled: busy,
5813
+ onClick: () => onClearValues(item.key),
5814
+ children: t("flowState.delete")
5815
+ })]
5816
+ }, item.key))
5817
+ ]
5818
+ }), /* @__PURE__ */ jsxs("section", {
5819
+ className: "flex flex-col gap-2",
5820
+ children: [
5821
+ /* @__PURE__ */ jsxs("div", {
5822
+ className: "flex items-center justify-between gap-3",
5823
+ children: [/* @__PURE__ */ jsx("h3", {
5824
+ className: "m-0 text-sm font-medium",
5825
+ children: t("flowState.spaces")
5826
+ }), /* @__PURE__ */ jsx("span", {
5827
+ className: "text-xs text-muted-foreground",
5828
+ children: t("flowState.entries", {
5829
+ count: count.toLocaleString(),
5830
+ limit: value.limits.maxIdentities.toLocaleString()
5831
+ })
5832
+ })]
5833
+ }),
5834
+ count >= value.limits.maxIdentities * .8 && /* @__PURE__ */ jsx("p", {
5835
+ role: "status",
5836
+ className: "m-0 text-destructive text-xs",
5837
+ children: t("flowState.nearLimit")
5838
+ }),
5839
+ !spaces.length && /* @__PURE__ */ jsx("p", {
5840
+ className: "m-0 text-sm text-muted-foreground",
5841
+ children: t("flowState.emptySpaces")
5842
+ }),
5843
+ spaces.map((item) => /* @__PURE__ */ jsxs("div", {
5844
+ className: "flex items-start justify-between gap-3 border-b border-border/60 py-2",
5845
+ children: [/* @__PURE__ */ jsxs("div", {
5846
+ className: "min-w-0",
5847
+ children: [/* @__PURE__ */ jsxs("p", {
5848
+ className: "m-0 break-all font-medium",
5849
+ children: [
5850
+ item.space,
5851
+ " ",
5852
+ item.space.startsWith("node:") && !nodeIds.includes(item.space.slice(5)) && /* @__PURE__ */ jsxs("span", {
5853
+ className: "text-muted-foreground",
5854
+ children: [
5855
+ "(",
5856
+ t("flowState.orphaned"),
5857
+ ")"
5858
+ ]
5859
+ })
5860
+ ]
5861
+ }), /* @__PURE__ */ jsx("p", {
5862
+ className: "m-0 text-xs",
5863
+ children: item.mode === "new" ? t("flowState.records", { count: item.count.toLocaleString() }) : `${t("flowState.watermark")}: ${item.watermark ?? "-"}`
5864
+ })]
5865
+ }), /* @__PURE__ */ jsx(Button$1, {
5866
+ variant: "outline",
5867
+ size: "sm",
5868
+ disabled: busy,
5869
+ onClick: () => onClearSpace(item.space),
5870
+ children: t("flowState.clear")
5871
+ })]
5872
+ }, item.space))
5873
+ ]
5681
5874
  })]
5682
5875
  });
5683
5876
  }
5877
+ function FlowStateButton({ client, flowId, nodeIds, history, onClose }) {
5878
+ const t = useTranslate();
5879
+ const [container, setContainer] = useState(null);
5880
+ const portal = useCallback((element) => {
5881
+ setContainer(element?.closest(".open-flow-workbench") ?? element?.closest(".open-flow-theme") ?? null);
5882
+ }, []);
5883
+ const [open, setOpen] = useState(onClose != null);
5884
+ const [scope, setScope] = useState("draft");
5885
+ const space = history?.space;
5886
+ const [values, setValues] = useState(false);
5887
+ const [data, setData] = useState();
5888
+ const [error, setError] = useState();
5889
+ const [busy, setBusy] = useState(false);
5890
+ const [refresh, setRefresh] = useState(0);
5891
+ const [confirm, setConfirm] = useState();
5892
+ useEffect(() => {
5893
+ if (!open && space == null) return;
5894
+ let active = true;
5895
+ setData(void 0);
5896
+ setError(void 0);
5897
+ client.getFlowState(flowId, scope, values).then((result) => {
5898
+ if (active) setData(result);
5899
+ }, (reason) => {
5900
+ if (active) setError(String(reason));
5901
+ });
5902
+ return () => {
5903
+ active = false;
5904
+ };
5905
+ }, [
5906
+ client,
5907
+ flowId,
5908
+ scope,
5909
+ values,
5910
+ refresh,
5911
+ open,
5912
+ space
5913
+ ]);
5914
+ const clear = async (target) => {
5915
+ setBusy(true);
5916
+ setError(void 0);
5917
+ try {
5918
+ if (target.space != null) await client.clearFlowDedupe(flowId, scope, target.space);
5919
+ else await client.clearFlowState(flowId, scope, target.key);
5920
+ setConfirm(void 0);
5921
+ setRefresh((value) => value + 1);
5922
+ } catch (reason) {
5923
+ setError(String(reason));
5924
+ } finally {
5925
+ setBusy(false);
5926
+ }
5927
+ };
5928
+ const request = (target) => scope === "live" ? setConfirm(target) : void clear(target);
5929
+ return /* @__PURE__ */ jsx("span", {
5930
+ className: "contents",
5931
+ ref: portal,
5932
+ children: /* @__PURE__ */ jsxs(Dialog, {
5933
+ open,
5934
+ onOpenChange: (next) => {
5935
+ if (!busy) {
5936
+ setOpen(next);
5937
+ if (!next) onClose?.();
5938
+ setConfirm(void 0);
5939
+ }
5940
+ },
5941
+ children: [onClose == null && /* @__PURE__ */ jsxs(DialogTrigger, {
5942
+ render: /* @__PURE__ */ jsx(Button$1, {
5943
+ variant: space != null && data != null && data.spaces.reduce((total, item) => total + item.count, 0) >= data.limits.maxIdentities * .8 ? "destructive" : "ghost",
5944
+ size: "sm"
5945
+ }),
5946
+ children: [/* @__PURE__ */ jsx("i", {
5947
+ "aria-hidden": "true",
5948
+ className: "i-lucide-light:database"
5949
+ }), t(space == null ? "flowState.title" : "flowState.history")]
5950
+ }), /* @__PURE__ */ jsxs(DialogContent, {
5951
+ container,
5952
+ className: "max-h-[80vh] overflow-auto",
5953
+ closeLabel: t("common.close"),
5954
+ children: [
5955
+ /* @__PURE__ */ jsx(DialogTitle, { children: t("flowState.title") }),
5956
+ /* @__PURE__ */ jsxs("div", {
5957
+ className: "flex flex-wrap items-center gap-3",
5958
+ children: [
5959
+ /* @__PURE__ */ jsxs(NativeSelect, {
5960
+ "aria-label": t("flowState.scope"),
5961
+ value: scope,
5962
+ disabled: busy,
5963
+ onChange: (event) => {
5964
+ setScope(event.target.value);
5965
+ setConfirm(void 0);
5966
+ },
5967
+ children: [/* @__PURE__ */ jsx(NativeSelectOption, {
5968
+ value: "draft",
5969
+ children: t("flowState.draft")
5970
+ }), /* @__PURE__ */ jsx(NativeSelectOption, {
5971
+ value: "live",
5972
+ children: t("flowState.live")
5973
+ })]
5974
+ }),
5975
+ space == null && (values || (data?.values.length ?? 0) > 0) && /* @__PURE__ */ jsxs(Label, {
5976
+ className: "flex items-center gap-2 text-sm",
5977
+ children: [/* @__PURE__ */ jsx(Checkbox, {
5978
+ checked: values,
5979
+ onCheckedChange: setValues
5980
+ }), t("flowState.showValues")]
5981
+ }),
5982
+ /* @__PURE__ */ jsx(Button$1, {
5983
+ variant: "outline",
5984
+ size: "sm",
5985
+ disabled: busy,
5986
+ onClick: () => setRefresh((value) => value + 1),
5987
+ children: t("flowState.refresh")
5988
+ }),
5989
+ /* @__PURE__ */ jsxs(Tooltip, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
5990
+ render: /* @__PURE__ */ jsx(Button$1, {
5991
+ variant: "ghost",
5992
+ size: "xs",
5993
+ className: "ml-auto text-muted-foreground"
5994
+ }),
5995
+ children: t("flowState.rules")
5996
+ }), /* @__PURE__ */ jsx(TooltipContent, {
5997
+ container,
5998
+ className: "max-w-xs",
5999
+ children: /* @__PURE__ */ jsxs("div", {
6000
+ className: "flex flex-col gap-2",
6001
+ children: [
6002
+ /* @__PURE__ */ jsx("p", {
6003
+ className: "m-0",
6004
+ children: t("flowState.isolation")
6005
+ }),
6006
+ /* @__PURE__ */ jsx("p", {
6007
+ className: "m-0",
6008
+ children: t("flowState.retention")
6009
+ }),
6010
+ data != null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("p", {
6011
+ className: "m-0",
6012
+ children: t("flowState.valueLimit", { size: data.limits.maxValueBytes.toLocaleString() })
6013
+ }), /* @__PURE__ */ jsx("p", {
6014
+ className: "m-0",
6015
+ children: t("flowState.sharedLimit", {
6016
+ count: data.spaces.length,
6017
+ limit: data.limits.maxSpaces
6018
+ })
6019
+ })] })
6020
+ ]
6021
+ })
6022
+ })] })
6023
+ ]
6024
+ }),
6025
+ error && /* @__PURE__ */ jsx("p", {
6026
+ role: "alert",
6027
+ className: "text-destructive",
6028
+ children: error
6029
+ }),
6030
+ confirm && /* @__PURE__ */ jsxs("div", {
6031
+ role: "alert",
6032
+ className: "flex flex-col gap-2 rounded border border-border p-3",
6033
+ children: [
6034
+ /* @__PURE__ */ jsx("p", { children: t("flowState.confirmLive") }),
6035
+ /* @__PURE__ */ jsx("p", {
6036
+ className: "break-all",
6037
+ children: confirm.space ?? confirm.key ?? t("flowState.values")
6038
+ }),
6039
+ /* @__PURE__ */ jsxs("div", {
6040
+ className: "flex gap-2",
6041
+ children: [/* @__PURE__ */ jsx(Button$1, {
6042
+ disabled: busy,
6043
+ variant: "destructive",
6044
+ onClick: () => void clear(confirm),
6045
+ children: t("flowState.clear")
6046
+ }), /* @__PURE__ */ jsx(Button$1, {
6047
+ disabled: busy,
6048
+ variant: "outline",
6049
+ onClick: () => setConfirm(void 0),
6050
+ children: t("flowState.cancel")
6051
+ })]
6052
+ })
6053
+ ]
6054
+ }),
6055
+ data == null ? /* @__PURE__ */ jsx("p", {
6056
+ role: "status",
6057
+ children: error == null ? t("flowState.loading") : ""
6058
+ }) : /* @__PURE__ */ jsx(FlowStatePanel, {
6059
+ value: data,
6060
+ space: scope === "live" && history != null ? ["flow", `node:${history.nodeId}`] : space,
6061
+ nodeIds,
6062
+ busy,
6063
+ onClearValues: (key) => request({ key }),
6064
+ onClearSpace: (targetSpace) => request({ space: targetSpace })
6065
+ })
6066
+ ]
6067
+ })]
6068
+ })
6069
+ });
6070
+ }
5684
6071
  //#endregion
5685
6072
  //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/root/SwitchRootContext.js
5686
6073
  var SwitchRootContext = /*#__PURE__*/ React.createContext(void 0);
@@ -5741,7 +6128,7 @@ var SwitchRootDataAttributes = /*#__PURE__*/ function(SwitchRootDataAttributes)
5741
6128
  }({});
5742
6129
  //#endregion
5743
6130
  //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/switch/stateAttributesMapping.js
5744
- var stateAttributesMapping$2 = {
6131
+ var stateAttributesMapping = {
5745
6132
  ...fieldValidityMapping,
5746
6133
  checked(value) {
5747
6134
  if (value) return { [SwitchRootDataAttributes.checked]: "" };
@@ -5895,7 +6282,7 @@ var SwitchRoot = /*#__PURE__*/ React.forwardRef(function SwitchRoot(componentPro
5895
6282
  elementProps,
5896
6283
  getButtonProps
5897
6284
  ],
5898
- stateAttributesMapping: stateAttributesMapping$2
6285
+ stateAttributesMapping
5899
6286
  });
5900
6287
  return /*#__PURE__*/ jsxs(SwitchRootContext.Provider, {
5901
6288
  value: state,
@@ -5934,7 +6321,7 @@ var SwitchThumb = /*#__PURE__*/ React.forwardRef(function SwitchThumb(componentP
5934
6321
  return useRenderElement("span", componentProps, {
5935
6322
  state: extendedState,
5936
6323
  ref: forwardedRef,
5937
- stateAttributesMapping: stateAttributesMapping$2,
6324
+ stateAttributesMapping,
5938
6325
  props: elementProps
5939
6326
  });
5940
6327
  });
@@ -6386,2185 +6773,6 @@ function WorkflowCandidateName({ item }) {
6386
6773
  })] });
6387
6774
  }
6388
6775
  //#endregion
6389
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRootContext.js
6390
- var ComboboxRootContext = /*#__PURE__*/ React.createContext(void 0);
6391
- if (process.env.NODE_ENV !== "production") ComboboxRootContext.displayName = "ComboboxRootContext";
6392
- var ComboboxFloatingContext = /*#__PURE__*/ React.createContext(void 0);
6393
- if (process.env.NODE_ENV !== "production") ComboboxFloatingContext.displayName = "ComboboxFloatingContext";
6394
- var ComboboxDerivedItemsContext = /*#__PURE__*/ React.createContext(void 0);
6395
- if (process.env.NODE_ENV !== "production") ComboboxDerivedItemsContext.displayName = "ComboboxDerivedItemsContext";
6396
- var ComboboxInputValueContext = /*#__PURE__*/ React.createContext("");
6397
- if (process.env.NODE_ENV !== "production") ComboboxInputValueContext.displayName = "ComboboxInputValueContext";
6398
- function useComboboxRootContext() {
6399
- const context = React.useContext(ComboboxRootContext);
6400
- if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxRootContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(22));
6401
- return context;
6402
- }
6403
- function useComboboxFloatingContext() {
6404
- const context = React.useContext(ComboboxFloatingContext);
6405
- if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxFloatingContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(23));
6406
- return context;
6407
- }
6408
- function useComboboxDerivedItemsContext() {
6409
- const context = React.useContext(ComboboxDerivedItemsContext);
6410
- if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxItemsContext is missing. Combobox parts must be placed within <Combobox.Root>." : formatErrorMessage(24));
6411
- return context;
6412
- }
6413
- function useComboboxInputValueContext() {
6414
- return React.useContext(ComboboxInputValueContext);
6415
- }
6416
- //#endregion
6417
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/store.js
6418
- var selectors = {
6419
- id: createSelector((state) => state.id),
6420
- labelId: createSelector((state) => state.labelId),
6421
- items: createSelector((state) => state.items),
6422
- selectedValue: createSelector((state) => state.selectedValue),
6423
- hasSelectionChips: createSelector((state) => {
6424
- const selectedValue = state.selectedValue;
6425
- return Array.isArray(selectedValue) && selectedValue.length > 0;
6426
- }),
6427
- hasSelectedValue: createSelector((state) => {
6428
- const { selectedValue, selectionMode } = state;
6429
- if (selectedValue == null) return false;
6430
- if (selectionMode === "multiple" && Array.isArray(selectedValue)) return selectedValue.length > 0;
6431
- return true;
6432
- }),
6433
- hasNullItemLabel: createSelector((state, enabled) => {
6434
- return enabled ? hasNullItemLabel(state.items) : false;
6435
- }),
6436
- open: createSelector((state) => state.open),
6437
- mounted: createSelector((state) => state.mounted),
6438
- forceMounted: createSelector((state) => state.forceMounted),
6439
- inline: createSelector((state) => state.inline),
6440
- activeIndex: createSelector((state) => state.activeIndex),
6441
- selectedIndex: createSelector((state) => state.selectedIndex),
6442
- isActive: createSelector((state, index) => state.activeIndex === index),
6443
- isSelected: createSelector((state, itemValue) => {
6444
- const comparer = state.isItemEqualToValue;
6445
- const selectedValue = state.selectedValue;
6446
- if (Array.isArray(selectedValue)) return selectedValue.some((selectedItem) => compareItemEquality(itemValue, selectedItem, comparer));
6447
- return compareItemEquality(itemValue, selectedValue, comparer);
6448
- }),
6449
- transitionStatus: createSelector((state) => state.transitionStatus),
6450
- popupProps: createSelector((state) => state.popupProps),
6451
- inputProps: createSelector((state) => state.inputProps),
6452
- triggerProps: createSelector((state) => state.triggerProps),
6453
- getItemProps: createSelector((state) => state.getItemProps),
6454
- positionerElement: createSelector((state) => state.positionerElement),
6455
- listElement: createSelector((state) => state.listElement),
6456
- triggerElement: createSelector((state) => state.triggerElement),
6457
- inputElement: createSelector((state) => state.inputElement),
6458
- inputGroupElement: createSelector((state) => state.inputGroupElement),
6459
- popupSide: createSelector((state) => state.popupSide),
6460
- openMethod: createSelector((state) => state.openMethod),
6461
- inputInsidePopup: createSelector((state) => state.inputInsidePopup),
6462
- selectionMode: createSelector((state) => state.selectionMode),
6463
- name: createSelector((state) => state.name),
6464
- form: createSelector((state) => state.form),
6465
- disabled: createSelector((state) => state.disabled),
6466
- readOnly: createSelector((state) => state.readOnly),
6467
- required: createSelector((state) => state.required),
6468
- grid: createSelector((state) => state.grid),
6469
- virtualized: createSelector((state) => state.virtualized),
6470
- itemToStringLabel: createSelector((state) => state.itemToStringLabel),
6471
- isItemEqualToValue: createSelector((state) => state.isItemEqualToValue),
6472
- modal: createSelector((state) => state.modal),
6473
- autoHighlight: createSelector((state) => state.autoHighlight),
6474
- submitOnItemClick: createSelector((state) => state.submitOnItemClick)
6475
- };
6476
- //#endregion
6477
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/index.js
6478
- /**
6479
- * Enhanced filter using Intl.Collator for more robust string matching.
6480
- * Uses the provided `itemToStringLabel` function if available, otherwise falls back to:
6481
- * • When `item` is an object with a `value` property, that property is used.
6482
- * • When `item` is a primitive (e.g. `string`), it is used directly.
6483
- */
6484
- function createCollatorItemFilter(collatorFilter, itemToStringLabel) {
6485
- return (item, query) => {
6486
- if (item == null) return false;
6487
- const itemString = stringifyAsLabel(item, itemToStringLabel);
6488
- return collatorFilter.contains(itemString, query);
6489
- };
6490
- }
6491
- /**
6492
- * Enhanced filter for single selection mode using Intl.Collator that shows all items
6493
- * when query is empty or matches the current selection, making it easier to browse options.
6494
- */
6495
- function createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue) {
6496
- return (item, query) => {
6497
- if (item == null) return false;
6498
- if (!query) return true;
6499
- const itemString = stringifyAsLabel(item, itemToStringLabel);
6500
- const selectedString = selectedValue != null ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
6501
- if (selectedString && collatorFilter.contains(selectedString, query) && selectedString.length === query.length) return true;
6502
- return collatorFilter.contains(itemString, query);
6503
- };
6504
- }
6505
- //#endregion
6506
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/internals/filter.js
6507
- var filterCache = /* @__PURE__ */ new Map();
6508
- function getFilter(options = {}) {
6509
- const mergedOptions = {
6510
- usage: "search",
6511
- sensitivity: "base",
6512
- ignorePunctuation: true,
6513
- ...options
6514
- };
6515
- const cacheKey = `${stringifyLocale(options.locale)}|${JSON.stringify(mergedOptions)}`;
6516
- const cachedFilter = filterCache.get(cacheKey);
6517
- if (cachedFilter) return cachedFilter;
6518
- const collator = new Intl.Collator(options.locale, mergedOptions);
6519
- const filter = {
6520
- contains(item, query, itemToString) {
6521
- if (!query) return true;
6522
- const itemString = stringifyAsLabel(item, itemToString);
6523
- for (let i = 0; i <= itemString.length - query.length; i += 1) if (collator.compare(itemString.slice(i, i + query.length), query) === 0) return true;
6524
- return false;
6525
- },
6526
- startsWith(item, query, itemToString) {
6527
- if (!query) return true;
6528
- const itemString = stringifyAsLabel(item, itemToString);
6529
- return collator.compare(itemString.slice(0, query.length), query) === 0;
6530
- },
6531
- endsWith(item, query, itemToString) {
6532
- if (!query) return true;
6533
- const itemString = stringifyAsLabel(item, itemToString);
6534
- const queryLength = query.length;
6535
- return itemString.length >= queryLength && collator.compare(itemString.slice(itemString.length - queryLength), query) === 0;
6536
- }
6537
- };
6538
- filterCache.set(cacheKey, filter);
6539
- return filter;
6540
- }
6541
- function stringifyLocale(locale) {
6542
- if (Array.isArray(locale)) return locale.map((value) => stringifyLocale(value)).join(",");
6543
- if (locale == null) return "";
6544
- return String(locale);
6545
- }
6546
- //#endregion
6547
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/useFilter.js
6548
- /**
6549
- * Matches items against a query using `Intl.Collator` for robust string matching.
6550
- */
6551
- var useCoreFilter = getFilter;
6552
- //#endregion
6553
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/utils/constants.js
6554
- var NO_ACTIVE_VALUE = Symbol("none");
6555
- var INITIAL_LAST_HIGHLIGHT = {
6556
- value: NO_ACTIVE_VALUE,
6557
- index: -1
6558
- };
6559
- //#endregion
6560
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/AriaCombobox.js
6561
- /**
6562
- * @internal
6563
- */
6564
- function AriaCombobox(props) {
6565
- const { id: idProp, onOpenChangeComplete: onOpenChangeCompleteProp, defaultSelectedValue = null, selectedValue: selectedValueProp, onSelectedValueChange, defaultInputValue: defaultInputValueProp, inputValue: inputValueProp, open: openProp, defaultOpen = false, selectionMode = "none", onItemHighlighted: onItemHighlightedProp, name: nameProp, form, disabled: disabledProp = false, readOnly = false, required = false, inputRef: inputRefProp, grid = false, items, filteredItems: filteredItemsProp, filter: filterProp, openOnInputClick = true, autoHighlight = false, keepHighlight = false, highlightItemOnHover = true, loopFocus = true, itemToStringLabel, itemToStringValue, isItemEqualToValue = defaultItemEquality, virtualized = false, inline: inlineProp = false, fillInputOnItemPress = true, modal = false, limit = -1, autoComplete = "list", formAutoComplete, locale, submitOnItemClick = false } = props;
6566
- const { clearErrors } = useFormContext();
6567
- const { setDirty, validityData, shouldValidateOnChange, setFilled, name: fieldName, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
6568
- const id = useLabelableId({ id: idProp });
6569
- const collatorFilter = useCoreFilter({ locale });
6570
- const [queryChangedAfterOpen, setQueryChangedAfterOpen] = React.useState(false);
6571
- const [closeQuery, setCloseQuery] = React.useState(null);
6572
- const listRef = React.useRef([]);
6573
- const labelsRef = React.useRef([]);
6574
- const popupRef = React.useRef(null);
6575
- const inputRef = React.useRef(null);
6576
- const startDismissRef = React.useRef(null);
6577
- const endDismissRef = React.useRef(null);
6578
- const emptyRef = React.useRef(null);
6579
- const keyboardActiveRef = React.useRef(true);
6580
- const hadInputClearRef = React.useRef(false);
6581
- const chipsContainerRef = React.useRef(null);
6582
- const clearRef = React.useRef(null);
6583
- const selectionEventRef = React.useRef(null);
6584
- const lastHighlightRef = React.useRef(INITIAL_LAST_HIGHLIGHT);
6585
- const pendingQueryHighlightRef = React.useRef(null);
6586
- /**
6587
- * Contains the currently visible list of item values post-filtering.
6588
- */
6589
- const valuesRef = React.useRef([]);
6590
- /**
6591
- * Contains all item values in a stable, unfiltered order.
6592
- * This is only used when `items` prop is not provided.
6593
- * It accumulates values on first mount and does not remove them on unmount due to
6594
- * filtering, providing a stable index for selected value tracking.
6595
- */
6596
- const allValuesRef = React.useRef([]);
6597
- const disabled = fieldDisabled || disabledProp;
6598
- const name = fieldName ?? nameProp;
6599
- const multiple = selectionMode === "multiple";
6600
- const single = selectionMode === "single";
6601
- const hasInputValue = inputValueProp !== void 0 || defaultInputValueProp !== void 0;
6602
- const hasItems = items !== void 0;
6603
- const hasFilteredItemsProp = filteredItemsProp !== void 0;
6604
- let autoHighlightMode;
6605
- if (autoHighlight === "always") autoHighlightMode = "always";
6606
- else autoHighlightMode = autoHighlight ? "input-change" : false;
6607
- const [selectedValue, setSelectedValueUnwrapped] = useControlled({
6608
- controlled: selectedValueProp,
6609
- default: multiple ? defaultSelectedValue ?? EMPTY_ARRAY$1 : defaultSelectedValue,
6610
- name: "Combobox",
6611
- state: "selectedValue"
6612
- });
6613
- const filter = React.useMemo(() => {
6614
- if (filterProp === null) return () => true;
6615
- if (filterProp !== void 0) return filterProp;
6616
- if (single && !queryChangedAfterOpen) return createSingleSelectionCollatorFilter(collatorFilter, itemToStringLabel, selectedValue);
6617
- return createCollatorItemFilter(collatorFilter, itemToStringLabel);
6618
- }, [
6619
- filterProp,
6620
- single,
6621
- selectedValue,
6622
- queryChangedAfterOpen,
6623
- collatorFilter,
6624
- itemToStringLabel
6625
- ]);
6626
- const initialDefaultInputValue = useRefWithInit(() => {
6627
- if (hasInputValue) return defaultInputValueProp ?? "";
6628
- if (single) return stringifyAsLabel(selectedValue, itemToStringLabel);
6629
- return "";
6630
- }).current;
6631
- const [inputValue, setInputValueUnwrapped] = useControlled({
6632
- controlled: inputValueProp,
6633
- default: initialDefaultInputValue,
6634
- name: "Combobox",
6635
- state: "inputValue"
6636
- });
6637
- const [open, setOpenUnwrapped] = useControlled({
6638
- controlled: openProp,
6639
- default: defaultOpen,
6640
- name: "Combobox",
6641
- state: "open"
6642
- });
6643
- const isGrouped = isGroupedItems(items);
6644
- const query = closeQuery ?? (inputValue === "" ? "" : String(inputValue).trim());
6645
- const selectedLabelString = single ? stringifyAsLabel(selectedValue, itemToStringLabel) : "";
6646
- const shouldBypassFiltering = single && !queryChangedAfterOpen && query !== "" && selectedLabelString !== "" && selectedLabelString.length === query.length && collatorFilter.contains(selectedLabelString, query);
6647
- const filterQuery = shouldBypassFiltering ? "" : query;
6648
- const shouldIgnoreExternalFiltering = hasItems && hasFilteredItemsProp && shouldBypassFiltering;
6649
- const flatItems = React.useMemo(() => {
6650
- if (!items) return EMPTY_ARRAY$1;
6651
- if (isGrouped) return items.flatMap((group) => group.items);
6652
- return items;
6653
- }, [items, isGrouped]);
6654
- const filteredItems = React.useMemo(() => {
6655
- if (filteredItemsProp && !shouldIgnoreExternalFiltering) return filteredItemsProp;
6656
- if (!items) return EMPTY_ARRAY$1;
6657
- if (isGrouped) {
6658
- const groupedItems = items;
6659
- const resultingGroups = [];
6660
- let currentCount = 0;
6661
- for (const group of groupedItems) {
6662
- if (limit > -1 && currentCount >= limit) break;
6663
- const candidateItems = filterQuery === "" ? group.items : group.items.filter((item) => filter(item, filterQuery, itemToStringLabel));
6664
- if (candidateItems.length === 0) continue;
6665
- const remainingLimit = limit > -1 ? limit - currentCount : Infinity;
6666
- const itemsToTake = candidateItems.slice(0, remainingLimit);
6667
- if (itemsToTake.length > 0) {
6668
- const newGroup = {
6669
- ...group,
6670
- items: itemsToTake
6671
- };
6672
- resultingGroups.push(newGroup);
6673
- currentCount += itemsToTake.length;
6674
- }
6675
- }
6676
- return resultingGroups;
6677
- }
6678
- if (filterQuery === "") return limit > -1 ? flatItems.slice(0, limit) : flatItems;
6679
- const limitedItems = [];
6680
- for (const item of flatItems) {
6681
- if (limit > -1 && limitedItems.length >= limit) break;
6682
- if (filter(item, filterQuery, itemToStringLabel)) limitedItems.push(item);
6683
- }
6684
- return limitedItems;
6685
- }, [
6686
- filteredItemsProp,
6687
- shouldIgnoreExternalFiltering,
6688
- items,
6689
- isGrouped,
6690
- filterQuery,
6691
- limit,
6692
- filter,
6693
- itemToStringLabel,
6694
- flatItems
6695
- ]);
6696
- const flatFilteredItems = React.useMemo(() => {
6697
- if (isGrouped) return filteredItems.flatMap((g) => g.items);
6698
- return filteredItems;
6699
- }, [filteredItems, isGrouped]);
6700
- const store = useRefWithInit(() => new Store({
6701
- id,
6702
- labelId: void 0,
6703
- selectedValue,
6704
- open,
6705
- filter,
6706
- query,
6707
- items,
6708
- selectionMode,
6709
- listRef,
6710
- labelsRef,
6711
- popupRef,
6712
- emptyRef,
6713
- inputRef,
6714
- startDismissRef,
6715
- endDismissRef,
6716
- keyboardActiveRef,
6717
- chipsContainerRef,
6718
- clearRef,
6719
- valuesRef,
6720
- allValuesRef,
6721
- selectionEventRef,
6722
- name,
6723
- form,
6724
- disabled,
6725
- readOnly,
6726
- required,
6727
- grid,
6728
- isGrouped,
6729
- virtualized,
6730
- openOnInputClick,
6731
- itemToStringLabel,
6732
- isItemEqualToValue,
6733
- modal,
6734
- autoHighlight: autoHighlightMode,
6735
- submitOnItemClick,
6736
- hasInputValue,
6737
- mounted: false,
6738
- forceMounted: false,
6739
- transitionStatus: "idle",
6740
- inline: inlineProp,
6741
- activeIndex: null,
6742
- selectedIndex: null,
6743
- popupProps: {},
6744
- inputProps: {},
6745
- triggerProps: {},
6746
- positionerElement: null,
6747
- listElement: null,
6748
- triggerElement: null,
6749
- inputElement: null,
6750
- inputGroupElement: null,
6751
- popupSide: null,
6752
- openMethod: null,
6753
- inputInsidePopup: true,
6754
- onOpenChangeComplete: onOpenChangeCompleteProp || NOOP,
6755
- setOpen: NOOP,
6756
- setInputValue: NOOP,
6757
- setSelectedValue: NOOP,
6758
- setIndices: NOOP,
6759
- onItemHighlighted: NOOP,
6760
- handleSelection: NOOP,
6761
- getItemProps: () => EMPTY_OBJECT,
6762
- forceMount: NOOP,
6763
- requestSubmit: NOOP
6764
- })).current;
6765
- const fieldRawValue = selectionMode === "none" ? inputValue : selectedValue;
6766
- const fieldStringValue = React.useMemo(() => {
6767
- if (selectionMode === "none") return fieldRawValue;
6768
- if (Array.isArray(selectedValue)) return selectedValue.map((value) => stringifyAsValue(value, itemToStringValue));
6769
- return stringifyAsValue(selectedValue, itemToStringValue);
6770
- }, [
6771
- fieldRawValue,
6772
- itemToStringValue,
6773
- selectionMode,
6774
- selectedValue
6775
- ]);
6776
- const onItemHighlighted = useStableCallback(onItemHighlightedProp);
6777
- const onOpenChangeComplete = useStableCallback(onOpenChangeCompleteProp);
6778
- const activeIndex = useStore(store, selectors.activeIndex);
6779
- const selectedIndex = useStore(store, selectors.selectedIndex);
6780
- const positionerElement = useStore(store, selectors.positionerElement);
6781
- const listElement = useStore(store, selectors.listElement);
6782
- const triggerElement = useStore(store, selectors.triggerElement);
6783
- const inputElement = useStore(store, selectors.inputElement);
6784
- const inputGroupElement = useStore(store, selectors.inputGroupElement);
6785
- const inline = useStore(store, selectors.inline);
6786
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
6787
- const triggerRef = useValueAsRef(triggerElement);
6788
- const { mounted, setMounted, transitionStatus } = useTransitionStatus(open);
6789
- const { openMethod, triggerProps } = useOpenInteractionType(open);
6790
- const getFieldValue = useStableCallback(() => fieldStringValue);
6791
- useRegisterFieldControl(inputInsidePopup ? triggerRef : inputRef, {
6792
- id,
6793
- value: fieldRawValue,
6794
- getValue: getFieldValue
6795
- });
6796
- const forceMount = useStableCallback(() => {
6797
- if (items) labelsRef.current = flatFilteredItems.map((item) => stringifyAsLabel(item, itemToStringLabel));
6798
- else store.set("forceMounted", true);
6799
- });
6800
- const initialSelectedValueRef = React.useRef(selectedValue);
6801
- useIsoLayoutEffect(() => {
6802
- if (selectedValue !== initialSelectedValueRef.current) forceMount();
6803
- }, [forceMount, selectedValue]);
6804
- const setIndices = useStableCallback((options) => {
6805
- store.update(options);
6806
- const type = options.type || "none";
6807
- if (options.activeIndex === void 0) return;
6808
- if (options.activeIndex === null) {
6809
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
6810
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
6811
- onItemHighlighted(void 0, createGenericEventDetails(type, void 0, { index: -1 }));
6812
- }
6813
- } else {
6814
- const activeValue = valuesRef.current[options.activeIndex];
6815
- lastHighlightRef.current = {
6816
- value: activeValue,
6817
- index: options.activeIndex
6818
- };
6819
- onItemHighlighted(activeValue, createGenericEventDetails(type, void 0, { index: options.activeIndex }));
6820
- }
6821
- });
6822
- const setInputValue = useStableCallback((next, eventDetails) => {
6823
- hadInputClearRef.current = eventDetails.reason === inputClear;
6824
- props.onInputValueChange?.(next, eventDetails);
6825
- if (eventDetails.isCanceled) return;
6826
- if (eventDetails.reason === "input-change") {
6827
- const event = eventDetails.event;
6828
- const inputType = event.inputType;
6829
- if (event.type === "compositionend" || inputType != null && inputType !== "" && inputType !== "insertReplacementText") {
6830
- const hasQuery = next.trim() !== "";
6831
- if (hasQuery) setQueryChangedAfterOpen(true);
6832
- pendingQueryHighlightRef.current = { hasQuery };
6833
- if (hasQuery && autoHighlightMode && store.state.activeIndex == null) store.set("activeIndex", 0);
6834
- }
6835
- }
6836
- setInputValueUnwrapped(next);
6837
- });
6838
- const setOpen = useStableCallback((nextOpen, eventDetails) => {
6839
- if (open === nextOpen) return;
6840
- if (eventDetails.reason === "escape-key" && hasItems && flatFilteredItems.length === 0 && !store.state.emptyRef.current) eventDetails.allowPropagation();
6841
- props.onOpenChange?.(nextOpen, eventDetails);
6842
- if (eventDetails.isCanceled) return;
6843
- if (!nextOpen && queryChangedAfterOpen) {
6844
- if (single) {
6845
- if (!inline) setCloseQuery(query);
6846
- if (query === "") setQueryChangedAfterOpen(false);
6847
- } else if (multiple) {
6848
- if (inline || inputInsidePopup) setIndices({ activeIndex: null });
6849
- else setCloseQuery(query);
6850
- setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
6851
- }
6852
- }
6853
- setOpenUnwrapped(nextOpen);
6854
- if (!nextOpen && inputInsidePopup && (eventDetails.reason === "focus-out" || eventDetails.reason === "outside-press")) {
6855
- setTouched(true);
6856
- setFocused(false);
6857
- if (validationMode === "onBlur") {
6858
- const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
6859
- validation.commit(valueToValidate);
6860
- }
6861
- }
6862
- });
6863
- const setSelectedValue = useStableCallback((nextValue, eventDetails) => {
6864
- onSelectedValueChange?.(nextValue, eventDetails);
6865
- if (eventDetails.isCanceled) return;
6866
- setSelectedValueUnwrapped(nextValue);
6867
- if (selectionMode === "none" && popupRef.current && fillInputOnItemPress || single && !store.state.inputInsidePopup) setInputValue(stringifyAsLabel(nextValue, itemToStringLabel), createChangeEventDetails(eventDetails.reason, eventDetails.event));
6868
- if (single && nextValue != null && eventDetails.reason !== "input-change" && queryChangedAfterOpen && !inline) setCloseQuery(query);
6869
- });
6870
- const handleSelection = useStableCallback((event, passedValue) => {
6871
- let itemValue = passedValue;
6872
- if (itemValue === void 0) {
6873
- if (activeIndex === null) return;
6874
- itemValue = valuesRef.current[activeIndex];
6875
- }
6876
- const targetEl = getTarget(event);
6877
- const overrideEvent = selectionEventRef.current ?? event;
6878
- selectionEventRef.current = null;
6879
- const eventDetails = createChangeEventDetails(itemPress, overrideEvent);
6880
- const href = targetEl?.closest("a")?.getAttribute("href");
6881
- if (href) {
6882
- if (href.startsWith("#")) setOpen(false, eventDetails);
6883
- return;
6884
- }
6885
- if (multiple) {
6886
- const currentSelectedValue = Array.isArray(selectedValue) ? selectedValue : [];
6887
- const nextValue = selectedValueIncludes(currentSelectedValue, itemValue, store.state.isItemEqualToValue) ? removeItem(currentSelectedValue, itemValue, store.state.isItemEqualToValue) : [...currentSelectedValue, itemValue];
6888
- setSelectedValue(nextValue, eventDetails);
6889
- if (!(inputRef.current ? inputRef.current.value.trim() !== "" : false)) return;
6890
- if (store.state.inputInsidePopup) setInputValue("", createChangeEventDetails(inputClear, eventDetails.event));
6891
- else setOpen(false, eventDetails);
6892
- } else {
6893
- setSelectedValue(itemValue, eventDetails);
6894
- setOpen(false, eventDetails);
6895
- }
6896
- });
6897
- const requestSubmit = useStableCallback(() => {
6898
- if (!store.state.submitOnItemClick) return;
6899
- const formElement = validation.inputRef.current?.form ?? store.state.inputElement?.form;
6900
- if (formElement && typeof formElement.requestSubmit === "function") formElement.requestSubmit();
6901
- });
6902
- const handleUnmount = useStableCallback(() => {
6903
- setMounted(false);
6904
- onOpenChangeComplete?.(false);
6905
- setQueryChangedAfterOpen(false);
6906
- setCloseQuery(null);
6907
- if (selectionMode === "none") setIndices({
6908
- activeIndex: null,
6909
- selectedIndex: null
6910
- });
6911
- else setIndices({ activeIndex: null });
6912
- if (multiple && inputRef.current && inputRef.current.value !== "" && !hadInputClearRef.current) setInputValue("", createChangeEventDetails(inputClear));
6913
- if (single) {
6914
- if (store.state.inputInsidePopup) {
6915
- if (inputRef.current && inputRef.current.value !== "") setInputValue("", createChangeEventDetails(inputClear));
6916
- } else {
6917
- const stringVal = stringifyAsLabel(selectedValue, itemToStringLabel);
6918
- if (inputRef.current && inputRef.current.value !== stringVal) setInputValue(stringVal, createChangeEventDetails(stringVal === "" ? inputClear : none));
6919
- }
6920
- }
6921
- });
6922
- const resolvedPopupRef = React.useMemo(() => {
6923
- if (inline && positionerElement) return { current: positionerElement.closest("[role=\"dialog\"]") };
6924
- return popupRef;
6925
- }, [inline, positionerElement]);
6926
- useOpenChangeComplete({
6927
- enabled: !props.actionsRef,
6928
- open,
6929
- ref: resolvedPopupRef,
6930
- onComplete() {
6931
- if (!open) handleUnmount();
6932
- }
6933
- });
6934
- React.useImperativeHandle(props.actionsRef, () => ({ unmount: handleUnmount }), [handleUnmount]);
6935
- useIsoLayoutEffect(function syncSelectedIndex() {
6936
- if (open || selectionMode === "none") return;
6937
- const registry = items ? flatItems : allValuesRef.current;
6938
- if (multiple) {
6939
- const currentValue = Array.isArray(selectedValue) ? selectedValue : [];
6940
- const lastValue = currentValue[currentValue.length - 1];
6941
- const lastIndex = findItemIndex(registry, lastValue, isItemEqualToValue);
6942
- setIndices({ selectedIndex: lastIndex === -1 ? null : lastIndex });
6943
- } else {
6944
- const index = findItemIndex(registry, selectedValue, isItemEqualToValue);
6945
- setIndices({ selectedIndex: index === -1 ? null : index });
6946
- }
6947
- }, [
6948
- open,
6949
- selectedValue,
6950
- items,
6951
- selectionMode,
6952
- flatItems,
6953
- multiple,
6954
- isItemEqualToValue,
6955
- setIndices
6956
- ]);
6957
- useIsoLayoutEffect(() => {
6958
- if (items) {
6959
- valuesRef.current = flatFilteredItems;
6960
- listRef.current.length = flatFilteredItems.length;
6961
- }
6962
- }, [items, flatFilteredItems]);
6963
- useIsoLayoutEffect(() => {
6964
- const pendingHighlight = pendingQueryHighlightRef.current;
6965
- if (pendingHighlight) {
6966
- if (pendingHighlight.hasQuery) {
6967
- if (autoHighlightMode) store.set("activeIndex", 0);
6968
- } else if (autoHighlightMode === "always") store.set("activeIndex", 0);
6969
- pendingQueryHighlightRef.current = null;
6970
- }
6971
- if (!open && !inline) return;
6972
- const candidateItems = hasItems || hasFilteredItemsProp ? flatFilteredItems : valuesRef.current;
6973
- const storeActiveIndex = store.state.activeIndex;
6974
- if (storeActiveIndex == null) {
6975
- if (autoHighlightMode === "always" && candidateItems.length > 0) {
6976
- store.set("activeIndex", 0);
6977
- return;
6978
- }
6979
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
6980
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
6981
- store.state.onItemHighlighted(void 0, createGenericEventDetails(none, void 0, { index: -1 }));
6982
- }
6983
- return;
6984
- }
6985
- if (storeActiveIndex >= candidateItems.length) {
6986
- if (lastHighlightRef.current !== INITIAL_LAST_HIGHLIGHT) {
6987
- lastHighlightRef.current = INITIAL_LAST_HIGHLIGHT;
6988
- store.state.onItemHighlighted(void 0, createGenericEventDetails(none, void 0, { index: -1 }));
6989
- }
6990
- store.set("activeIndex", null);
6991
- return;
6992
- }
6993
- const itemValue = candidateItems[storeActiveIndex];
6994
- const previouslyHighlightedItemValue = lastHighlightRef.current.value;
6995
- const isSameItem = previouslyHighlightedItemValue !== NO_ACTIVE_VALUE && compareItemEquality(itemValue, previouslyHighlightedItemValue, store.state.isItemEqualToValue);
6996
- if (lastHighlightRef.current.index !== storeActiveIndex || !isSameItem) {
6997
- lastHighlightRef.current = {
6998
- value: itemValue,
6999
- index: storeActiveIndex
7000
- };
7001
- store.state.onItemHighlighted(itemValue, createGenericEventDetails(none, void 0, { index: storeActiveIndex }));
7002
- }
7003
- }, [
7004
- activeIndex,
7005
- autoHighlightMode,
7006
- hasFilteredItemsProp,
7007
- hasItems,
7008
- flatFilteredItems,
7009
- inline,
7010
- open,
7011
- store
7012
- ]);
7013
- useIsoLayoutEffect(() => {
7014
- if (selectionMode === "none") {
7015
- setFilled(String(inputValue) !== "");
7016
- return;
7017
- }
7018
- setFilled(multiple ? Array.isArray(selectedValue) && selectedValue.length > 0 : selectedValue != null);
7019
- }, [
7020
- setFilled,
7021
- selectionMode,
7022
- inputValue,
7023
- selectedValue,
7024
- multiple
7025
- ]);
7026
- React.useEffect(() => {
7027
- if (hasItems && autoHighlightMode && flatFilteredItems.length === 0) setIndices({ activeIndex: null });
7028
- }, [
7029
- hasItems,
7030
- autoHighlightMode,
7031
- flatFilteredItems.length,
7032
- setIndices
7033
- ]);
7034
- useValueChanged(query, () => {
7035
- if (!open || query === "" || query === String(initialDefaultInputValue)) return;
7036
- setQueryChangedAfterOpen(true);
7037
- });
7038
- useValueChanged(selectedValue, () => {
7039
- if (selectionMode === "none") return;
7040
- clearErrors(name);
7041
- setDirty(selectedValue !== validityData.initialValue);
7042
- if (shouldValidateOnChange()) validation.commit(selectedValue);
7043
- else validation.commit(selectedValue, true);
7044
- if (single && !hasInputValue && !inputInsidePopup) {
7045
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
7046
- if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none));
7047
- }
7048
- });
7049
- useValueChanged(inputValue, () => {
7050
- if (selectionMode !== "none") return;
7051
- clearErrors(name);
7052
- setDirty(inputValue !== validityData.initialValue);
7053
- if (shouldValidateOnChange()) validation.commit(inputValue);
7054
- else validation.commit(inputValue, true);
7055
- });
7056
- useValueChanged(items, () => {
7057
- if (!single || hasInputValue || inputInsidePopup || queryChangedAfterOpen) return;
7058
- const nextInputValue = stringifyAsLabel(selectedValue, itemToStringLabel);
7059
- if (inputValue !== nextInputValue) setInputValue(nextInputValue, createChangeEventDetails(none));
7060
- });
7061
- const floatingRootContext = useFloatingRootContext({
7062
- open: inline ? true : open,
7063
- onOpenChange: setOpen,
7064
- elements: {
7065
- reference: inputInsidePopup ? triggerElement : inputElement,
7066
- floating: positionerElement
7067
- }
7068
- });
7069
- let ariaHasPopup;
7070
- let ariaExpanded;
7071
- if (!inline) {
7072
- ariaHasPopup = grid ? "grid" : "listbox";
7073
- ariaExpanded = open ? "true" : "false";
7074
- }
7075
- const role = React.useMemo(() => {
7076
- const isPlainInput = inputElement?.tagName === "INPUT";
7077
- const shouldTreatAsInput = inputElement == null || isPlainInput;
7078
- const shouldApplyAria = shouldTreatAsInput || open;
7079
- const reference = shouldTreatAsInput ? {
7080
- autoComplete: "off",
7081
- spellCheck: "false",
7082
- autoCorrect: "off",
7083
- autoCapitalize: "none"
7084
- } : {};
7085
- if (shouldApplyAria) {
7086
- reference.role = "combobox";
7087
- reference["aria-expanded"] = ariaExpanded;
7088
- reference["aria-haspopup"] = ariaHasPopup;
7089
- reference["aria-controls"] = open ? listElement?.id : void 0;
7090
- reference["aria-autocomplete"] = autoComplete;
7091
- }
7092
- return {
7093
- reference,
7094
- floating: { role: "presentation" }
7095
- };
7096
- }, [
7097
- inputElement,
7098
- open,
7099
- ariaExpanded,
7100
- ariaHasPopup,
7101
- listElement?.id,
7102
- autoComplete
7103
- ]);
7104
- const click = useClick(floatingRootContext, {
7105
- enabled: !readOnly && !disabled && openOnInputClick,
7106
- event: "mousedown-only",
7107
- toggle: false,
7108
- touchOpenDelay: inputInsidePopup ? 0 : 100,
7109
- reason: inputPress
7110
- });
7111
- const dismiss = useDismiss(floatingRootContext, {
7112
- enabled: !readOnly && !disabled && !inline,
7113
- outsidePressEvent: {
7114
- mouse: "sloppy",
7115
- touch: "intentional"
7116
- },
7117
- bubbles: inline ? true : void 0,
7118
- outsidePress(event) {
7119
- const target = getTarget(event);
7120
- return !contains(triggerElement, target) && !contains(clearRef.current, target) && !contains(chipsContainerRef.current, target) && !contains(inputGroupElement, target);
7121
- }
7122
- });
7123
- const listNavigation = useListNavigation(floatingRootContext, {
7124
- enabled: !readOnly && !disabled,
7125
- id,
7126
- listRef,
7127
- activeIndex,
7128
- selectedIndex,
7129
- virtual: true,
7130
- loopFocus,
7131
- allowEscape: loopFocus && !autoHighlightMode,
7132
- focusItemOnOpen: queryChangedAfterOpen || selectionMode === "none" && !autoHighlightMode ? false : "auto",
7133
- focusItemOnHover: highlightItemOnHover,
7134
- resetOnPointerLeave: !keepHighlight,
7135
- cols: grid ? 2 : 1,
7136
- orientation: grid ? "horizontal" : void 0,
7137
- disabledIndices: EMPTY_ARRAY$1,
7138
- onNavigate(nextActiveIndex, event) {
7139
- if (!event && !open || transitionStatus === "ending") return;
7140
- if (!event) setIndices({ activeIndex: nextActiveIndex });
7141
- else setIndices({
7142
- activeIndex: nextActiveIndex,
7143
- type: keyboardActiveRef.current ? "keyboard" : "pointer"
7144
- });
7145
- }
7146
- });
7147
- const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([
7148
- role,
7149
- click,
7150
- dismiss,
7151
- listNavigation
7152
- ]);
7153
- useOnFirstRender(() => {
7154
- store.update({
7155
- inline: inlineProp,
7156
- popupProps: getFloatingProps(),
7157
- inputProps: getReferenceProps(),
7158
- triggerProps,
7159
- getItemProps,
7160
- setOpen,
7161
- setInputValue,
7162
- setSelectedValue,
7163
- setIndices,
7164
- onItemHighlighted,
7165
- handleSelection,
7166
- forceMount,
7167
- requestSubmit
7168
- });
7169
- });
7170
- useIsoLayoutEffect(() => {
7171
- store.update({
7172
- id,
7173
- selectedValue,
7174
- open,
7175
- mounted,
7176
- transitionStatus,
7177
- items,
7178
- inline: inlineProp,
7179
- popupProps: getFloatingProps(),
7180
- inputProps: getReferenceProps(),
7181
- triggerProps,
7182
- openMethod,
7183
- getItemProps,
7184
- selectionMode,
7185
- name,
7186
- form,
7187
- disabled,
7188
- readOnly,
7189
- required,
7190
- grid,
7191
- isGrouped,
7192
- virtualized,
7193
- onOpenChangeComplete,
7194
- openOnInputClick,
7195
- itemToStringLabel,
7196
- modal,
7197
- autoHighlight: autoHighlightMode,
7198
- isItemEqualToValue,
7199
- submitOnItemClick,
7200
- hasInputValue,
7201
- requestSubmit
7202
- });
7203
- }, [
7204
- store,
7205
- id,
7206
- selectedValue,
7207
- open,
7208
- mounted,
7209
- transitionStatus,
7210
- items,
7211
- getFloatingProps,
7212
- getReferenceProps,
7213
- getItemProps,
7214
- openMethod,
7215
- triggerProps,
7216
- selectionMode,
7217
- name,
7218
- disabled,
7219
- readOnly,
7220
- required,
7221
- validation,
7222
- grid,
7223
- isGrouped,
7224
- virtualized,
7225
- onOpenChangeComplete,
7226
- openOnInputClick,
7227
- itemToStringLabel,
7228
- modal,
7229
- isItemEqualToValue,
7230
- submitOnItemClick,
7231
- hasInputValue,
7232
- inlineProp,
7233
- requestSubmit,
7234
- autoHighlightMode,
7235
- form
7236
- ]);
7237
- const hiddenInputRef = useMergedRefs(inputRefProp, validation.inputRef);
7238
- const itemsContextValue = React.useMemo(() => ({
7239
- query,
7240
- hasItems,
7241
- filteredItems,
7242
- flatFilteredItems
7243
- }), [
7244
- query,
7245
- hasItems,
7246
- filteredItems,
7247
- flatFilteredItems
7248
- ]);
7249
- const serializedValue = React.useMemo(() => {
7250
- if (Array.isArray(fieldRawValue)) return "";
7251
- return stringifyAsValue(fieldRawValue, itemToStringValue);
7252
- }, [fieldRawValue, itemToStringValue]);
7253
- const hasMultipleSelection = multiple && Array.isArray(selectedValue) && selectedValue.length > 0;
7254
- const hiddenInputName = multiple || selectionMode === "none" ? void 0 : name;
7255
- const hiddenInputs = React.useMemo(() => {
7256
- if (!multiple || !Array.isArray(selectedValue) || !name) return null;
7257
- return selectedValue.map((value) => {
7258
- const currentSerializedValue = stringifyAsValue(value, itemToStringValue);
7259
- return /*#__PURE__*/ jsx("input", {
7260
- type: "hidden",
7261
- form,
7262
- name,
7263
- value: currentSerializedValue
7264
- }, currentSerializedValue);
7265
- });
7266
- }, [
7267
- multiple,
7268
- selectedValue,
7269
- form,
7270
- name,
7271
- itemToStringValue
7272
- ]);
7273
- const children = /*#__PURE__*/ jsxs(React.Fragment, { children: [
7274
- props.children,
7275
- /*#__PURE__*/ jsx("input", {
7276
- ...validation.getInputValidationProps({
7277
- onFocus() {
7278
- if (inputInsidePopup) {
7279
- triggerElement?.focus();
7280
- return;
7281
- }
7282
- (inputRef.current || triggerElement)?.focus();
7283
- },
7284
- onChange(event) {
7285
- if (event.nativeEvent.defaultPrevented) return;
7286
- const nextValue = event.currentTarget.value;
7287
- const details = createChangeEventDetails(none, event.nativeEvent);
7288
- function handleChange() {
7289
- if (multiple) return;
7290
- if (selectionMode === "none") {
7291
- setDirty(nextValue !== validityData.initialValue);
7292
- setInputValue(nextValue, details);
7293
- if (shouldValidateOnChange()) validation.commit(nextValue);
7294
- return;
7295
- }
7296
- const matchingValue = valuesRef.current.find((v) => {
7297
- if (stringifyAsValue(v, itemToStringValue).toLowerCase() === nextValue.toLowerCase()) return true;
7298
- if (stringifyAsLabel(v, itemToStringLabel).toLowerCase() === nextValue.toLowerCase()) return true;
7299
- return false;
7300
- });
7301
- if (matchingValue != null) {
7302
- setDirty(matchingValue !== validityData.initialValue);
7303
- setSelectedValue?.(matchingValue, details);
7304
- if (shouldValidateOnChange()) validation.commit(matchingValue);
7305
- }
7306
- }
7307
- if (items) handleChange();
7308
- else {
7309
- forceMount();
7310
- queueMicrotask(handleChange);
7311
- }
7312
- }
7313
- }),
7314
- id: id && hiddenInputName == null ? `${id}-hidden-input` : void 0,
7315
- form,
7316
- name: hiddenInputName,
7317
- autoComplete: formAutoComplete,
7318
- disabled,
7319
- required: required && !hasMultipleSelection,
7320
- readOnly,
7321
- value: serializedValue,
7322
- ref: hiddenInputRef,
7323
- style: hiddenInputName ? visuallyHiddenInput : visuallyHidden,
7324
- tabIndex: -1,
7325
- "aria-hidden": true,
7326
- suppressHydrationWarning: true
7327
- }),
7328
- hiddenInputs
7329
- ] });
7330
- return /*#__PURE__*/ jsx(ComboboxRootContext.Provider, {
7331
- value: store,
7332
- children: /*#__PURE__*/ jsx(ComboboxFloatingContext.Provider, {
7333
- value: floatingRootContext,
7334
- children: /*#__PURE__*/ jsx(ComboboxDerivedItemsContext.Provider, {
7335
- value: itemsContextValue,
7336
- children: /*#__PURE__*/ jsx(ComboboxInputValueContext.Provider, {
7337
- value: inputValue,
7338
- children
7339
- })
7340
- })
7341
- })
7342
- });
7343
- }
7344
- //#endregion
7345
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/root/ComboboxRoot.js
7346
- /**
7347
- * Groups all parts of the combobox.
7348
- * Doesn't render its own HTML element.
7349
- *
7350
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7351
- */
7352
- function ComboboxRoot(props) {
7353
- const { multiple = false, defaultValue, value, onValueChange, autoComplete, ...other } = props;
7354
- return /*#__PURE__*/ jsx(AriaCombobox, {
7355
- ...other,
7356
- selectionMode: multiple ? "multiple" : "single",
7357
- selectedValue: value,
7358
- defaultSelectedValue: defaultValue,
7359
- onSelectedValueChange: onValueChange,
7360
- formAutoComplete: autoComplete
7361
- });
7362
- }
7363
- //#endregion
7364
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/stateAttributesMapping.js
7365
- var triggerStateAttributesMapping = {
7366
- ...pressableTriggerOpenStateMapping,
7367
- ...fieldValidityMapping,
7368
- popupSide: (side) => side ? { "data-popup-side": side } : null,
7369
- listEmpty: (empty) => empty ? { "data-list-empty": "" } : null
7370
- };
7371
- //#endregion
7372
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/chips/ComboboxChipsContext.js
7373
- var ComboboxChipsContext = /*#__PURE__*/ React.createContext(void 0);
7374
- if (process.env.NODE_ENV !== "production") ComboboxChipsContext.displayName = "ComboboxChipsContext";
7375
- function useComboboxChipsContext() {
7376
- return React.useContext(ComboboxChipsContext);
7377
- }
7378
- //#endregion
7379
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositionerContext.js
7380
- var ComboboxPositionerContext = /*#__PURE__*/ React.createContext(void 0);
7381
- if (process.env.NODE_ENV !== "production") ComboboxPositionerContext.displayName = "ComboboxPositionerContext";
7382
- function useComboboxPositionerContext(optional) {
7383
- const context = React.useContext(ComboboxPositionerContext);
7384
- if (context === void 0 && !optional) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Combobox.Popup> and <Combobox.Arrow> must be used within the <Combobox.Positioner> component" : formatErrorMessage(21));
7385
- return context;
7386
- }
7387
- //#endregion
7388
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/ComboboxInternalDismissButton.js
7389
- /**
7390
- * @internal
7391
- */
7392
- var ComboboxInternalDismissButton = /*#__PURE__*/ React.forwardRef(function ComboboxInternalDismissButton(_, forwardedRef) {
7393
- const store = useComboboxRootContext();
7394
- const { buttonRef, getButtonProps } = useButton({ native: false });
7395
- const mergedRef = useMergedRefs(forwardedRef, buttonRef);
7396
- const dismissProps = getButtonProps({ onClick: useStableCallback((event) => {
7397
- store.state.setOpen(false, createChangeEventDetails(closePress, event.nativeEvent, event.currentTarget));
7398
- }) });
7399
- return /*#__PURE__*/ jsx("span", {
7400
- ref: mergedRef,
7401
- ...dismissProps,
7402
- "aria-label": "Dismiss",
7403
- tabIndex: void 0,
7404
- style: visuallyHiddenInput
7405
- });
7406
- });
7407
- if (process.env.NODE_ENV !== "production") ComboboxInternalDismissButton.displayName = "ComboboxInternalDismissButton";
7408
- //#endregion
7409
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input/ComboboxInput.js
7410
- /**
7411
- * A text input to search for items in the list.
7412
- * Renders an `<input>` element.
7413
- *
7414
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7415
- */
7416
- var ComboboxInput = /*#__PURE__*/ React.forwardRef(function ComboboxInput(componentProps, forwardedRef) {
7417
- const { render, className, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
7418
- const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
7419
- const { labelId: fieldLabelId } = useLabelableContext();
7420
- const comboboxChipsContext = useComboboxChipsContext();
7421
- const positioning = useComboboxPositionerContext(true);
7422
- const hasPositionerParent = Boolean(positioning);
7423
- const store = useComboboxRootContext();
7424
- const { filteredItems } = useComboboxDerivedItemsContext();
7425
- const inputValue = useComboboxInputValueContext();
7426
- const direction = useDirection();
7427
- const required = useStore(store, selectors.required);
7428
- const comboboxDisabled = useStore(store, selectors.disabled);
7429
- const readOnly = useStore(store, selectors.readOnly);
7430
- const name = useStore(store, selectors.name);
7431
- const form = useStore(store, selectors.form);
7432
- const selectionMode = useStore(store, selectors.selectionMode);
7433
- const autoHighlightMode = useStore(store, selectors.autoHighlight);
7434
- const inputProps = useStore(store, selectors.inputProps);
7435
- const triggerProps = useStore(store, selectors.triggerProps);
7436
- const open = useStore(store, selectors.open);
7437
- const mounted = useStore(store, selectors.mounted);
7438
- const selectedValue = useStore(store, selectors.selectedValue);
7439
- const popupSideValue = useStore(store, selectors.popupSide);
7440
- const positionerElement = useStore(store, selectors.positionerElement);
7441
- const rootId = useStore(store, selectors.id);
7442
- const inline = useStore(store, selectors.inline);
7443
- const modal = useStore(store, selectors.modal);
7444
- const autoHighlightEnabled = Boolean(autoHighlightMode);
7445
- const popupSide = mounted && positionerElement ? popupSideValue : null;
7446
- const disabled = fieldDisabled || comboboxDisabled || disabledProp;
7447
- const listEmpty = filteredItems.length === 0;
7448
- const isInsidePopup = hasPositionerParent || inline;
7449
- const focusManagerModal = !isInsidePopup || modal;
7450
- const id = useBaseUiId(idProp ?? (!isInsidePopup ? rootId : void 0));
7451
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, void 0);
7452
- const fieldStateForInput = hasPositionerParent ? DEFAULT_FIELD_STATE_ATTRIBUTES : fieldState;
7453
- const [composingValue, setComposingValue] = React.useState(null);
7454
- const isComposingRef = React.useRef(false);
7455
- const lastActiveIndexRef = React.useRef(null);
7456
- const shouldRestoreActiveIndexRef = React.useRef(false);
7457
- const setInputElement = useStableCallback((element) => {
7458
- const nextIsInsidePopup = hasPositionerParent || store.state.inline;
7459
- if (nextIsInsidePopup && !store.state.hasInputValue) store.state.setInputValue("", createChangeEventDetails(none));
7460
- store.update({
7461
- inputElement: element,
7462
- inputInsidePopup: nextIsInsidePopup
7463
- });
7464
- });
7465
- const validationProps = hasPositionerParent || !validation ? elementProps : validation.getValidationProps(elementProps);
7466
- const state = {
7467
- ...fieldStateForInput,
7468
- open,
7469
- disabled,
7470
- readOnly,
7471
- popupSide,
7472
- listEmpty
7473
- };
7474
- function handleKeyDown(event) {
7475
- if (!comboboxChipsContext) return;
7476
- let nextIndex;
7477
- const { highlightedChipIndex } = comboboxChipsContext;
7478
- const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
7479
- if (highlightedChipIndex !== void 0) {
7480
- if (event.key === "ArrowLeft") {
7481
- event.preventDefault();
7482
- if (highlightedChipIndex > 0) nextIndex = highlightedChipIndex - 1;
7483
- else nextIndex = void 0;
7484
- } else if (event.key === "ArrowRight") {
7485
- event.preventDefault();
7486
- if (highlightedChipIndex < renderedChipsCount - 1) nextIndex = highlightedChipIndex + 1;
7487
- else nextIndex = void 0;
7488
- } else if (event.key === "Backspace" || event.key === "Delete") {
7489
- event.preventDefault();
7490
- const computedNextIndex = highlightedChipIndex >= selectedValue.length - 1 ? selectedValue.length - 2 : highlightedChipIndex;
7491
- nextIndex = computedNextIndex >= 0 ? computedNextIndex : void 0;
7492
- store.state.setIndices({
7493
- activeIndex: null,
7494
- selectedIndex: null,
7495
- type: "keyboard"
7496
- });
7497
- }
7498
- return nextIndex;
7499
- }
7500
- if (event.key === "ArrowLeft" && (event.currentTarget.selectionStart ?? 0) === 0 && selectedValue.length > 0) {
7501
- event.preventDefault();
7502
- nextIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : void 0;
7503
- } else if (event.key === "Backspace" && event.currentTarget.value === "" && selectedValue.length > 0) {
7504
- store.state.setIndices({
7505
- activeIndex: null,
7506
- selectedIndex: null,
7507
- type: "keyboard"
7508
- });
7509
- event.preventDefault();
7510
- }
7511
- return nextIndex;
7512
- }
7513
- const element = useRenderElement("input", componentProps, {
7514
- state,
7515
- ref: [
7516
- forwardedRef,
7517
- store.state.inputRef,
7518
- setInputElement
7519
- ],
7520
- props: [
7521
- inputProps,
7522
- triggerProps,
7523
- {
7524
- type: "text",
7525
- value: componentProps.value ?? composingValue ?? inputValue,
7526
- "aria-readonly": readOnly || void 0,
7527
- "aria-required": required || void 0,
7528
- "aria-labelledby": ariaLabelledBy,
7529
- disabled,
7530
- readOnly,
7531
- required: selectionMode === "none" ? required : void 0,
7532
- form,
7533
- ...selectionMode === "none" && name && { name },
7534
- id,
7535
- onFocus() {
7536
- setFocused(true);
7537
- if (!inline || !shouldRestoreActiveIndexRef.current) return;
7538
- shouldRestoreActiveIndexRef.current = false;
7539
- const nextActiveIndex = lastActiveIndexRef.current;
7540
- if (nextActiveIndex == null || !Object.hasOwn(store.state.valuesRef.current, nextActiveIndex)) return;
7541
- store.state.setIndices({ activeIndex: nextActiveIndex });
7542
- },
7543
- onBlur() {
7544
- setTouched(true);
7545
- setFocused(false);
7546
- const activeIndex = store.state.activeIndex;
7547
- if (inline && activeIndex !== null && autoHighlightMode !== "always") {
7548
- lastActiveIndexRef.current = activeIndex;
7549
- shouldRestoreActiveIndexRef.current = true;
7550
- store.state.setIndices({ activeIndex: null });
7551
- }
7552
- if (validationMode === "onBlur") {
7553
- const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
7554
- validation.commit(valueToValidate);
7555
- }
7556
- },
7557
- onCompositionStart(event) {
7558
- if (isAndroid) return;
7559
- isComposingRef.current = true;
7560
- setComposingValue(event.currentTarget.value);
7561
- },
7562
- onCompositionEnd(event) {
7563
- isComposingRef.current = false;
7564
- const next = event.currentTarget.value;
7565
- setComposingValue(null);
7566
- store.state.setInputValue(next, createChangeEventDetails(inputChange, event.nativeEvent));
7567
- },
7568
- onChange(event) {
7569
- const inputType = event.nativeEvent.inputType;
7570
- const autofillLikeInput = !inputType || inputType === "insertReplacementText";
7571
- const shouldOpenOnInput = isComposingRef.current || !autofillLikeInput;
7572
- if (isComposingRef.current) {
7573
- const nextVal = event.currentTarget.value;
7574
- setComposingValue(nextVal);
7575
- if (nextVal === "" && !store.state.openOnInputClick && !store.state.inputInsidePopup) store.state.setOpen(false, createChangeEventDetails(inputClear, event.nativeEvent));
7576
- const trimmed = nextVal.trim();
7577
- const shouldMaintainHighlight = autoHighlightEnabled && trimmed !== "";
7578
- if (!readOnly && !disabled && trimmed) {
7579
- if (shouldOpenOnInput) {
7580
- store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
7581
- if (!autoHighlightEnabled) store.state.setIndices({
7582
- activeIndex: null,
7583
- selectedIndex: null,
7584
- type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
7585
- });
7586
- }
7587
- }
7588
- if (open && store.state.activeIndex !== null && !shouldMaintainHighlight) store.state.setIndices({
7589
- activeIndex: null,
7590
- selectedIndex: null,
7591
- type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
7592
- });
7593
- return;
7594
- }
7595
- store.state.setInputValue(event.currentTarget.value, createChangeEventDetails(inputChange, event.nativeEvent));
7596
- const empty = event.currentTarget.value === "";
7597
- const clearDetails = createChangeEventDetails(inputClear, event.nativeEvent);
7598
- if (empty && !store.state.inputInsidePopup) {
7599
- if (selectionMode === "single") store.state.setSelectedValue(null, clearDetails);
7600
- if (!store.state.openOnInputClick) store.state.setOpen(false, clearDetails);
7601
- }
7602
- const trimmed = event.currentTarget.value.trim();
7603
- if (!readOnly && !disabled && trimmed) {
7604
- if (shouldOpenOnInput) {
7605
- store.state.setOpen(true, createChangeEventDetails(inputChange, event.nativeEvent));
7606
- if (!autoHighlightEnabled) store.state.setIndices({
7607
- activeIndex: null,
7608
- selectedIndex: null,
7609
- type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
7610
- });
7611
- }
7612
- }
7613
- if (open && store.state.activeIndex !== null && !autoHighlightEnabled) store.state.setIndices({
7614
- activeIndex: null,
7615
- selectedIndex: null,
7616
- type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
7617
- });
7618
- },
7619
- onKeyDown(event) {
7620
- if (disabled || readOnly) return;
7621
- if (event.ctrlKey || event.shiftKey || event.altKey || event.metaKey) return;
7622
- store.state.keyboardActiveRef.current = true;
7623
- const input = event.currentTarget;
7624
- const scrollAmount = input.scrollWidth - input.clientWidth;
7625
- const isRTL = direction === "rtl";
7626
- if (event.key === "Home") {
7627
- stopEvent(event);
7628
- const cursor = isFirefox && isRTL ? input.value.length : 0;
7629
- input.setSelectionRange(cursor, cursor);
7630
- input.scrollLeft = 0;
7631
- return;
7632
- }
7633
- if (event.key === "End") {
7634
- stopEvent(event);
7635
- const cursor = isFirefox && isRTL ? 0 : input.value.length;
7636
- input.setSelectionRange(cursor, cursor);
7637
- input.scrollLeft = isRTL ? -scrollAmount : scrollAmount;
7638
- return;
7639
- }
7640
- if (!mounted && event.key === "Escape") {
7641
- const isClear = selectionMode === "multiple" && Array.isArray(selectedValue) ? selectedValue.length === 0 : selectedValue === null;
7642
- const details = createChangeEventDetails(escapeKey, event.nativeEvent);
7643
- const value = selectionMode === "multiple" ? [] : null;
7644
- store.state.setInputValue("", details);
7645
- store.state.setSelectedValue(value, details);
7646
- if (!isClear && !store.state.inline && !details.isPropagationAllowed) event.stopPropagation();
7647
- return;
7648
- }
7649
- if (comboboxChipsContext && event.key === "Backspace" && input.value === "" && comboboxChipsContext.highlightedChipIndex === void 0 && Array.isArray(selectedValue) && selectedValue.length > 0) {
7650
- const renderedChipsCount = comboboxChipsContext.chipsRef.current.length;
7651
- const removalIndex = renderedChipsCount > 0 ? renderedChipsCount - 1 : selectedValue.length - 1;
7652
- const newValue = selectedValue.filter((_, index) => index !== removalIndex);
7653
- store.state.setIndices({
7654
- activeIndex: null,
7655
- selectedIndex: null,
7656
- type: store.state.keyboardActiveRef.current ? "keyboard" : "pointer"
7657
- });
7658
- store.state.setSelectedValue(newValue, createChangeEventDetails(none, event.nativeEvent));
7659
- return;
7660
- }
7661
- const hadHighlightedChip = comboboxChipsContext?.highlightedChipIndex !== void 0;
7662
- const nextIndex = handleKeyDown(event);
7663
- comboboxChipsContext?.setHighlightedChipIndex(nextIndex);
7664
- if (nextIndex !== void 0) comboboxChipsContext?.chipsRef.current[nextIndex]?.focus();
7665
- else if (hadHighlightedChip) store.state.inputRef.current?.focus();
7666
- if (event.which === 229) return;
7667
- if (event.key === "Enter" && open) {
7668
- const activeIndex = store.state.activeIndex;
7669
- const nativeEvent = event.nativeEvent;
7670
- if (activeIndex === null) {
7671
- if (inline) return;
7672
- store.state.setOpen(false, createChangeEventDetails(none, nativeEvent));
7673
- return;
7674
- }
7675
- stopEvent(event);
7676
- const listItem = store.state.listRef.current[activeIndex];
7677
- if (listItem) {
7678
- store.state.selectionEventRef.current = nativeEvent;
7679
- listItem.click();
7680
- store.state.selectionEventRef.current = null;
7681
- }
7682
- }
7683
- },
7684
- onPointerMove() {
7685
- store.state.keyboardActiveRef.current = false;
7686
- },
7687
- onPointerDown() {
7688
- store.state.keyboardActiveRef.current = false;
7689
- }
7690
- },
7691
- validationProps
7692
- ],
7693
- stateAttributesMapping: triggerStateAttributesMapping
7694
- });
7695
- return /*#__PURE__*/ jsxs(React.Fragment, { children: [open && focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.startDismissRef }), element] });
7696
- });
7697
- if (process.env.NODE_ENV !== "production") ComboboxInput.displayName = "ComboboxInput";
7698
- //#endregion
7699
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/utils/handleInputPress.js
7700
- function handleInputPress(event, store, disabled, readOnly, shouldIgnoreTarget) {
7701
- if (event.baseUIHandlerPrevented || readOnly) return;
7702
- const target = getTarget(event.nativeEvent);
7703
- const targetElement = isElement(target) ? target : null;
7704
- if (targetElement !== event.currentTarget && (shouldIgnoreTarget?.(targetElement) || isInteractiveElement(targetElement))) return;
7705
- event.preventDefault();
7706
- if (disabled) return;
7707
- store.state.inputRef.current?.focus();
7708
- if (store.state.openOnInputClick) store.state.setOpen(true, createChangeEventDetails(inputPress, event.nativeEvent));
7709
- }
7710
- //#endregion
7711
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/input-group/ComboboxInputGroup.js
7712
- /**
7713
- * A wrapper for the input and its associated controls.
7714
- * Renders a `<div>` element.
7715
- *
7716
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7717
- */
7718
- var ComboboxInputGroup = /*#__PURE__*/ React.forwardRef(function ComboboxInputGroup(componentProps, forwardedRef) {
7719
- const { render, className, style, ...elementProps } = componentProps;
7720
- const { state: fieldState } = useFieldRootContext();
7721
- const store = useComboboxRootContext();
7722
- const { filteredItems } = useComboboxDerivedItemsContext();
7723
- const open = useStore(store, selectors.open);
7724
- const mounted = useStore(store, selectors.mounted);
7725
- const popupSideValue = useStore(store, selectors.popupSide);
7726
- const positionerElement = useStore(store, selectors.positionerElement);
7727
- const comboboxDisabled = useStore(store, selectors.disabled);
7728
- const readOnly = useStore(store, selectors.readOnly);
7729
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
7730
- const selectionMode = useStore(store, selectors.selectionMode);
7731
- const popupSide = mounted && positionerElement ? popupSideValue : null;
7732
- const disabled = comboboxDisabled;
7733
- const listEmpty = filteredItems.length === 0;
7734
- const placeholder = selectionMode === "none" ? false : !hasSelectedValue;
7735
- const state = {
7736
- ...fieldState,
7737
- open,
7738
- disabled,
7739
- readOnly,
7740
- popupSide,
7741
- listEmpty,
7742
- placeholder
7743
- };
7744
- const setInputGroupElement = useStableCallback((element) => {
7745
- store.set("inputGroupElement", element);
7746
- });
7747
- return useRenderElement("div", componentProps, {
7748
- ref: [forwardedRef, setInputGroupElement],
7749
- props: [{
7750
- role: "group",
7751
- onMouseDown(event) {
7752
- handleInputPress(event, store, disabled, readOnly, (target) => {
7753
- return contains(store.state.chipsContainerRef.current, target);
7754
- });
7755
- }
7756
- }, elementProps],
7757
- state,
7758
- stateAttributesMapping: triggerStateAttributesMapping
7759
- });
7760
- });
7761
- if (process.env.NODE_ENV !== "production") ComboboxInputGroup.displayName = "ComboboxInputGroup";
7762
- //#endregion
7763
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/trigger/ComboboxTrigger.js
7764
- var BOUNDARY_OFFSET = 2;
7765
- /**
7766
- * A button that opens the popup.
7767
- * Renders a `<button>` element.
7768
- *
7769
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7770
- */
7771
- var ComboboxTrigger = /*#__PURE__*/ React.forwardRef(function ComboboxTrigger(componentProps, forwardedRef) {
7772
- const { render, className, nativeButton = true, disabled: disabledProp = false, id: idProp, style, ...elementProps } = componentProps;
7773
- const { state: fieldState, disabled: fieldDisabled, setTouched, setFocused, validationMode, validation } = useFieldRootContext();
7774
- const { labelId: fieldLabelId } = useLabelableContext();
7775
- const store = useComboboxRootContext();
7776
- const { filteredItems } = useComboboxDerivedItemsContext();
7777
- const selectionMode = useStore(store, selectors.selectionMode);
7778
- const comboboxDisabled = useStore(store, selectors.disabled);
7779
- const readOnly = useStore(store, selectors.readOnly);
7780
- const required = useStore(store, selectors.required);
7781
- const mounted = useStore(store, selectors.mounted);
7782
- const popupSideValue = useStore(store, selectors.popupSide);
7783
- const positionerElement = useStore(store, selectors.positionerElement);
7784
- const listElement = useStore(store, selectors.listElement);
7785
- const triggerProps = useStore(store, selectors.triggerProps);
7786
- const triggerElement = useStore(store, selectors.triggerElement);
7787
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
7788
- const rootId = useStore(store, selectors.id);
7789
- const comboboxLabelId = useStore(store, selectors.labelId);
7790
- const open = useStore(store, selectors.open);
7791
- const selectedValue = useStore(store, selectors.selectedValue);
7792
- const activeIndex = useStore(store, selectors.activeIndex);
7793
- const selectedIndex = useStore(store, selectors.selectedIndex);
7794
- const hasSelectedValue = useStore(store, selectors.hasSelectedValue);
7795
- const floatingRootContext = useComboboxFloatingContext();
7796
- const inputValue = useComboboxInputValueContext();
7797
- const focusTimeout = useTimeout();
7798
- const disabled = fieldDisabled || comboboxDisabled || disabledProp;
7799
- const listEmpty = filteredItems.length === 0;
7800
- const popupSide = mounted && positionerElement ? popupSideValue : null;
7801
- useLabelableId({ id: inputInsidePopup ? idProp : void 0 });
7802
- const id = inputInsidePopup ? idProp ?? rootId : idProp;
7803
- const ariaLabelledBy = resolveAriaLabelledBy(fieldLabelId, comboboxLabelId);
7804
- const currentPointerTypeRef = React.useRef("");
7805
- function trackPointerType(event) {
7806
- currentPointerTypeRef.current = event.pointerType;
7807
- }
7808
- const domReference = floatingRootContext.useState("domReferenceElement");
7809
- React.useEffect(() => {
7810
- if (!inputInsidePopup) return;
7811
- if (triggerElement && triggerElement !== domReference) floatingRootContext.set("domReferenceElement", triggerElement);
7812
- }, [
7813
- triggerElement,
7814
- domReference,
7815
- floatingRootContext,
7816
- inputInsidePopup
7817
- ]);
7818
- const { reference: triggerTypeaheadProps } = useTypeahead(floatingRootContext, {
7819
- enabled: !open && !readOnly && !comboboxDisabled && selectionMode === "single",
7820
- listRef: store.state.labelsRef,
7821
- activeIndex,
7822
- selectedIndex,
7823
- onMatch(index) {
7824
- const nextSelectedValue = store.state.valuesRef.current[index];
7825
- if (nextSelectedValue !== void 0) store.state.setSelectedValue(nextSelectedValue, createChangeEventDetails("none"));
7826
- }
7827
- });
7828
- const { reference: triggerClickProps } = useClick(floatingRootContext, {
7829
- enabled: !readOnly && !comboboxDisabled,
7830
- event: "mousedown"
7831
- });
7832
- const { buttonRef, getButtonProps } = useButton({
7833
- native: nativeButton,
7834
- disabled
7835
- });
7836
- const state = {
7837
- ...fieldState,
7838
- open,
7839
- disabled,
7840
- popupSide,
7841
- listEmpty,
7842
- placeholder: selectionMode === "none" ? false : !hasSelectedValue
7843
- };
7844
- const setTriggerElement = useStableCallback((element) => {
7845
- store.set("triggerElement", element);
7846
- });
7847
- return useRenderElement("button", componentProps, {
7848
- ref: [
7849
- forwardedRef,
7850
- buttonRef,
7851
- setTriggerElement
7852
- ],
7853
- state,
7854
- props: [
7855
- triggerProps,
7856
- triggerClickProps,
7857
- triggerTypeaheadProps,
7858
- {
7859
- id,
7860
- tabIndex: inputInsidePopup ? 0 : -1,
7861
- role: inputInsidePopup ? "combobox" : void 0,
7862
- "aria-expanded": open ? "true" : "false",
7863
- "aria-haspopup": inputInsidePopup ? "dialog" : "listbox",
7864
- "aria-controls": open ? listElement?.id : void 0,
7865
- "aria-required": inputInsidePopup ? required || void 0 : void 0,
7866
- "aria-labelledby": ariaLabelledBy,
7867
- onPointerDown: trackPointerType,
7868
- onPointerEnter: trackPointerType,
7869
- onFocus() {
7870
- setFocused(true);
7871
- if (disabled || readOnly) return;
7872
- focusTimeout.start(0, store.state.forceMount);
7873
- },
7874
- onBlur(event) {
7875
- if (contains(positionerElement, event.relatedTarget)) return;
7876
- setTouched(true);
7877
- setFocused(false);
7878
- if (validationMode === "onBlur") {
7879
- const valueToValidate = selectionMode === "none" ? inputValue : selectedValue;
7880
- validation.commit(valueToValidate);
7881
- }
7882
- },
7883
- onMouseDown(event) {
7884
- if (disabled || readOnly) return;
7885
- if (!inputInsidePopup) floatingRootContext.set("domReferenceElement", event.currentTarget);
7886
- store.state.forceMount();
7887
- if (currentPointerTypeRef.current !== "touch") {
7888
- store.state.inputRef.current?.focus();
7889
- if (!inputInsidePopup) event.preventDefault();
7890
- }
7891
- if (open) return;
7892
- const doc = ownerDocument(event.currentTarget);
7893
- function handleMouseUp(mouseEvent) {
7894
- if (!triggerElement) return;
7895
- const mouseUpTarget = getTarget(mouseEvent);
7896
- const positioner = store.state.positionerElement;
7897
- const list = store.state.listElement;
7898
- if (contains(triggerElement, mouseUpTarget) || contains(positioner, mouseUpTarget) || contains(list, mouseUpTarget) || mouseUpTarget === triggerElement) return;
7899
- const bounds = getPseudoElementBounds(triggerElement);
7900
- const withinHorizontal = mouseEvent.clientX >= bounds.left - BOUNDARY_OFFSET && mouseEvent.clientX <= bounds.right + BOUNDARY_OFFSET;
7901
- const withinVertical = mouseEvent.clientY >= bounds.top - BOUNDARY_OFFSET && mouseEvent.clientY <= bounds.bottom + BOUNDARY_OFFSET;
7902
- if (withinHorizontal && withinVertical) return;
7903
- store.state.setOpen(false, createChangeEventDetails("cancel-open", mouseEvent));
7904
- }
7905
- if (inputInsidePopup) doc.addEventListener("mouseup", handleMouseUp, { once: true });
7906
- },
7907
- onKeyDown(event) {
7908
- if (disabled || readOnly) return;
7909
- if (event.key === "ArrowDown" || event.key === "ArrowUp") {
7910
- stopEvent(event);
7911
- store.state.setOpen(true, createChangeEventDetails(listNavigation, event.nativeEvent));
7912
- store.state.inputRef.current?.focus();
7913
- }
7914
- }
7915
- },
7916
- validation ? validation.getValidationProps(elementProps) : elementProps,
7917
- getButtonProps
7918
- ],
7919
- stateAttributesMapping: triggerStateAttributesMapping
7920
- });
7921
- });
7922
- if (process.env.NODE_ENV !== "production") ComboboxTrigger.displayName = "ComboboxTrigger";
7923
- //#endregion
7924
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/GroupCollectionContext.js
7925
- var GroupCollectionContext = /*#__PURE__*/ React.createContext(null);
7926
- if (process.env.NODE_ENV !== "production") GroupCollectionContext.displayName = "GroupCollectionContext";
7927
- function useGroupCollectionContext() {
7928
- return React.useContext(GroupCollectionContext);
7929
- }
7930
- function GroupCollectionProvider(props) {
7931
- const { children, items } = props;
7932
- const contextValue = React.useMemo(() => ({ items }), [items]);
7933
- return /*#__PURE__*/ jsx(GroupCollectionContext.Provider, {
7934
- value: contextValue,
7935
- children
7936
- });
7937
- }
7938
- //#endregion
7939
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/collection/ComboboxCollection.js
7940
- /**
7941
- * Renders filtered list items.
7942
- * Doesn't render its own HTML element.
7943
- *
7944
- * If rendering a flat list, pass a function child to the `List` component instead, which implicitly wraps it.
7945
- *
7946
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7947
- */
7948
- function ComboboxCollection(props) {
7949
- const { children } = props;
7950
- const { filteredItems } = useComboboxDerivedItemsContext();
7951
- const groupContext = useGroupCollectionContext();
7952
- const itemsToRender = groupContext ? groupContext.items : filteredItems;
7953
- if (!itemsToRender) return null;
7954
- return /*#__PURE__*/ jsx(React.Fragment, { children: itemsToRender.map(children) });
7955
- }
7956
- //#endregion
7957
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/list/ComboboxList.js
7958
- /**
7959
- * A list container for the items.
7960
- * Renders a `<div>` element.
7961
- *
7962
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
7963
- */
7964
- var ComboboxList = /*#__PURE__*/ React.forwardRef(function ComboboxList(componentProps, forwardedRef) {
7965
- var _ComboboxCollection;
7966
- const { render, className, style, children, ...elementProps } = componentProps;
7967
- const store = useComboboxRootContext();
7968
- const floatingRootContext = useComboboxFloatingContext();
7969
- const hasPositionerContext = Boolean(useComboboxPositionerContext(true));
7970
- const { filteredItems, hasItems } = useComboboxDerivedItemsContext();
7971
- const selectionMode = useStore(store, selectors.selectionMode);
7972
- const grid = useStore(store, selectors.grid);
7973
- const popupProps = useStore(store, selectors.popupProps);
7974
- const virtualized = useStore(store, selectors.virtualized);
7975
- const multiple = selectionMode === "multiple";
7976
- const empty = filteredItems.length === 0;
7977
- const setPositionerElement = useStableCallback((element) => {
7978
- store.set("positionerElement", element);
7979
- });
7980
- const setListElement = useStableCallback((element) => {
7981
- store.set("listElement", element);
7982
- });
7983
- const resolvedChildren = React.useMemo(() => {
7984
- if (typeof children === "function") return _ComboboxCollection || (_ComboboxCollection = /*#__PURE__*/ jsx(ComboboxCollection, { children }));
7985
- return children;
7986
- }, [children]);
7987
- const state = { empty };
7988
- const floatingId = floatingRootContext.useState("floatingId");
7989
- const element = useRenderElement("div", componentProps, {
7990
- state,
7991
- ref: [
7992
- forwardedRef,
7993
- setListElement,
7994
- hasPositionerContext ? null : setPositionerElement
7995
- ],
7996
- props: [
7997
- popupProps,
7998
- {
7999
- children: resolvedChildren,
8000
- tabIndex: -1,
8001
- id: floatingId,
8002
- role: grid ? "grid" : "listbox",
8003
- "aria-multiselectable": multiple ? "true" : void 0,
8004
- onKeyDown(event) {
8005
- if (store.state.disabled || store.state.readOnly) return;
8006
- if (event.key === "Enter") {
8007
- const activeIndex = store.state.activeIndex;
8008
- if (activeIndex == null) return;
8009
- stopEvent(event);
8010
- const nativeEvent = event.nativeEvent;
8011
- const listItem = store.state.listRef.current[activeIndex];
8012
- if (listItem) {
8013
- store.state.selectionEventRef.current = nativeEvent;
8014
- listItem.click();
8015
- store.state.selectionEventRef.current = null;
8016
- }
8017
- }
8018
- },
8019
- onKeyDownCapture() {
8020
- store.state.keyboardActiveRef.current = true;
8021
- },
8022
- onPointerMoveCapture() {
8023
- store.state.keyboardActiveRef.current = false;
8024
- }
8025
- },
8026
- elementProps
8027
- ]
8028
- });
8029
- if (virtualized) return element;
8030
- return /*#__PURE__*/ jsx(CompositeList, {
8031
- elementsRef: store.state.listRef,
8032
- labelsRef: hasItems ? void 0 : store.state.labelsRef,
8033
- children: element
8034
- });
8035
- });
8036
- if (process.env.NODE_ENV !== "production") ComboboxList.displayName = "ComboboxList";
8037
- //#endregion
8038
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortalContext.js
8039
- var ComboboxPortalContext = /*#__PURE__*/ React.createContext(void 0);
8040
- if (process.env.NODE_ENV !== "production") ComboboxPortalContext.displayName = "ComboboxPortalContext";
8041
- function useComboboxPortalContext() {
8042
- const context = React.useContext(ComboboxPortalContext);
8043
- if (context === void 0) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: <Combobox.Portal> is missing." : formatErrorMessage(20));
8044
- return context;
8045
- }
8046
- //#endregion
8047
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/portal/ComboboxPortal.js
8048
- /**
8049
- * A portal element that moves the popup to a different part of the DOM.
8050
- * By default, the portal element is appended to `<body>`.
8051
- * Renders a `<div>` element.
8052
- *
8053
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8054
- */
8055
- var ComboboxPortal = /*#__PURE__*/ React.forwardRef(function ComboboxPortal(props, forwardedRef) {
8056
- const { keepMounted = false, ...portalProps } = props;
8057
- const store = useComboboxRootContext();
8058
- const mounted = useStore(store, selectors.mounted);
8059
- const forceMounted = useStore(store, selectors.forceMounted);
8060
- if (!(mounted || keepMounted || forceMounted)) return null;
8061
- return /*#__PURE__*/ jsx(ComboboxPortalContext.Provider, {
8062
- value: keepMounted,
8063
- children: /*#__PURE__*/ jsx(FloatingPortal, {
8064
- ref: forwardedRef,
8065
- ...portalProps
8066
- })
8067
- });
8068
- });
8069
- if (process.env.NODE_ENV !== "production") ComboboxPortal.displayName = "ComboboxPortal";
8070
- //#endregion
8071
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/positioner/ComboboxPositioner.js
8072
- /**
8073
- * Positions the popup against the trigger.
8074
- * Renders a `<div>` element.
8075
- *
8076
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8077
- */
8078
- var ComboboxPositioner = /*#__PURE__*/ React.forwardRef(function ComboboxPositioner(componentProps, forwardedRef) {
8079
- const { render, className, anchor, positionMethod = "absolute", side = "bottom", align = "center", sideOffset = 0, alignOffset = 0, collisionBoundary = "clipping-ancestors", collisionPadding = 5, arrowPadding = 5, sticky = false, disableAnchorTracking = false, collisionAvoidance = DROPDOWN_COLLISION_AVOIDANCE, style: styleProp, ...elementProps } = componentProps;
8080
- const store = useComboboxRootContext();
8081
- const { filteredItems } = useComboboxDerivedItemsContext();
8082
- const floatingRootContext = useComboboxFloatingContext();
8083
- const keepMounted = useComboboxPortalContext();
8084
- const modal = useStore(store, selectors.modal);
8085
- const open = useStore(store, selectors.open);
8086
- const mounted = useStore(store, selectors.mounted);
8087
- const openMethod = useStore(store, selectors.openMethod);
8088
- const positionerElement = useStore(store, selectors.positionerElement);
8089
- const triggerElement = useStore(store, selectors.triggerElement);
8090
- const inputElement = useStore(store, selectors.inputElement);
8091
- const inputGroupElement = useStore(store, selectors.inputGroupElement);
8092
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
8093
- const transitionStatus = useStore(store, selectors.transitionStatus);
8094
- const empty = filteredItems.length === 0;
8095
- const positioning = useAnchorPositioning({
8096
- anchor: anchor ?? (inputInsidePopup ? triggerElement : inputGroupElement ?? inputElement),
8097
- floatingRootContext,
8098
- positionMethod,
8099
- mounted,
8100
- side,
8101
- sideOffset,
8102
- align,
8103
- alignOffset,
8104
- arrowPadding,
8105
- collisionBoundary,
8106
- collisionPadding,
8107
- sticky,
8108
- disableAnchorTracking,
8109
- keepMounted,
8110
- collisionAvoidance,
8111
- lazyFlip: true
8112
- });
8113
- useAnchoredPopupScrollLock(open && modal, openMethod === "touch", positionerElement, triggerElement);
8114
- const state = {
8115
- open,
8116
- side: positioning.side,
8117
- align: positioning.align,
8118
- anchorHidden: positioning.anchorHidden,
8119
- empty
8120
- };
8121
- useIsoLayoutEffect(() => {
8122
- store.set("popupSide", positioning.side);
8123
- }, [store, positioning.side]);
8124
- const setPositionerElement = useStableCallback((element) => {
8125
- store.set("positionerElement", element);
8126
- });
8127
- const element = usePositioner(componentProps, state, {
8128
- styles: positioning.positionerStyles,
8129
- transitionStatus,
8130
- props: elementProps,
8131
- refs: [forwardedRef, setPositionerElement],
8132
- hidden: !mounted,
8133
- inert: !open
8134
- });
8135
- return /*#__PURE__*/ jsxs(ComboboxPositionerContext.Provider, {
8136
- value: positioning,
8137
- children: [mounted && modal && /*#__PURE__*/ jsx(InternalBackdrop, {
8138
- inert: inertValue(!open),
8139
- cutout: inputGroupElement ?? inputElement ?? triggerElement
8140
- }), element]
8141
- });
8142
- });
8143
- if (process.env.NODE_ENV !== "production") ComboboxPositioner.displayName = "ComboboxPositioner";
8144
- //#endregion
8145
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/popup/ComboboxPopup.js
8146
- var stateAttributesMapping$1 = {
8147
- ...popupStateMapping,
8148
- ...transitionStatusMapping
8149
- };
8150
- /**
8151
- * A container for the list.
8152
- * Renders a `<div>` element.
8153
- *
8154
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8155
- */
8156
- var ComboboxPopup = /*#__PURE__*/ React.forwardRef(function ComboboxPopup(componentProps, forwardedRef) {
8157
- const { render, className, style, initialFocus, finalFocus, ...elementProps } = componentProps;
8158
- const store = useComboboxRootContext();
8159
- const positioning = useComboboxPositionerContext();
8160
- const floatingRootContext = useComboboxFloatingContext();
8161
- const { filteredItems } = useComboboxDerivedItemsContext();
8162
- const mounted = useStore(store, selectors.mounted);
8163
- const open = useStore(store, selectors.open);
8164
- const openMethod = useStore(store, selectors.openMethod);
8165
- const transitionStatus = useStore(store, selectors.transitionStatus);
8166
- const inputInsidePopup = useStore(store, selectors.inputInsidePopup);
8167
- const inputElement = useStore(store, selectors.inputElement);
8168
- const modal = useStore(store, selectors.modal);
8169
- const empty = filteredItems.length === 0;
8170
- useOpenChangeComplete({
8171
- open,
8172
- ref: store.state.popupRef,
8173
- onComplete() {
8174
- if (open) store.state.onOpenChangeComplete(true);
8175
- }
8176
- });
8177
- const state = {
8178
- open,
8179
- side: positioning.side,
8180
- align: positioning.align,
8181
- anchorHidden: positioning.anchorHidden,
8182
- transitionStatus,
8183
- empty
8184
- };
8185
- const element = useRenderElement("div", componentProps, {
8186
- state,
8187
- ref: [forwardedRef, store.state.popupRef],
8188
- props: [
8189
- {
8190
- role: inputInsidePopup ? "dialog" : "presentation",
8191
- tabIndex: -1,
8192
- onFocus(event) {
8193
- const target = getTarget(event.nativeEvent);
8194
- if (openMethod !== "touch" && (contains(store.state.listElement, target) || target === event.currentTarget)) store.state.inputRef.current?.focus();
8195
- }
8196
- },
8197
- getDisabledMountTransitionStyles(transitionStatus),
8198
- elementProps
8199
- ],
8200
- stateAttributesMapping: stateAttributesMapping$1
8201
- });
8202
- const resolvedInitialFocus = initialFocus === void 0 ? inputInsidePopup ? (interactionType) => interactionType === "touch" ? store.state.popupRef.current : inputElement : false : initialFocus;
8203
- let resolvedFinalFocus;
8204
- if (finalFocus != null) resolvedFinalFocus = finalFocus;
8205
- else resolvedFinalFocus = inputInsidePopup ? void 0 : false;
8206
- const focusManagerModal = !inputInsidePopup || modal;
8207
- return /*#__PURE__*/ jsx(FloatingFocusManager, {
8208
- context: floatingRootContext,
8209
- disabled: !mounted,
8210
- modal: focusManagerModal,
8211
- openInteractionType: openMethod,
8212
- initialFocus: resolvedInitialFocus,
8213
- returnFocus: resolvedFinalFocus,
8214
- getInsideElements: () => [store.state.startDismissRef.current, store.state.endDismissRef.current],
8215
- children: /*#__PURE__*/ jsxs(React.Fragment, { children: [element, focusManagerModal && /*#__PURE__*/ jsx(ComboboxInternalDismissButton, { ref: store.state.endDismissRef })] })
8216
- });
8217
- });
8218
- if (process.env.NODE_ENV !== "production") ComboboxPopup.displayName = "ComboboxPopup";
8219
- //#endregion
8220
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroupContext.js
8221
- var ComboboxGroupContext = /*#__PURE__*/ React.createContext(void 0);
8222
- if (process.env.NODE_ENV !== "production") ComboboxGroupContext.displayName = "ComboboxGroupContext";
8223
- //#endregion
8224
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/group/ComboboxGroup.js
8225
- /**
8226
- * Groups related items with the corresponding label.
8227
- * Renders a `<div>` element.
8228
- *
8229
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8230
- */
8231
- var ComboboxGroup = /*#__PURE__*/ React.forwardRef(function ComboboxGroup(componentProps, forwardedRef) {
8232
- const { render, className, style, items, ...elementProps } = componentProps;
8233
- const [labelId, setLabelId] = React.useState();
8234
- const contextValue = React.useMemo(() => ({
8235
- labelId,
8236
- setLabelId,
8237
- items
8238
- }), [
8239
- labelId,
8240
- setLabelId,
8241
- items
8242
- ]);
8243
- const element = useRenderElement("div", componentProps, {
8244
- ref: forwardedRef,
8245
- props: [{
8246
- role: "group",
8247
- "aria-labelledby": labelId
8248
- }, elementProps]
8249
- });
8250
- const wrappedElement = /*#__PURE__*/ jsx(ComboboxGroupContext.Provider, {
8251
- value: contextValue,
8252
- children: element
8253
- });
8254
- if (items) return /*#__PURE__*/ jsx(GroupCollectionProvider, {
8255
- items,
8256
- children: wrappedElement
8257
- });
8258
- return wrappedElement;
8259
- });
8260
- if (process.env.NODE_ENV !== "production") ComboboxGroup.displayName = "ComboboxGroup";
8261
- //#endregion
8262
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItemContext.js
8263
- var ComboboxItemContext = /*#__PURE__*/ React.createContext(void 0);
8264
- if (process.env.NODE_ENV !== "production") ComboboxItemContext.displayName = "ComboboxItemContext";
8265
- function useComboboxItemContext() {
8266
- const context = React.useContext(ComboboxItemContext);
8267
- if (!context) throw new Error(process.env.NODE_ENV !== "production" ? "Base UI: ComboboxItemContext is missing. ComboboxItem parts must be placed within <Combobox.Item>." : formatErrorMessage(19));
8268
- return context;
8269
- }
8270
- //#endregion
8271
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/row/ComboboxRowContext.js
8272
- var ComboboxRowContext = /*#__PURE__*/ React.createContext(false);
8273
- if (process.env.NODE_ENV !== "production") ComboboxRowContext.displayName = "ComboboxRowContext";
8274
- function useComboboxRowContext() {
8275
- return React.useContext(ComboboxRowContext);
8276
- }
8277
- //#endregion
8278
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item/ComboboxItem.js
8279
- /**
8280
- * An individual item in the list.
8281
- * Renders a `<div>` element.
8282
- *
8283
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8284
- */
8285
- var ComboboxItem = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef(function ComboboxItem(componentProps, forwardedRef) {
8286
- const { render, className, value: itemValue = null, index: indexProp, disabled = false, nativeButton = false, style, ...elementProps } = componentProps;
8287
- const didPointerDownRef = React.useRef(false);
8288
- const textRef = React.useRef(null);
8289
- const listItem = useCompositeListItem({
8290
- index: indexProp,
8291
- textRef,
8292
- indexGuessBehavior: IndexGuessBehavior.GuessFromOrder
8293
- });
8294
- const store = useComboboxRootContext();
8295
- const isRow = useComboboxRowContext();
8296
- const { flatFilteredItems, hasItems } = useComboboxDerivedItemsContext();
8297
- const open = useStore(store, selectors.open);
8298
- const selectionMode = useStore(store, selectors.selectionMode);
8299
- const readOnly = useStore(store, selectors.readOnly);
8300
- const virtualized = useStore(store, selectors.virtualized);
8301
- const isItemEqualToValue = useStore(store, selectors.isItemEqualToValue);
8302
- const selectable = selectionMode !== "none";
8303
- const index = indexProp ?? (virtualized ? findItemIndex(flatFilteredItems, itemValue, isItemEqualToValue) : listItem.index);
8304
- const hasRegistered = listItem.index !== -1;
8305
- const rootId = useStore(store, selectors.id);
8306
- const highlighted = useStore(store, selectors.isActive, index);
8307
- const matchesSelectedValue = useStore(store, selectors.isSelected, itemValue);
8308
- const getItemProps = useStore(store, selectors.getItemProps);
8309
- const itemRef = React.useRef(null);
8310
- const id = rootId != null && hasRegistered ? `${rootId}-${index}` : void 0;
8311
- const selected = matchesSelectedValue && selectable;
8312
- useIsoLayoutEffect(() => {
8313
- if (!(hasRegistered && (virtualized || indexProp != null))) return;
8314
- const list = store.state.listRef.current;
8315
- list[index] = itemRef.current;
8316
- return () => {
8317
- delete list[index];
8318
- };
8319
- }, [
8320
- hasRegistered,
8321
- virtualized,
8322
- index,
8323
- indexProp,
8324
- store
8325
- ]);
8326
- useIsoLayoutEffect(() => {
8327
- if (!hasRegistered || hasItems) return;
8328
- const visibleMap = store.state.valuesRef.current;
8329
- visibleMap[index] = itemValue;
8330
- if (selectionMode !== "none") store.state.allValuesRef.current.push(itemValue);
8331
- return () => {
8332
- delete visibleMap[index];
8333
- };
8334
- }, [
8335
- hasRegistered,
8336
- hasItems,
8337
- index,
8338
- itemValue,
8339
- store,
8340
- selectionMode
8341
- ]);
8342
- useIsoLayoutEffect(() => {
8343
- if (!open) {
8344
- didPointerDownRef.current = false;
8345
- return;
8346
- }
8347
- if (!hasRegistered || hasItems) return;
8348
- const selectedValue = store.state.selectedValue;
8349
- const lastSelectedValue = Array.isArray(selectedValue) ? selectedValue[selectedValue.length - 1] : selectedValue;
8350
- if (compareItemEquality(itemValue, lastSelectedValue, isItemEqualToValue)) store.set("selectedIndex", index);
8351
- }, [
8352
- hasRegistered,
8353
- hasItems,
8354
- open,
8355
- store,
8356
- index,
8357
- itemValue,
8358
- isItemEqualToValue
8359
- ]);
8360
- const state = {
8361
- disabled,
8362
- selected,
8363
- highlighted
8364
- };
8365
- const rootProps = getItemProps({
8366
- active: highlighted,
8367
- selected
8368
- });
8369
- rootProps.id = void 0;
8370
- rootProps.onFocus = void 0;
8371
- const { getButtonProps, buttonRef } = useButton({
8372
- disabled,
8373
- focusableWhenDisabled: true,
8374
- native: nativeButton,
8375
- composite: true
8376
- });
8377
- function commitSelection(nativeEvent) {
8378
- function selectItem() {
8379
- store.state.handleSelection(nativeEvent, itemValue);
8380
- }
8381
- if (store.state.submitOnItemClick) {
8382
- ReactDOM.flushSync(selectItem);
8383
- store.state.requestSubmit();
8384
- } else selectItem();
8385
- }
8386
- const defaultProps = {
8387
- id,
8388
- role: isRow ? "gridcell" : "option",
8389
- "aria-selected": selectable ? selected : void 0,
8390
- tabIndex: void 0,
8391
- onPointerDownCapture(event) {
8392
- didPointerDownRef.current = true;
8393
- event.preventDefault();
8394
- },
8395
- onMouseDown(event) {
8396
- event.preventDefault();
8397
- },
8398
- onClick(event) {
8399
- if (disabled || readOnly) return;
8400
- commitSelection(event.nativeEvent);
8401
- },
8402
- onMouseUp(event) {
8403
- const pointerStartedOnItem = didPointerDownRef.current;
8404
- didPointerDownRef.current = false;
8405
- if (disabled || readOnly || event.button !== 0 || pointerStartedOnItem || !highlighted) return;
8406
- commitSelection(event.nativeEvent);
8407
- }
8408
- };
8409
- const element = useRenderElement("div", componentProps, {
8410
- ref: [
8411
- buttonRef,
8412
- forwardedRef,
8413
- listItem.ref,
8414
- itemRef
8415
- ],
8416
- state,
8417
- props: [
8418
- rootProps,
8419
- defaultProps,
8420
- elementProps,
8421
- getButtonProps
8422
- ]
8423
- });
8424
- const contextValue = React.useMemo(() => ({
8425
- selected,
8426
- textRef
8427
- }), [selected, textRef]);
8428
- return /*#__PURE__*/ jsx(ComboboxItemContext.Provider, {
8429
- value: contextValue,
8430
- children: element
8431
- });
8432
- }));
8433
- if (process.env.NODE_ENV !== "production") ComboboxItem.displayName = "ComboboxItem";
8434
- //#endregion
8435
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/item-indicator/ComboboxItemIndicator.js
8436
- /**
8437
- * Indicates whether the item is selected.
8438
- * Renders a `<span>` element.
8439
- *
8440
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8441
- */
8442
- var ComboboxItemIndicator = /*#__PURE__*/ React.forwardRef(function ComboboxItemIndicator(componentProps, forwardedRef) {
8443
- const keepMounted = componentProps.keepMounted ?? false;
8444
- const { selected } = useComboboxItemContext();
8445
- if (!(keepMounted || selected)) return null;
8446
- return /*#__PURE__*/ jsx(Inner, {
8447
- ...componentProps,
8448
- ref: forwardedRef
8449
- });
8450
- });
8451
- /** The core implementation of the indicator is split here to avoid paying the hooks
8452
- * costs unless the element needs to be mounted. */
8453
- if (process.env.NODE_ENV !== "production") ComboboxItemIndicator.displayName = "ComboboxItemIndicator";
8454
- var Inner = /*#__PURE__*/ React.memo(/*#__PURE__*/ React.forwardRef((componentProps, forwardedRef) => {
8455
- const { render, className, style, keepMounted, ...elementProps } = componentProps;
8456
- const { selected } = useComboboxItemContext();
8457
- const indicatorRef = React.useRef(null);
8458
- const { transitionStatus, setMounted } = useTransitionStatus(selected);
8459
- const element = useRenderElement("span", componentProps, {
8460
- ref: [forwardedRef, indicatorRef],
8461
- state: {
8462
- selected,
8463
- transitionStatus
8464
- },
8465
- props: [{
8466
- "aria-hidden": true,
8467
- children: "✔️"
8468
- }, elementProps],
8469
- stateAttributesMapping: transitionStatusMapping
8470
- });
8471
- useOpenChangeComplete({
8472
- open: selected,
8473
- ref: indicatorRef,
8474
- onComplete() {
8475
- if (!selected) setMounted(false);
8476
- }
8477
- });
8478
- return element;
8479
- }));
8480
- if (process.env.NODE_ENV !== "production") Inner.displayName = "Inner";
8481
- //#endregion
8482
- //#region ../../node_modules/.bun/@base-ui+react@1.4.1+fa6c2f29eeb10566/node_modules/@base-ui/react/esm/combobox/clear/ComboboxClear.js
8483
- var stateAttributesMapping = {
8484
- ...transitionStatusMapping,
8485
- ...triggerOpenStateMapping
8486
- };
8487
- /**
8488
- * Clears the value when clicked.
8489
- * Renders a `<button>` element.
8490
- *
8491
- * Documentation: [Base UI Combobox](https://base-ui.com/react/components/combobox)
8492
- */
8493
- var ComboboxClear = /*#__PURE__*/ React.forwardRef(function ComboboxClear(componentProps, forwardedRef) {
8494
- const { render, className, disabled: disabledProp = false, nativeButton = true, keepMounted = false, style, ...elementProps } = componentProps;
8495
- const { disabled: fieldDisabled } = useFieldRootContext();
8496
- const store = useComboboxRootContext();
8497
- const selectionMode = useStore(store, selectors.selectionMode);
8498
- const comboboxDisabled = useStore(store, selectors.disabled);
8499
- const readOnly = useStore(store, selectors.readOnly);
8500
- const open = useStore(store, selectors.open);
8501
- const selectedValue = useStore(store, selectors.selectedValue);
8502
- const hasSelectionChips = useStore(store, selectors.hasSelectionChips);
8503
- const inputValue = useComboboxInputValueContext();
8504
- let visible = false;
8505
- if (selectionMode === "none") visible = inputValue !== "";
8506
- else if (selectionMode === "single") visible = selectedValue != null;
8507
- else visible = hasSelectionChips;
8508
- const disabled = fieldDisabled || comboboxDisabled || disabledProp;
8509
- const { buttonRef, getButtonProps } = useButton({
8510
- native: nativeButton,
8511
- disabled
8512
- });
8513
- const { mounted, transitionStatus, setMounted } = useTransitionStatus(visible);
8514
- const state = {
8515
- disabled,
8516
- open,
8517
- transitionStatus
8518
- };
8519
- useOpenChangeComplete({
8520
- open: visible,
8521
- ref: store.state.clearRef,
8522
- onComplete() {
8523
- if (!visible) setMounted(false);
8524
- }
8525
- });
8526
- const element = useRenderElement("button", componentProps, {
8527
- state,
8528
- ref: [
8529
- forwardedRef,
8530
- buttonRef,
8531
- store.state.clearRef
8532
- ],
8533
- props: [
8534
- {
8535
- tabIndex: -1,
8536
- children: "x",
8537
- onMouseDown(event) {
8538
- event.preventDefault();
8539
- },
8540
- onClick(event) {
8541
- if (disabled || readOnly) return;
8542
- const keyboardActiveRef = store.state.keyboardActiveRef;
8543
- store.state.setInputValue("", createChangeEventDetails(clearPress, event.nativeEvent));
8544
- if (selectionMode !== "none") {
8545
- store.state.setSelectedValue(Array.isArray(selectedValue) ? [] : null, createChangeEventDetails(clearPress, event.nativeEvent));
8546
- store.state.setIndices({
8547
- activeIndex: null,
8548
- selectedIndex: null,
8549
- type: keyboardActiveRef.current ? "keyboard" : "pointer"
8550
- });
8551
- } else store.state.setIndices({
8552
- activeIndex: null,
8553
- type: keyboardActiveRef.current ? "keyboard" : "pointer"
8554
- });
8555
- store.state.inputRef.current?.focus();
8556
- }
8557
- },
8558
- elementProps,
8559
- getButtonProps
8560
- ],
8561
- stateAttributesMapping
8562
- });
8563
- if (!(keepMounted || mounted)) return null;
8564
- return element;
8565
- });
8566
- if (process.env.NODE_ENV !== "production") ComboboxClear.displayName = "ComboboxClear";
8567
- //#endregion
8568
6776
  //#region src/workbench/browser/runtime/linkContext.ts
8569
6777
  /** The host owns URLs for links within the deployment. */
8570
6778
  var WorkbenchLinkContext = createContext(void 0);
@@ -24120,7 +22328,7 @@ function EditableAgentSettingsProvider({ children, task, nodeId, store, connecto
24120
22328
  return false;
24121
22329
  }
24122
22330
  const decoded = decodeRevisionContent({
24123
- modelVersion: 12,
22331
+ modelVersion: 13,
24124
22332
  modules: {},
24125
22333
  document: {
24126
22334
  bindings: {},
@@ -24539,7 +22747,7 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
24539
22747
  darkMode.current = darkMode$;
24540
22748
  setFailed(false);
24541
22749
  setLoading(true);
24542
- const extension = import("./typeScriptSession-C9sBGOKZ.js").then(({ loadTypeScriptExtension }) => loadTypeScriptExtension(uri, typingRef.current, () => prepareCompletionRef.current?.())).catch(() => void 0);
22750
+ const extension = import("./typeScriptSession-CRoezJPN.js").then(({ loadTypeScriptExtension }) => loadTypeScriptExtension(uri, typingRef.current, () => prepareCompletionRef.current?.())).catch(() => void 0);
24543
22751
  claimEditor(uri).then((nextRelease) => {
24544
22752
  release = nextRelease;
24545
22753
  if (disposed) {
@@ -24626,7 +22834,7 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
24626
22834
  editor.current?.updateOptions({ ariaDescribedBy });
24627
22835
  }, [ariaDescribedBy]);
24628
22836
  useEffect(() => {
24629
- import("./typeScriptSession-C9sBGOKZ.js").then(({ updateTypeScriptTyping }) => updateTypeScriptTyping(uri, typing)).catch(noop);
22837
+ import("./typeScriptSession-CRoezJPN.js").then(({ updateTypeScriptTyping }) => updateTypeScriptTyping(uri, typing)).catch(noop);
24630
22838
  }, [typing, uri]);
24631
22839
  useEffect(() => {
24632
22840
  if (location != null) editor.current?.revealPosition?.(location.line, location.column);
@@ -24651,55 +22859,110 @@ function CodeEditor({ ariaDescribedBy, ariaLabel, diagnostics, disabled, errorLa
24651
22859
  }
24652
22860
  //#endregion
24653
22861
  //#region src/workbench/browser/runtime/editor/codeHttpHosts.tsx
24654
- /** Edits the hosts of a Code `http` Capability, one per line; an empty list removes the Capability. */
24655
22862
  function CodeHttpHosts({ disabled, hosts, onSave }) {
24656
22863
  const t = useTranslate();
24657
22864
  const id = useId();
24658
22865
  const saved = hosts.join("\n");
24659
22866
  const [draft, setDraft] = useState(saved);
22867
+ const [openedHosts, setOpenedHosts] = useState(saved);
24660
22868
  const [error, setError] = useState();
24661
- useEffect(() => {
24662
- setDraft(saved);
24663
- setError(void 0);
24664
- }, [saved]);
22869
+ const [open, setOpen] = useState(false);
22870
+ const [pending, setPending] = useState(false);
22871
+ const [container, setContainer] = useState(null);
22872
+ const portal = useCallback((element) => {
22873
+ setContainer(element?.closest(".open-flow-workbench") ?? element?.closest(".open-flow-theme") ?? null);
22874
+ }, []);
24665
22875
  const commit = async () => {
22876
+ if (openedHosts !== saved) {
22877
+ setOpenedHosts(saved);
22878
+ setDraft(saved);
22879
+ setError(t("inspector.task.httpHostsUpdated"));
22880
+ return;
22881
+ }
24666
22882
  const next = [...new Set(draft.split(/[\s,]+/).flatMap((host) => host == "" ? [] : [host.toLowerCase()]))];
24667
22883
  const invalid = next.find((host) => !isHttpHost(host));
24668
22884
  if (invalid != null) return setError(t("inspector.task.httpHostsInvalid", { host: invalid }));
24669
22885
  if (next.length > 20) return setError(t("inspector.task.httpHostsLimit", { count: 20 }));
24670
22886
  setError(void 0);
24671
- if (dequal$1(next, hosts)) setDraft(saved);
24672
- else await onSave(next);
22887
+ setPending(true);
22888
+ try {
22889
+ if (dequal$1(next, hosts) || await onSave(next)) setOpen(false);
22890
+ } finally {
22891
+ setPending(false);
22892
+ }
24673
22893
  };
24674
- return /* @__PURE__ */ jsxs(Field, {
24675
- "data-inspector-section": "code-http",
24676
- children: [
24677
- /* @__PURE__ */ jsx(FieldLabel, {
24678
- className: "text-xs font-normal",
24679
- htmlFor: `${id}-hosts`,
24680
- children: t("inspector.task.httpHosts")
24681
- }),
24682
- /* @__PURE__ */ jsx(ValueEditorFeedback, {
24683
- error,
24684
- children: (errorId) => /* @__PURE__ */ jsx(Textarea, {
24685
- "aria-describedby": [`${id}-hint`, errorId].filter(Boolean).join(" "),
24686
- "aria-invalid": error != null || void 0,
24687
- className: "min-h-14 font-mono text-xs",
24688
- disabled,
24689
- id: `${id}-hosts`,
24690
- onBlur: () => void commit(),
24691
- onChange: (event) => setDraft(event.target.value),
24692
- placeholder: "api.example.com",
24693
- rows: 2,
24694
- spellCheck: false,
24695
- value: draft
24696
- })
24697
- }),
24698
- /* @__PURE__ */ jsx(FieldDescription, {
24699
- id: `${id}-hint`,
24700
- children: t("inspector.task.httpHostsHint")
24701
- })
24702
- ]
22894
+ return /* @__PURE__ */ jsx("span", {
22895
+ className: "inline-flex shrink-0",
22896
+ ref: portal,
22897
+ children: /* @__PURE__ */ jsxs(Dialog, {
22898
+ open,
22899
+ onOpenChange: (next) => {
22900
+ if (pending) return;
22901
+ if (next) {
22902
+ setOpenedHosts(saved);
22903
+ setDraft(saved);
22904
+ setError(void 0);
22905
+ }
22906
+ setOpen(next);
22907
+ },
22908
+ children: [/* @__PURE__ */ jsxs(DialogTrigger, {
22909
+ disabled,
22910
+ render: /* @__PURE__ */ jsx(Button$1, {
22911
+ type: "button",
22912
+ variant: "ghost",
22913
+ size: "sm",
22914
+ className: "font-normal text-muted-foreground"
22915
+ }),
22916
+ children: [t("inspector.task.httpHosts"), hosts.length > 0 ? ` · ${hosts.length}` : ""]
22917
+ }), /* @__PURE__ */ jsxs(DialogContent, {
22918
+ container,
22919
+ closeLabel: t("common.close"),
22920
+ children: [
22921
+ /* @__PURE__ */ jsx(DialogHeader, { children: /* @__PURE__ */ jsx(DialogTitle, { children: t("inspector.task.httpHosts") }) }),
22922
+ /* @__PURE__ */ jsxs(Field, {
22923
+ "data-inspector-section": "code-http",
22924
+ children: [
22925
+ /* @__PURE__ */ jsx(FieldLabel, {
22926
+ className: "sr-only",
22927
+ htmlFor: `${id}-hosts`,
22928
+ children: t("inspector.task.httpHosts")
22929
+ }),
22930
+ /* @__PURE__ */ jsx(ValueEditorFeedback, {
22931
+ error,
22932
+ children: (errorId) => /* @__PURE__ */ jsx(Textarea, {
22933
+ "aria-describedby": [`${id}-hint`, errorId].filter(Boolean).join(" "),
22934
+ "aria-invalid": error != null || void 0,
22935
+ className: "min-h-14 font-mono text-xs",
22936
+ disabled: disabled || pending,
22937
+ id: `${id}-hosts`,
22938
+ onChange: (event) => setDraft(event.target.value),
22939
+ placeholder: "api.example.com",
22940
+ rows: 2,
22941
+ spellCheck: false,
22942
+ value: draft
22943
+ })
22944
+ }),
22945
+ /* @__PURE__ */ jsx(FieldDescription, {
22946
+ id: `${id}-hint`,
22947
+ children: t("inspector.task.httpHostsHint")
22948
+ })
22949
+ ]
22950
+ }),
22951
+ /* @__PURE__ */ jsxs(DialogFooter, { children: [/* @__PURE__ */ jsx(Button$1, {
22952
+ type: "button",
22953
+ variant: "outline",
22954
+ disabled: pending,
22955
+ onClick: () => setOpen(false),
22956
+ children: t("common.cancel")
22957
+ }), /* @__PURE__ */ jsx(Button$1, {
22958
+ type: "button",
22959
+ disabled: disabled || pending,
22960
+ onClick: () => void commit(),
22961
+ children: t("common.save")
22962
+ })] })
22963
+ ]
22964
+ })]
22965
+ })
24703
22966
  });
24704
22967
  }
24705
22968
  //#endregion
@@ -25013,48 +23276,56 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
25013
23276
  event.preventDefault();
25014
23277
  store.saveModuleEditor();
25015
23278
  },
25016
- actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [false, /* @__PURE__ */ jsx(ActionSelectionDialog, {
25017
- notify: store.notify,
25018
- title: t("actionPicker.configureActions"),
25019
- triggerHint: selectedTools.length > 0 ? summary.workflows > 0 ? t("toolPicker.summary", {
25020
- tools: summary.count,
25021
- workflows: summary.workflows
25022
- }) : t("actionPicker.selectionSummary", {
25023
- actions: selectedTools.length,
25024
- providers: summary.providers.length
25025
- }) : void 0,
25026
- trigger: /* @__PURE__ */ jsxs(Button$1, {
25027
- type: "button",
25028
- variant: actionIssue ? "destructive" : "ghost",
25029
- size: "sm",
25030
- "aria-invalid": actionIssue || void 0,
25031
- className: actionIssue ? "gap-1.5 font-normal" : "gap-1.5 font-normal text-muted-foreground",
25032
- children: [actionIssue && /* @__PURE__ */ jsx("i", {
25033
- "aria-hidden": "true",
25034
- "data-icon": "inline-start",
25035
- className: "i-lucide-light:unplug size-3.5"
25036
- }), selectedTools.length === 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [!actionIssue && /* @__PURE__ */ jsx("i", {
25037
- "aria-hidden": "true",
25038
- "data-icon": "inline-start",
25039
- className: "i-lucide-light:plus size-3.5"
25040
- }), t("actionPicker.triggerLabel")] }) : /* @__PURE__ */ jsx(IconStack, {
25041
- icons: summary.providers,
25042
- count: summary.count,
25043
- size: "sm"
25044
- })]
25045
- }),
25046
- entries: selectedTools,
25047
- connectors,
25048
- prepareAction,
25049
- workflows: workflowTools,
25050
- disabled: disabled || pending,
25051
- createEntry: (action) => ({ action: action.actionId }),
25052
- onSave: (entries) => savePermission(dequal$1(entries.filter((item) => item.kind != "workflow"), selectedActions) ? permission : {
25053
- kind: "connector",
25054
- mode: "independent",
25055
- actions: entries.filter((item) => item.kind != "workflow")
25056
- }, entries.filter((item) => item.kind == "workflow"))
25057
- }, selection.id)] }),
23279
+ actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
23280
+ false,
23281
+ /* @__PURE__ */ jsx(CodeHttpHosts, {
23282
+ disabled: disabled || pending,
23283
+ hosts: httpHosts,
23284
+ onSave: saveHttpHosts
23285
+ }, `${selection.id}-http`),
23286
+ /* @__PURE__ */ jsx(ActionSelectionDialog, {
23287
+ notify: store.notify,
23288
+ title: t("actionPicker.configureActions"),
23289
+ triggerHint: selectedTools.length > 0 ? summary.workflows > 0 ? t("toolPicker.summary", {
23290
+ tools: summary.count,
23291
+ workflows: summary.workflows
23292
+ }) : t("actionPicker.selectionSummary", {
23293
+ actions: selectedTools.length,
23294
+ providers: summary.providers.length
23295
+ }) : void 0,
23296
+ trigger: /* @__PURE__ */ jsxs(Button$1, {
23297
+ type: "button",
23298
+ variant: actionIssue ? "destructive" : "ghost",
23299
+ size: "sm",
23300
+ "aria-invalid": actionIssue || void 0,
23301
+ className: actionIssue ? "gap-1.5 font-normal" : "gap-1.5 font-normal text-muted-foreground",
23302
+ children: [actionIssue && /* @__PURE__ */ jsx("i", {
23303
+ "aria-hidden": "true",
23304
+ "data-icon": "inline-start",
23305
+ className: "i-lucide-light:unplug size-3.5"
23306
+ }), selectedTools.length === 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [!actionIssue && /* @__PURE__ */ jsx("i", {
23307
+ "aria-hidden": "true",
23308
+ "data-icon": "inline-start",
23309
+ className: "i-lucide-light:plus size-3.5"
23310
+ }), t("actionPicker.triggerLabel")] }) : /* @__PURE__ */ jsx(IconStack, {
23311
+ icons: summary.providers,
23312
+ count: summary.count,
23313
+ size: "sm"
23314
+ })]
23315
+ }),
23316
+ entries: selectedTools,
23317
+ connectors,
23318
+ prepareAction,
23319
+ workflows: workflowTools,
23320
+ disabled: disabled || pending,
23321
+ createEntry: (action) => ({ action: action.actionId }),
23322
+ onSave: (entries) => savePermission(dequal$1(entries.filter((item) => item.kind != "workflow"), selectedActions) ? permission : {
23323
+ kind: "connector",
23324
+ mode: "independent",
23325
+ actions: entries.filter((item) => item.kind != "workflow")
23326
+ }, entries.filter((item) => item.kind == "workflow"))
23327
+ }, selection.id)
23328
+ ] }),
25058
23329
  children: [
25059
23330
  (loadError ?? completionError) != null && /* @__PURE__ */ jsxs("div", {
25060
23331
  className: "flex flex-col gap-2",
@@ -25065,11 +23336,6 @@ function EditableCodeTaskSection({ connectorAccess, connectorCandidates, connect
25065
23336
  children: loadError ?? completionError
25066
23337
  })]
25067
23338
  }),
25068
- /* @__PURE__ */ jsx(CodeHttpHosts, {
25069
- disabled: disabled || pending,
25070
- hosts: httpHosts,
25071
- onSave: saveHttpHosts
25072
- }),
25073
23339
  /* @__PURE__ */ jsx(ValueEditorFeedback, {
25074
23340
  error: moduleDiagnostics.length > 0 ? moduleDiagnostics.map((diagnostic) => /* @__PURE__ */ jsx("div", { children: diagnosticMessage(diagnostic, t) }, `${diagnostic.path}:${diagnostic.line}:${diagnostic.column}:${diagnostic.code}`)) : void 0,
25075
23341
  children: (errorId) => /* @__PURE__ */ jsx(CodeEditor, {
@@ -25253,32 +23519,6 @@ function isUnknownRecord(value) {
25253
23519
  return isPlainObject(value);
25254
23520
  }
25255
23521
  //#endregion
25256
- //#region src/ui/browser/native-select.tsx
25257
- function NativeSelect({ className, size = "default", ...props }) {
25258
- return /* @__PURE__ */ jsxs("div", {
25259
- className: cn("group/native-select relative w-fit has-[select:disabled]:opacity-50", className),
25260
- "data-slot": "native-select-wrapper",
25261
- "data-size": size,
25262
- children: [/* @__PURE__ */ jsx("select", {
25263
- "data-slot": "native-select",
25264
- "data-size": size,
25265
- className: "h-8 w-full min-w-0 appearance-none rounded-[var(--ui-control-radius,calc(var(--ui-radius)_+_2px))] border border-input bg-[var(--ui-control-background,var(--ui-muted))] py-1 pr-8 pl-2.5 text-sm transition-colors outline-none select-none selection:bg-primary selection:text-primary-foreground placeholder:text-muted-foreground data-[slot=native-select]:focus-visible:text-field-focus data-[slot=native-select]:focus-visible:aria-invalid:invalid-text-field-focus disabled:pointer-events-none disabled:cursor-not-allowed aria-invalid:border-destructive data-[size=sm]:h-7 data-[size=sm]:rounded-[var(--ui-control-radius,var(--ui-radius))] data-[size=sm]:py-0.5 dark:bg-[var(--ui-control-background,var(--ui-muted))] dark:hover:bg-input/50",
25266
- ...props
25267
- }), /* @__PURE__ */ jsx(ChevronDown, {
25268
- className: "pointer-events-none absolute top-1/2 right-2.5 size-4 -translate-y-1/2 text-muted-foreground select-none",
25269
- "aria-hidden": "true",
25270
- "data-slot": "native-select-icon"
25271
- })]
25272
- });
25273
- }
25274
- function NativeSelectOption({ className, ...props }) {
25275
- return /* @__PURE__ */ jsx("option", {
25276
- "data-slot": "native-select-option",
25277
- className: cn("bg-[Canvas] text-[CanvasText]", className),
25278
- ...props
25279
- });
25280
- }
25281
- //#endregion
25282
23522
  //#region src/ui/browser/simple-code-editor.ts
25283
23523
  var import_lib = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
25284
23524
  var __assign = exports && exports.__assign || function() {
@@ -27727,6 +25967,122 @@ function DecisionItemActions({ addLabel, removeLabel, canAdd = true, onAdd, onRe
27727
25967
  }), /* @__PURE__ */ jsx(TooltipContent, { children: removeLabel })] })] });
27728
25968
  }
27729
25969
  //#endregion
25970
+ //#region src/workbench/browser/runtime/editor/dedupeSection.tsx
25971
+ function DedupeSection({ task, disabled, onSave, history }) {
25972
+ const t = useTranslate();
25973
+ const id = useId();
25974
+ const taskRef = useRef(task);
25975
+ taskRef.current = task;
25976
+ const saveRef = useRef(onSave);
25977
+ saveRef.current = onSave;
25978
+ const [changes] = useState(() => new TaskExecutorChanges(task.executor, (before, next) => {
25979
+ const current = taskRef.current;
25980
+ if (before.kind !== "dedupe" || next.kind !== "dedupe" || current.executor.kind !== "dedupe") return Promise.resolve(false);
25981
+ const executor = { ...current.executor };
25982
+ for (const key of [
25983
+ "field",
25984
+ "mode",
25985
+ "space"
25986
+ ]) if (before[key] !== next[key]) Object.assign(executor, { [key]: next[key] });
25987
+ return saveRef.current(current, {
25988
+ ...current,
25989
+ executor
25990
+ });
25991
+ }));
25992
+ const [config, setConfig] = useState(changes.value);
25993
+ const [failed, setFailed] = useState(false);
25994
+ useEffect(() => {
25995
+ changes.sync(task.executor);
25996
+ setConfig(changes.value);
25997
+ }, [changes, task.executor]);
25998
+ async function save() {
25999
+ try {
26000
+ setFailed(!await changes.save());
26001
+ } catch {
26002
+ setFailed(true);
26003
+ }
26004
+ }
26005
+ function update(patch) {
26006
+ if (disabled || changes.value.kind !== "dedupe") return;
26007
+ changes.value = {
26008
+ ...changes.value,
26009
+ ...patch
26010
+ };
26011
+ setConfig(changes.value);
26012
+ save();
26013
+ }
26014
+ if (config.kind !== "dedupe") return null;
26015
+ return /* @__PURE__ */ jsx(InspectorSection, {
26016
+ title: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
26017
+ className: "min-w-0 flex-1",
26018
+ children: t("flowState.nodeTitle")
26019
+ }), history] }),
26020
+ children: /* @__PURE__ */ jsxs("div", {
26021
+ className: "node-settings flex flex-col gap-3",
26022
+ children: [
26023
+ /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
26024
+ htmlFor: `${id}-field`,
26025
+ children: t("flowState.field")
26026
+ }), /* @__PURE__ */ jsx(Input, {
26027
+ id: `${id}-field`,
26028
+ disabled,
26029
+ defaultValue: config.field,
26030
+ placeholder: t("flowState.fieldPlaceholder"),
26031
+ onBlur: (event) => {
26032
+ if (event.target.value !== config.field) update({ field: event.target.value });
26033
+ }
26034
+ }, config.field)] }),
26035
+ /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
26036
+ htmlFor: `${id}-mode`,
26037
+ children: t("flowState.mode")
26038
+ }), /* @__PURE__ */ jsxs(NativeSelect, {
26039
+ id: `${id}-mode`,
26040
+ disabled,
26041
+ value: config.mode,
26042
+ onChange: (event) => update({ mode: event.target.value }),
26043
+ children: [/* @__PURE__ */ jsx(NativeSelectOption, {
26044
+ value: "new",
26045
+ children: t("flowState.new")
26046
+ }), /* @__PURE__ */ jsx(NativeSelectOption, {
26047
+ value: "increasing",
26048
+ children: t("flowState.increasing")
26049
+ })]
26050
+ })] }),
26051
+ /* @__PURE__ */ jsxs(Field, { children: [/* @__PURE__ */ jsx(FieldLabel, {
26052
+ htmlFor: `${id}-space`,
26053
+ children: t("flowState.space")
26054
+ }), /* @__PURE__ */ jsxs(NativeSelect, {
26055
+ id: `${id}-space`,
26056
+ disabled,
26057
+ value: config.space,
26058
+ onChange: (event) => update({ space: event.target.value }),
26059
+ children: [/* @__PURE__ */ jsx(NativeSelectOption, {
26060
+ value: "node",
26061
+ children: t("flowState.nodeSpace")
26062
+ }), /* @__PURE__ */ jsx(NativeSelectOption, {
26063
+ value: "flow",
26064
+ children: t("flowState.flowSpace")
26065
+ })]
26066
+ })] }),
26067
+ failed && /* @__PURE__ */ jsxs("div", {
26068
+ role: "alert",
26069
+ children: [/* @__PURE__ */ jsx("p", { children: t("httpRequest.saveFailed") }), /* @__PURE__ */ jsx(Button$1, {
26070
+ disabled,
26071
+ onClick: () => void save(),
26072
+ variant: "outline",
26073
+ size: "sm",
26074
+ children: t("httpRequest.retry")
26075
+ })]
26076
+ }),
26077
+ /* @__PURE__ */ jsx("p", {
26078
+ className: "m-0 text-muted-foreground text-xs",
26079
+ children: t("flowState.warning")
26080
+ })
26081
+ ]
26082
+ })
26083
+ });
26084
+ }
26085
+ //#endregion
27730
26086
  //#region src/workbench/browser/runtime/editor/errorTriggerSources.tsx
27731
26087
  function ErrorTriggerSources({ flows, flowId, value, disabled = false, complete = true, footer, onChange }) {
27732
26088
  const t = useTranslate();
@@ -32478,7 +30834,7 @@ function inspectorIcon(node) {
32478
30834
  if (node?.kind == "task" && node.definition != null && "executor" in node.definition) {
32479
30835
  if (node.definition.executor.kind == "decision") return "decision";
32480
30836
  if (node.definition.executor.kind == "workflow") return "flow";
32481
- if (node.definition.executor.kind == "openapi" || node.definition.executor.kind == "http-request") return "task";
30837
+ if (node.definition.executor.kind == "openapi" || node.definition.executor.kind == "http-request" || node.definition.executor.kind == "dedupe") return "task";
32482
30838
  return node.definition.executor.kind == "connector" ? "connection" : "llm";
32483
30839
  }
32484
30840
  return "task";
@@ -32511,6 +30867,7 @@ function nodePurposePlaceholder(selection, t, action, displays) {
32511
30867
  case "agent": return t("addNode.agentDescription");
32512
30868
  case "decision": return t("decision.description");
32513
30869
  case "workflow": return t("workflow.description");
30870
+ case "dedupe": return;
32514
30871
  case "http-request": return t("httpRequest.description");
32515
30872
  case "openapi": return t("openapi.description");
32516
30873
  case "connector": return action?.description;
@@ -32858,6 +31215,25 @@ function NodeInspector({ onAddWorkflowOutputs, onAddResponseNode, webhookDeploym
32858
31215
  actions: workflowActions,
32859
31216
  list: (signal) => store.listWorkflowTargets(signal)
32860
31217
  }, `workflow:${selection?.id}`),
31218
+ task != null && "executor" in task && task.executor.kind === "dedupe" && /* @__PURE__ */ jsx(DedupeSection, {
31219
+ task,
31220
+ disabled,
31221
+ history: store != null && store.$.flowId.value != null ? /* @__PURE__ */ jsx(FlowStateButton, {
31222
+ client: store.state,
31223
+ flowId: store.$.flowId.value,
31224
+ nodeIds: Object.keys(revision.graph()?.nodes ?? {}),
31225
+ history: {
31226
+ nodeId: selection.id,
31227
+ space: task.executor.space === "flow" ? "flow" : `node:${selection.id}`
31228
+ }
31229
+ }, selection.id) : void 0,
31230
+ onSave: (before, value) => store?.nodes.saveTaskSettings(selection.id, {
31231
+ kind: "dedupe",
31232
+ name: task.name,
31233
+ before,
31234
+ task: value
31235
+ }) ?? Promise.resolve(false)
31236
+ }, `${revision.revision.flowId}:${selection.id}`),
32861
31237
  isHttpRequest && task != null && "executor" in task && /* @__PURE__ */ jsx(HttpRequestSection, {
32862
31238
  task,
32863
31239
  disabled,
@@ -37682,7 +36058,7 @@ function WorkspaceDiagnosticsIsland({ checking, items, nodes, onOpenChange, onRe
37682
36058
  }
37683
36059
  //#endregion
37684
36060
  //#region src/workbench/browser/runtime/shell/workspaceNavigationIsland.tsx
37685
- function WorkspaceNavigationIsland({ flowName, flowsHref, ghost = false, onOpenFlows, saveStatus }) {
36061
+ function WorkspaceNavigationIsland({ flowName, settings, flowsHref, ghost = false, onOpenFlows, saveStatus }) {
37686
36062
  const t = useTranslate();
37687
36063
  const [tooltipContainer, setTooltipContainer] = useState(null);
37688
36064
  const draftStatus = saveStatus == "saved" || saveStatus == "saving" || saveStatus == "failed" ? saveStatus : void 0;
@@ -37733,7 +36109,8 @@ function WorkspaceNavigationIsland({ flowName, flowsHref, ghost = false, onOpenF
37733
36109
  role: "status",
37734
36110
  tabIndex: 0
37735
36111
  })
37736
- })
36112
+ }),
36113
+ settings
37737
36114
  ]
37738
36115
  })
37739
36116
  })
@@ -37746,7 +36123,7 @@ var blockedReasonKey = {
37746
36123
  busy: "workspace.publishActionInProgress",
37747
36124
  publishing: "workspace.publishInProgress"
37748
36125
  };
37749
- function WorkspacePublishIsland({ hasPublications, onOpenPublications, onExport, onExportSvg, onOpenRuns, onPublish, state }) {
36126
+ function WorkspacePublishIsland({ hasPublications, onOpenPublications, onExport, onExportSvg, onOpenRuns, onOpenState, onPublish, state }) {
37750
36127
  const t = useTranslate();
37751
36128
  const [popupContainer, setPopupContainer] = useState(null);
37752
36129
  const [confirming, setConfirming] = useState(false);
@@ -37882,6 +36259,14 @@ function WorkspacePublishIsland({ hasPublications, onOpenPublications, onExport,
37882
36259
  children: historyLabel
37883
36260
  })]
37884
36261
  }),
36262
+ onOpenState != null && /* @__PURE__ */ jsxs(DropdownMenuItem, {
36263
+ className: "gap-2 px-2 py-[5px]",
36264
+ onClick: onOpenState,
36265
+ children: [/* @__PURE__ */ jsx("i", {
36266
+ "aria-hidden": "true",
36267
+ className: "i-lucide-light:database size-4 shrink-0 text-foreground/70"
36268
+ }), t("flowState.title")]
36269
+ }),
37885
36270
  /* @__PURE__ */ jsxs(DropdownMenuItem, {
37886
36271
  className: "gap-2 px-2 py-[5px]",
37887
36272
  onClick: onOpenRuns,
@@ -38121,7 +36506,9 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
38121
36506
  const connections = useVal(store.connectors.$.pickerConnections);
38122
36507
  const triggerCatalogState = useVal(store.triggers.catalog.state);
38123
36508
  const [startId, setStartId] = useState();
36509
+ const [stateTarget, setStateTarget] = useState();
38124
36510
  const runInputRequest = useVal(store.runRequests.$.inputRequest);
36511
+ useVal(store.runRequests.$.inputsLoaded);
38125
36512
  const busy = useVal(store.$.busy);
38126
36513
  const diagnostics = useVal(store.$.diagnostics);
38127
36514
  const diagnosticItems = useVal(store.$.diagnosticItems);
@@ -38262,244 +36649,266 @@ function FlowEditor({ navigationIsland, onRun, onRunStarted, onCloseRuns, onConf
38262
36649
  onRedo: () => void store.workspace.redo(),
38263
36650
  onRetry: () => void store.workspace.retryHistorySync()
38264
36651
  };
38265
- return /* @__PURE__ */ jsxs(CanvasHistoryScope, {
38266
- history: historyControls,
38267
- disabled: authoringDisabled,
38268
- "aria-label": t("workspace.design"),
38269
- className: `editor-grid ${contextPanelVisible ? "" : "context-panel-closed"}`,
38270
- id: "workspace-panel-design",
38271
- role: "region",
38272
- tabIndex: 0,
38273
- children: [
38274
- /* @__PURE__ */ jsx(WorkbenchCanvas, {
38275
- interactiveMode$: store.interactiveMode$,
38276
- connectionControl: /* @__PURE__ */ jsx(ConnectionUsageButton, {
38277
- connectionHref,
38278
- onManage: onManageConnectorAccess,
38279
- onSelectReference: setAccountReference,
38280
- store
38281
- }, flowId),
38282
- topLeftTools: navigationIsland,
38283
- bottomRightTools: /* @__PURE__ */ jsx(RunStatusIslandContainer, {
38284
- onToggle: onToggleRuns,
38285
- open: runDrawerOpen,
38286
- panelId: RUN_LOG_PANEL_ID,
38287
- store
38288
- }),
38289
- cornerLeading: /* @__PURE__ */ jsxs("div", {
38290
- className: "workspace-corner-leading",
38291
- children: [diagnostics?.valid == false && diagnosticItems.length > 0 && /* @__PURE__ */ jsx(WorkspaceDiagnosticsIsland, {
38292
- checking: checkLoading,
38293
- items: diagnosticItems,
38294
- nodes: designerNodes,
38295
- onOpenChange: (open) => {
38296
- if (open) store.runRequests.dismissInputs();
38297
- setDiagnosticsOpen(open);
36652
+ return /* @__PURE__ */ jsx(NodeHistoryContext.Provider, {
36653
+ value: (nodeId) => {
36654
+ const node = revision?.graph().nodes[nodeId];
36655
+ if (flowId == null || node?.kind !== "task" || !("executor" in node.task) || node.task.executor.kind !== "dedupe") return void 0;
36656
+ const space = node.task.executor.space === "flow" ? "flow" : `node:${nodeId}`;
36657
+ return {
36658
+ label: t("flowState.history"),
36659
+ onClick: () => setStateTarget({ history: {
36660
+ nodeId,
36661
+ space
36662
+ } })
36663
+ };
36664
+ },
36665
+ children: /* @__PURE__ */ jsxs(CanvasHistoryScope, {
36666
+ history: historyControls,
36667
+ disabled: authoringDisabled,
36668
+ "aria-label": t("workspace.design"),
36669
+ className: `editor-grid ${contextPanelVisible ? "" : "context-panel-closed"}`,
36670
+ id: "workspace-panel-design",
36671
+ role: "region",
36672
+ tabIndex: 0,
36673
+ children: [
36674
+ flowId != null && stateTarget != null && /* @__PURE__ */ jsx(FlowStateButton, {
36675
+ client: store.state,
36676
+ flowId,
36677
+ nodeIds: designer.nodes.map((node) => node.id),
36678
+ history: stateTarget.history,
36679
+ onClose: () => setStateTarget(void 0)
36680
+ }, `${flowId}:${stateTarget.history?.nodeId ?? "all"}`),
36681
+ /* @__PURE__ */ jsx(WorkbenchCanvas, {
36682
+ interactiveMode$: store.interactiveMode$,
36683
+ connectionControl: /* @__PURE__ */ jsx(ConnectionUsageButton, {
36684
+ connectionHref,
36685
+ onManage: onManageConnectorAccess,
36686
+ onSelectReference: setAccountReference,
36687
+ store
36688
+ }, flowId),
36689
+ topLeftTools: navigationIsland,
36690
+ bottomRightTools: /* @__PURE__ */ jsx(RunStatusIslandContainer, {
36691
+ onToggle: onToggleRuns,
36692
+ open: runDrawerOpen,
36693
+ panelId: RUN_LOG_PANEL_ID,
36694
+ store
36695
+ }),
36696
+ cornerLeading: /* @__PURE__ */ jsxs("div", {
36697
+ className: "workspace-corner-leading",
36698
+ children: [diagnostics?.valid == false && diagnosticItems.length > 0 && /* @__PURE__ */ jsx(WorkspaceDiagnosticsIsland, {
36699
+ checking: checkLoading,
36700
+ items: diagnosticItems,
36701
+ nodes: designerNodes,
36702
+ onOpenChange: (open) => {
36703
+ if (open) store.runRequests.dismissInputs();
36704
+ setDiagnosticsOpen(open);
36705
+ },
36706
+ onRefresh: () => void store.workspace.check(),
36707
+ onSelect: (item) => {
36708
+ if (store.workspace.locateDiagnostic(item)) setDiagnosticsOpen(false);
36709
+ },
36710
+ onSelectNode: (nodeId) => {
36711
+ if (store.workspace.locateNode(nodeId)) {
36712
+ openInspector();
36713
+ setDiagnosticsOpen(false);
36714
+ }
36715
+ },
36716
+ open: diagnosticsOpen
36717
+ }), /* @__PURE__ */ jsx(WorkspacePublishIsland, {
36718
+ onExportSvg: connectorAccess.access?.mode != "selectable" || designer.nodes.length == 0 ? void 0 : () => store.exportSvg(language, {
36719
+ dark: theme == "dark",
36720
+ ignoredNodeIds
36721
+ }),
36722
+ onExport: () => {
36723
+ const id = store.workspace.$.flowId.value;
36724
+ if (id != null) store.workspace.exportFlow(id);
36725
+ },
36726
+ hasPublications: live == null ? void 0 : live.publication != null,
36727
+ onOpenPublications,
36728
+ onOpenRuns,
36729
+ onOpenState: flowId == null ? void 0 : () => setStateTarget({}),
36730
+ onPublish: () => void store.publications.publish(),
36731
+ state: publishState
36732
+ })]
36733
+ }),
36734
+ history: historyControls,
36735
+ ignoredNodeIds,
36736
+ onIgnoreNodes,
36737
+ runControl: draft != null && selectedTrigger != null ? /* @__PURE__ */ jsx(RunControl, {
36738
+ disabled: busy != null && busy != "run" && busy != "designer",
36739
+ inputContent: /* @__PURE__ */ jsx(RunInputPanel, {
36740
+ onStarted: onRunStarted,
36741
+ store: store.runRequests,
36742
+ theme
36743
+ }),
36744
+ inputOpen: runInputRequest?.triggerId == selectedTrigger.id,
36745
+ inputStatus: store.runRequests.inputStatus(draft.flowId, draft, selectedTrigger.id),
36746
+ onInputOpenChange: (open) => {
36747
+ if (open) store.editDraftRunInputs(selectedTrigger.id);
36748
+ else store.runRequests.dismissInputs();
38298
36749
  },
38299
- onRefresh: () => void store.workspace.check(),
38300
- onSelect: (item) => {
38301
- if (store.workspace.locateDiagnostic(item)) setDiagnosticsOpen(false);
36750
+ onRun: () => onRun(selectedTrigger.id),
36751
+ onSelectTrigger: (triggerId) => {
36752
+ store.runRequests.dismissInputs();
36753
+ setStartId(triggerId);
38302
36754
  },
38303
- onSelectNode: (nodeId) => {
38304
- if (store.workspace.locateNode(nodeId)) {
38305
- openInspector();
38306
- setDiagnosticsOpen(false);
38307
- }
36755
+ selectedTriggerId: selectedTrigger.id,
36756
+ starting: busy == "run",
36757
+ triggers
36758
+ }) : void 0,
36759
+ addNodeControl: /* @__PURE__ */ jsx(NodePickerPopover, {
36760
+ options: addNodeOptions,
36761
+ connections,
36762
+ loadConnections: store.connectors.loadConnections,
36763
+ browseOptions: store.browseAddNodeOptions,
36764
+ searchOptions: store.provideAddNodeOptions,
36765
+ provideChoices: store.provideAddNodeOptionChoices,
36766
+ catalogFailed: triggerCatalogState.error != null,
36767
+ refreshCatalog: store.retryCatalog,
36768
+ initialTab: initialAddNodeTab,
36769
+ disabled: authoringDisabled,
36770
+ focusRequest: 0,
36771
+ onAdd: addFromPicker,
36772
+ onRegisterDragOption: (option) => designerRef.current?.registerDraggedNode(option),
36773
+ onDragEnd: () => designerRef.current?.clearDraggedNode()
36774
+ }, flowId ?? ""),
36775
+ nodePicker: {
36776
+ connections,
36777
+ loadConnections: store.connectors.loadConnections,
36778
+ browseOptions: store.browseAddNodeOptions,
36779
+ provideChoices: store.provideAddNodeOptionChoices,
36780
+ catalogFailed: triggerCatalogState.error != null,
36781
+ refreshCatalog: store.retryCatalog,
36782
+ initialTab: initialAddNodeTab
36783
+ },
36784
+ addNodeOptions,
36785
+ disabled: authoringDisabled,
36786
+ subscribeCanvasCommands: store.workspace.subscribeCanvasCommands,
36787
+ focusNodeRequest: diagnosticFocus ?? nodeFocus,
36788
+ inspectorOpen: contextPanelVisible,
36789
+ model: designer,
36790
+ annotationContext: canvasAnnotations(flowId, draft, workspaceStatus, moduleEditor?.status, history.failed),
36791
+ onAddNode: async (option, position, connection) => {
36792
+ const nodeId = await store.addNode(option, position, connection);
36793
+ if (nodeId != null && flowId != null && store.workspace.$.flowId.value == flowId) {
36794
+ setAddedNode({
36795
+ flowId,
36796
+ nodeId
36797
+ });
36798
+ if (panel.open) panel.activate([nodeId]);
36799
+ }
36800
+ return nodeId;
36801
+ },
36802
+ onConnect: (edge) => void store.workspace.connect(edge),
36803
+ onChangeNodeContentHidden: (nodeId, hidden) => void store.workspace.saveNodeContentHidden(nodeId, hidden),
36804
+ onChangeComment: (nodeId, value) => void store.workspace.saveComment(nodeId, value),
36805
+ onCopy: () => store.workspace.copySelectedNodes(),
36806
+ onDeleteEdge: (edge) => void store.workspace.disconnect(edge),
36807
+ onDeleteNodes: () => void store.workspace.deleteSelectedNodes(),
36808
+ onDuplicate: (positions, offset) => void store.workspace.duplicateSelectedNodes(positions, offset),
36809
+ onMoveNodes: (positions) => void store.workspace.moveNodes(positions),
36810
+ onMoveViewport: (viewport) => void store.workspace.moveViewport(viewport),
36811
+ onPaste: () => void store.workspace.pasteNodes(),
36812
+ provideAddNodeOptions: store.provideAddNodeOptions,
36813
+ onSelectNodes: panel.select,
36814
+ onActivateSelection: panel.activate,
36815
+ onSelectionStart: panel.startSelection,
36816
+ onSelectionEnd: panel.endSelection,
36817
+ onToggleInspector: toggleInspector,
36818
+ ref: designerRef,
36819
+ selectedNodeIds: panel.canvasSelection,
36820
+ theme
36821
+ }),
36822
+ contextPanelVisible && /* @__PURE__ */ jsxs(EditorContextPanel, {
36823
+ resizable: true,
36824
+ onBack: !flowSelected ? () => {
36825
+ panel.back();
36826
+ designerRef.current?.focusCanvas();
36827
+ } : void 0,
36828
+ nodeId: singleSelected ? selectedDesignerNode?.id : void 0,
36829
+ nodeHeading: singleSelected && selection != null ? {
36830
+ titleReadOnly: selection.kind === "trigger" && (selection.trigger.kind === "manual" || selection.trigger.kind === "start"),
36831
+ title: selection.node.name ?? selectedDesignerNode?.title ?? "",
36832
+ icon: selectedDesignerNode != null && "icon" in selectedDesignerNode ? selectedDesignerNode.icon : void 0,
36833
+ disabled: authoringDisabled,
36834
+ fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection) }),
36835
+ onRename: (name) => {
36836
+ store.workspace.nodes.saveNodeTitle(selection.id, name);
38308
36837
  },
38309
- open: diagnosticsOpen
38310
- }), /* @__PURE__ */ jsx(WorkspacePublishIsland, {
38311
- onExportSvg: connectorAccess.access?.mode != "selectable" || designer.nodes.length == 0 ? void 0 : () => store.exportSvg(language, {
38312
- dark: theme == "dark",
38313
- ignoredNodeIds
36838
+ onIconChange: (icon) => {
36839
+ store.workspace.nodes.saveNodeIcon(selection.id, icon);
36840
+ },
36841
+ validate: (name) => {
36842
+ if (revision == null) return;
36843
+ const graph = revision.graph();
36844
+ if (graph == null) return;
36845
+ const issue = nodeNameIssue(graph, selection.id, name);
36846
+ return issue == null ? void 0 : t(`inspector.node.${issue === "empty" ? "nameEmpty" : "nameDuplicate"}`);
36847
+ }
36848
+ } : singleSelected && selectedDesignerNode?.kind === "comment" ? {
36849
+ title: selectedDesignerNode.title,
36850
+ disabled: authoringDisabled,
36851
+ fallback: /* @__PURE__ */ jsx("i", {
36852
+ "aria-hidden": "true",
36853
+ className: "i-codicon:note"
38314
36854
  }),
38315
- onExport: () => {
38316
- const id = store.workspace.$.flowId.value;
38317
- if (id != null) store.workspace.exportFlow(id);
36855
+ validate: () => void 0,
36856
+ onRename: (title) => {
36857
+ store.workspace.saveComment(selectedDesignerNode.id, {
36858
+ title,
36859
+ content: selectedDesignerNode.content ?? ""
36860
+ });
36861
+ }
36862
+ } : void 0,
36863
+ focusOnOpen: focusInspectorOnOpen.current,
36864
+ icon: contextPanelIcon,
36865
+ onClose: () => closeContextPanel(opener.current),
36866
+ theme,
36867
+ title: contextPanelTitle,
36868
+ children: [/* @__PURE__ */ jsx("div", {
36869
+ hidden: !flowSelected,
36870
+ className: flowSelected ? "flex h-full min-h-0 flex-col" : "hidden",
36871
+ children: /* @__PURE__ */ jsx("div", {
36872
+ className: "min-h-0 flex-1",
36873
+ children: /* @__PURE__ */ jsx(FlowNodeList, {
36874
+ groupTriggers: true,
36875
+ nodes: designer.nodes,
36876
+ onFocusNode: focusNode,
36877
+ onSelect: selectOutlineNode
36878
+ }, flowId ?? "")
36879
+ })
36880
+ }), multipleSelected ? /* @__PURE__ */ jsx(FlowNodeList, {
36881
+ nodes: designer.nodes.filter((node) => selectedNodeIds.includes(node.id)),
36882
+ onSelect: selectOutlineNode,
36883
+ onFocusNode: focusNode
36884
+ }) : flowSelected ? null : selectedDesignerNode?.kind == "comment" ? /* @__PURE__ */ jsx(CommentInspector, {
36885
+ title: selectedDesignerNode.title,
36886
+ content: selectedDesignerNode.content ?? "",
36887
+ disabled: authoringDisabled,
36888
+ dark: theme == "dark",
36889
+ onSave: (comment) => void store.workspace.saveComment(selectedDesignerNode.id, comment)
36890
+ }, selectedDesignerNode.id) : revision != null && /* @__PURE__ */ jsx(NodeInspectorContainer, {
36891
+ onAddWorkflowOutputs: () => {
36892
+ const option = store.workspace.$.addNodeOptions.value.find((item) => item.kind === "outputs");
36893
+ if (option != null) addFromPicker(option);
38318
36894
  },
38319
- hasPublications: live == null ? void 0 : live.publication != null,
38320
- onOpenPublications,
38321
- onOpenRuns,
38322
- onPublish: () => void store.publications.publish(),
38323
- state: publishState
36895
+ store,
36896
+ focus: diagnosticFocus,
36897
+ disabled: authoringDisabled,
36898
+ revision,
36899
+ selection,
36900
+ theme
38324
36901
  })]
38325
36902
  }),
38326
- history: historyControls,
38327
- ignoredNodeIds,
38328
- onIgnoreNodes,
38329
- runControl: draft != null && selectedTrigger != null ? /* @__PURE__ */ jsx(RunControl, {
38330
- disabled: busy != null && busy != "run" && busy != "designer",
38331
- inputContent: /* @__PURE__ */ jsx(RunInputPanel, {
38332
- onStarted: onRunStarted,
38333
- store: store.runRequests,
38334
- theme
38335
- }),
38336
- inputOpen: runInputRequest?.triggerId == selectedTrigger.id,
38337
- inputStatus: store.runRequests.inputStatus(draft.flowId, draft, selectedTrigger.id),
38338
- onInputOpenChange: (open) => {
38339
- if (open) store.editDraftRunInputs(selectedTrigger.id);
38340
- else store.runRequests.dismissInputs();
38341
- },
38342
- onRun: () => onRun(selectedTrigger.id),
38343
- onSelectTrigger: (triggerId) => {
38344
- store.runRequests.dismissInputs();
38345
- setStartId(triggerId);
38346
- },
38347
- selectedTriggerId: selectedTrigger.id,
38348
- starting: busy == "run",
38349
- triggers
38350
- }) : void 0,
38351
- addNodeControl: /* @__PURE__ */ jsx(NodePickerPopover, {
38352
- options: addNodeOptions,
38353
- connections,
38354
- loadConnections: store.connectors.loadConnections,
38355
- browseOptions: store.browseAddNodeOptions,
38356
- searchOptions: store.provideAddNodeOptions,
38357
- provideChoices: store.provideAddNodeOptionChoices,
38358
- catalogFailed: triggerCatalogState.error != null,
38359
- refreshCatalog: store.retryCatalog,
38360
- initialTab: initialAddNodeTab,
38361
- disabled: authoringDisabled,
38362
- focusRequest: 0,
38363
- onAdd: addFromPicker,
38364
- onRegisterDragOption: (option) => designerRef.current?.registerDraggedNode(option),
38365
- onDragEnd: () => designerRef.current?.clearDraggedNode()
38366
- }, flowId ?? ""),
38367
- nodePicker: {
38368
- connections,
38369
- loadConnections: store.connectors.loadConnections,
38370
- browseOptions: store.browseAddNodeOptions,
38371
- provideChoices: store.provideAddNodeOptionChoices,
38372
- catalogFailed: triggerCatalogState.error != null,
38373
- refreshCatalog: store.retryCatalog,
38374
- initialTab: initialAddNodeTab
38375
- },
38376
- addNodeOptions,
38377
- disabled: authoringDisabled,
38378
- subscribeCanvasCommands: store.workspace.subscribeCanvasCommands,
38379
- focusNodeRequest: diagnosticFocus ?? nodeFocus,
38380
- inspectorOpen: contextPanelVisible,
38381
- model: designer,
38382
- annotationContext: canvasAnnotations(flowId, draft, workspaceStatus, moduleEditor?.status, history.failed),
38383
- onAddNode: async (option, position, connection) => {
38384
- const nodeId = await store.addNode(option, position, connection);
38385
- if (nodeId != null && flowId != null && store.workspace.$.flowId.value == flowId) {
38386
- setAddedNode({
38387
- flowId,
38388
- nodeId
38389
- });
38390
- if (panel.open) panel.activate([nodeId]);
38391
- }
38392
- return nodeId;
38393
- },
38394
- onConnect: (edge) => void store.workspace.connect(edge),
38395
- onChangeNodeContentHidden: (nodeId, hidden) => void store.workspace.saveNodeContentHidden(nodeId, hidden),
38396
- onChangeComment: (nodeId, value) => void store.workspace.saveComment(nodeId, value),
38397
- onCopy: () => store.workspace.copySelectedNodes(),
38398
- onDeleteEdge: (edge) => void store.workspace.disconnect(edge),
38399
- onDeleteNodes: () => void store.workspace.deleteSelectedNodes(),
38400
- onDuplicate: (positions, offset) => void store.workspace.duplicateSelectedNodes(positions, offset),
38401
- onMoveNodes: (positions) => void store.workspace.moveNodes(positions),
38402
- onMoveViewport: (viewport) => void store.workspace.moveViewport(viewport),
38403
- onPaste: () => void store.workspace.pasteNodes(),
38404
- provideAddNodeOptions: store.provideAddNodeOptions,
38405
- onSelectNodes: panel.select,
38406
- onActivateSelection: panel.activate,
38407
- onSelectionStart: panel.startSelection,
38408
- onSelectionEnd: panel.endSelection,
38409
- onToggleInspector: toggleInspector,
38410
- ref: designerRef,
38411
- selectedNodeIds: panel.canvasSelection,
38412
- theme
38413
- }),
38414
- contextPanelVisible && /* @__PURE__ */ jsxs(EditorContextPanel, {
38415
- resizable: true,
38416
- onBack: !flowSelected ? () => {
38417
- panel.back();
38418
- designerRef.current?.focusCanvas();
38419
- } : void 0,
38420
- nodeId: singleSelected ? selectedDesignerNode?.id : void 0,
38421
- nodeHeading: singleSelected && selection != null ? {
38422
- titleReadOnly: selection.kind === "trigger" && (selection.trigger.kind === "manual" || selection.trigger.kind === "start"),
38423
- title: selection.node.name ?? selectedDesignerNode?.title ?? "",
38424
- icon: selectedDesignerNode != null && "icon" in selectedDesignerNode ? selectedDesignerNode.icon : void 0,
38425
- disabled: authoringDisabled,
38426
- fallback: /* @__PURE__ */ jsx(Icon, { name: inspectorIcon(selection) }),
38427
- onRename: (name) => {
38428
- store.workspace.nodes.saveNodeTitle(selection.id, name);
38429
- },
38430
- onIconChange: (icon) => {
38431
- store.workspace.nodes.saveNodeIcon(selection.id, icon);
38432
- },
38433
- validate: (name) => {
38434
- if (revision == null) return;
38435
- const graph = revision.graph();
38436
- if (graph == null) return;
38437
- const issue = nodeNameIssue(graph, selection.id, name);
38438
- return issue == null ? void 0 : t(`inspector.node.${issue === "empty" ? "nameEmpty" : "nameDuplicate"}`);
38439
- }
38440
- } : singleSelected && selectedDesignerNode?.kind === "comment" ? {
38441
- title: selectedDesignerNode.title,
38442
- disabled: authoringDisabled,
38443
- fallback: /* @__PURE__ */ jsx("i", {
38444
- "aria-hidden": "true",
38445
- className: "i-codicon:note"
38446
- }),
38447
- validate: () => void 0,
38448
- onRename: (title) => {
38449
- store.workspace.saveComment(selectedDesignerNode.id, {
38450
- title,
38451
- content: selectedDesignerNode.content ?? ""
38452
- });
38453
- }
38454
- } : void 0,
38455
- focusOnOpen: focusInspectorOnOpen.current,
38456
- icon: contextPanelIcon,
38457
- onClose: () => closeContextPanel(opener.current),
38458
- theme,
38459
- title: contextPanelTitle,
38460
- children: [/* @__PURE__ */ jsx("div", {
38461
- hidden: !flowSelected,
38462
- className: flowSelected ? "flex h-full min-h-0 flex-col" : "hidden",
38463
- children: /* @__PURE__ */ jsx("div", {
38464
- className: "min-h-0 flex-1",
38465
- children: /* @__PURE__ */ jsx(FlowNodeList, {
38466
- groupTriggers: true,
38467
- nodes: designer.nodes,
38468
- onFocusNode: focusNode,
38469
- onSelect: selectOutlineNode
38470
- }, flowId ?? "")
38471
- })
38472
- }), multipleSelected ? /* @__PURE__ */ jsx(FlowNodeList, {
38473
- nodes: designer.nodes.filter((node) => selectedNodeIds.includes(node.id)),
38474
- onSelect: selectOutlineNode,
38475
- onFocusNode: focusNode
38476
- }) : flowSelected ? null : selectedDesignerNode?.kind == "comment" ? /* @__PURE__ */ jsx(CommentInspector, {
38477
- title: selectedDesignerNode.title,
38478
- content: selectedDesignerNode.content ?? "",
38479
- disabled: authoringDisabled,
38480
- dark: theme == "dark",
38481
- onSave: (comment) => void store.workspace.saveComment(selectedDesignerNode.id, comment)
38482
- }, selectedDesignerNode.id) : revision != null && /* @__PURE__ */ jsx(NodeInspectorContainer, {
38483
- onAddWorkflowOutputs: () => {
38484
- const option = store.workspace.$.addNodeOptions.value.find((item) => item.kind === "outputs");
38485
- if (option != null) addFromPicker(option);
38486
- },
38487
- store,
38488
- focus: diagnosticFocus,
38489
- disabled: authoringDisabled,
38490
- revision,
38491
- selection,
38492
- theme
38493
- })]
38494
- }),
38495
- /* @__PURE__ */ jsx(RunDrawerContainer, {
38496
- onOpenRuns,
38497
- onClose: onCloseRuns,
38498
- onConfigureConnector,
38499
- open: runDrawerOpen,
38500
- store
38501
- })
38502
- ]
36903
+ /* @__PURE__ */ jsx(RunDrawerContainer, {
36904
+ onOpenRuns,
36905
+ onClose: onCloseRuns,
36906
+ onConfigureConnector,
36907
+ open: runDrawerOpen,
36908
+ store
36909
+ })
36910
+ ]
36911
+ })
38503
36912
  });
38504
36913
  }
38505
36914
  function FlowWorkspace({ hrefFor, navigation, onConfigureConnector, onManageConnectorAccess, connectionHref, store, theme }) {
@@ -38575,6 +36984,15 @@ function FlowWorkspace({ hrefFor, navigation, onConfigureConnector, onManageConn
38575
36984
  const navigationIsland = /* @__PURE__ */ jsx(WorkspaceNavigationIsland, {
38576
36985
  ghost: view == "design" && !canvasReady,
38577
36986
  saveStatus: view == "design" && canvasReady ? saveStatus : void 0,
36987
+ settings: flow != null && /* @__PURE__ */ jsx(FlowSettingsButton, {
36988
+ flow,
36989
+ store,
36990
+ hrefForFlow: (target) => hrefFor({
36991
+ flowId: target.flowId,
36992
+ view: "design"
36993
+ }),
36994
+ onSelectFlow: (target) => void navigation.selectFlow(target)
36995
+ }, flow.flowId),
38578
36996
  flowName: flow?.name ?? flow?.flowId ?? "",
38579
36997
  flowsHref: hrefFor({ view: "design" }),
38580
36998
  onOpenFlows: () => void navigation.openFlows()