sanity 6.5.0-next.45 → 6.5.0-next.47

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.
@@ -5,7 +5,7 @@ import * as PathUtils from "@sanity/util/paths";
5
5
  import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$2, pathFor, fromString, get as get$1, trimChildPath as trimChildPath$1, trimLeft } from "@sanity/util/paths";
6
6
  import { forwardRef, useRef, useState, useId, useCallback, useMemo, useImperativeHandle, useEffect, isValidElement, Fragment, cloneElement, memo, useSyncExternalStore, Suspense, useContext, useReducer, startTransition, Component, use, useLayoutEffect, useEffectEvent, PureComponent, Children, lazy, useTransition, useInsertionEffect, useDeferredValue, version, StrictMode } from "react";
7
7
  import deepEquals from "react-fast-compare";
8
- import { LocaleContext, VisibleWorkspacesContext, ConfigErrorContext, WorkspacesContext, MediaLibraryIdsContext, PerspectiveContext, UserColorManagerContext, ResourceCacheContext, EventsContext, DocumentChangeContext, ReviewChangesContext, DiffContext, PresenceContext, FormBuilderContext, PortableTextMemberSchemaTypesContext, SelectedAnnotationsContext, ValidationContext, PortableTextMarkersContext, PortableTextMemberItemsContext, ChangeIndicatorTrackerContextGetSnapshot, ChangeIndicatorTrackerContextStore, FormCallbacksContext, ParseErrorsContext, ReferenceInputOptionsContext, WorkspaceContext, DocumentDivergencesContext, ActiveWorkspaceMatcherContext, DocumentIdContext, HoveredFieldContext, FieldActionsContext, FormValueContext, ReferenceItemRefContext, GetFormValueContext, EnhancedObjectDialogContext, DocumentFieldActionsContext, ArrayValidationContext, SortableItemIdContext, SourceContext, VirtualizerScrollInstanceContext, PortableTextMemberItemElementRefsContext, ScrollContext, FullscreenPTEContext, AssetLimitUpsellContext, DialogStackContext, ReleasesUpsellContext, SingleDocReleaseContext, SingleDocReleaseEnabledContext, SingleDocReleaseUpsellContext, PresenceTrackerContextStore, PresenceTrackerContextGetSnapshot, FormFieldPresenceContext, SearchContext, CalendarContext, AppIdCacheContext, CommentsIntentContext, CommentInputContext, CommentsContext, CommentsEnabledContext, CommentsSelectedPathContext, ScheduledPublishingEnabledContext, DocumentActionPropsContext, SchedulePublishUpsellContext, TasksEnabledContext, IsLastPaneContext, MentionUserContext, TasksNavigationContext, TasksContext, TasksUpsellContext, LoggedOutReasonContext, StudioErrorHandlerContext, RouterHistoryContext, AddonDatasetContext, ColorSchemeSetValueContext, ColorSchemeValueContext, DocumentLimitUpsellContext, NavbarContext, FreeTrialContext, FeedbackContext, LiveUserApplicationContext, PackageVersionInfoContext, StudioAnnouncementContext, CopyPasteContext, UserApplicationCacheContext, PreviewCardContext, ZIndexContext, zIndexContextDefaults, CommentsAuthoringPathContext } from "sanity/_singletons";
8
+ import { LocaleContext, VisibleWorkspacesContext, ConfigErrorContext, WorkspacesContext, MediaLibraryIdsContext, PerspectiveContext, UserColorManagerContext, ResourceCacheContext, EventsContext, DocumentChangeContext, ReviewChangesContext, DiffContext, PresenceContext, FormBuilderContext, PortableTextMemberSchemaTypesContext, SelectedAnnotationsContext, ValidationContext, PortableTextMarkersContext, PortableTextMemberItemsContext, ChangeIndicatorTrackerContextGetSnapshot, ChangeIndicatorTrackerContextStore, FormCallbacksContext, ParseErrorsContext, ReferenceInputOptionsContext, WorkspaceContext, DocumentDivergencesContext, ActiveWorkspaceMatcherContext, DocumentIdContext, HoveredFieldContext, FieldActionsContext, FormValueContext, ArrayItemRootElementContext, ReferenceItemRefContext, GetFormValueContext, EnhancedObjectDialogContext, DocumentFieldActionsContext, ArrayValidationContext, SortableItemIdContext, SourceContext, VirtualizerScrollInstanceContext, PortableTextMemberItemElementRefsContext, ScrollContext, FullscreenPTEContext, AssetLimitUpsellContext, DialogStackContext, ReleasesUpsellContext, SingleDocReleaseContext, SingleDocReleaseEnabledContext, SingleDocReleaseUpsellContext, PresenceTrackerContextStore, PresenceTrackerContextGetSnapshot, FormFieldPresenceContext, SearchContext, CalendarContext, AppIdCacheContext, CommentsIntentContext, CommentInputContext, CommentsContext, CommentsEnabledContext, CommentsSelectedPathContext, ScheduledPublishingEnabledContext, DocumentActionPropsContext, SchedulePublishUpsellContext, TasksEnabledContext, IsLastPaneContext, MentionUserContext, TasksNavigationContext, TasksContext, TasksUpsellContext, LoggedOutReasonContext, StudioErrorHandlerContext, RouterHistoryContext, AddonDatasetContext, ColorSchemeSetValueContext, ColorSchemeValueContext, DocumentLimitUpsellContext, NavbarContext, FreeTrialContext, FeedbackContext, LiveUserApplicationContext, PackageVersionInfoContext, StudioAnnouncementContext, CopyPasteContext, UserApplicationCacheContext, PreviewCardContext, ZIndexContext, zIndexContextDefaults, CommentsAuthoringPathContext } from "sanity/_singletons";
9
9
  import { useVirtualizer, defaultRangeExtractor, elementScroll } from "@tanstack/react-virtual";
10
10
  import throttle from "lodash-es/throttle.js";
11
11
  import { styled, css, useTheme as useTheme$1, keyframes, createGlobalStyle } from "styled-components";
@@ -20927,6 +20927,9 @@ class PatchEvent {
20927
20927
  return PatchEvent.from(this.patches.map((patch2) => prefixPath(patch2, segment)));
20928
20928
  }
20929
20929
  }
20930
+ function useArrayItemRootElementRef() {
20931
+ return useContext(ArrayItemRootElementContext);
20932
+ }
20930
20933
  const NARROW_LAYOUT = css`
20931
20934
  grid-template-columns: minmax(0px, 1fr);
20932
20935
  `, WIDE_LAYOUT = css`
@@ -22205,7 +22208,7 @@ function nonNullable$1(v) {
22205
22208
  return v !== null;
22206
22209
  }
22207
22210
  function ReferenceInput(props2) {
22208
- const $ = c(106), {
22211
+ const $ = c(107), {
22209
22212
  createOptions,
22210
22213
  onChange,
22211
22214
  onEditReference,
@@ -22332,45 +22335,45 @@ function ReferenceInput(props2) {
22332
22335
  menuRef,
22333
22336
  menuButtonRef,
22334
22337
  containerRef
22335
- } = useReferenceItemRef(), clickOutsideBoundaryRef = useRef(null), autoCompletePortalRef = useRef(null), createButtonMenuPortalRef = useRef(null);
22338
+ } = useReferenceItemRef(), arrayItemRootElementRef = useArrayItemRootElementRef(), clickOutsideBoundaryRef = useRef(null), autoCompletePortalRef = useRef(null), createButtonMenuPortalRef = useRef(null);
22336
22339
  let t15;
22337
22340
  $[51] !== handleClear || $[52] !== isEditing || $[53] !== menuButtonRef || $[54] !== value?._ref ? (t15 = !value?._ref && (() => {
22338
22341
  (isEditing || document.activeElement === menuButtonRef.current) && handleClear();
22339
22342
  }), $[51] = handleClear, $[52] = isEditing, $[53] = menuButtonRef, $[54] = value?._ref, $[55] = t15) : t15 = $[55];
22340
22343
  let t16;
22341
- $[56] !== containerRef || $[57] !== menuButtonRef || $[58] !== menuRef ? (t16 = () => [menuRef.current, menuButtonRef.current, containerRef.current, clickOutsideBoundaryRef.current, autoCompletePortalRef.current, createButtonMenuPortalRef.current], $[56] = containerRef, $[57] = menuButtonRef, $[58] = menuRef, $[59] = t16) : t16 = $[59], useClickOutsideEvent(t15, t16);
22344
+ $[56] !== arrayItemRootElementRef || $[57] !== containerRef || $[58] !== menuButtonRef || $[59] !== menuRef ? (t16 = () => [menuRef.current, menuButtonRef.current, containerRef.current, clickOutsideBoundaryRef.current, autoCompletePortalRef.current, createButtonMenuPortalRef.current, arrayItemRootElementRef?.current ?? null], $[56] = arrayItemRootElementRef, $[57] = containerRef, $[58] = menuButtonRef, $[59] = menuRef, $[60] = t16) : t16 = $[60], useClickOutsideEvent(t15, t16);
22342
22345
  const t17 = props2.elementProps.style;
22343
22346
  let t18;
22344
- $[60] !== handleClear || $[61] !== isWeakRefToNonexistent || $[62] !== t || $[63] !== value ? (t18 = isWeakRefToNonexistent ? /* @__PURE__ */ jsx(Alert, { "data-testid": "alert-nonexistent-document", title: t("inputs.reference.error.nonexistent-document-title"), suffix: /* @__PURE__ */ jsx(Stack, { padding: 2, children: /* @__PURE__ */ jsx(Button$1, { text: t("inputs.reference.error.nonexistent-document.clear-button-label"), onClick: handleClear }) }), children: /* @__PURE__ */ jsx(Text$1, { size: 1, children: /* @__PURE__ */ jsx(Translate, { i18nKey: "inputs.reference.error.nonexistent-document-description", t, values: {
22347
+ $[61] !== handleClear || $[62] !== isWeakRefToNonexistent || $[63] !== t || $[64] !== value ? (t18 = isWeakRefToNonexistent ? /* @__PURE__ */ jsx(Alert, { "data-testid": "alert-nonexistent-document", title: t("inputs.reference.error.nonexistent-document-title"), suffix: /* @__PURE__ */ jsx(Stack, { padding: 2, children: /* @__PURE__ */ jsx(Button$1, { text: t("inputs.reference.error.nonexistent-document.clear-button-label"), onClick: handleClear }) }), children: /* @__PURE__ */ jsx(Text$1, { size: 1, children: /* @__PURE__ */ jsx(Translate, { i18nKey: "inputs.reference.error.nonexistent-document-description", t, values: {
22345
22348
  documentId: value._ref
22346
- } }) }) }) : null, $[60] = handleClear, $[61] = isWeakRefToNonexistent, $[62] = t, $[63] = value, $[64] = t18) : t18 = $[64];
22349
+ } }) }) }) : null, $[61] = handleClear, $[62] = isWeakRefToNonexistent, $[63] = t, $[64] = value, $[65] = t18) : t18 = $[65];
22347
22350
  const t19 = searchState.isLoading;
22348
22351
  let t20;
22349
- $[65] !== t ? (t20 = t("inputs.reference.search-placeholder"), $[65] = t, $[66] = t20) : t20 = $[66];
22352
+ $[66] !== t ? (t20 = t("inputs.reference.search-placeholder"), $[66] = t, $[67] = t20) : t20 = $[67];
22350
22353
  const t21 = loadableReferenceInfo.isLoading || readOnly, t22 = renderOption;
22351
22354
  let t23;
22352
- $[67] !== handleAutocompleteOpenButtonClick ? (t23 = {
22355
+ $[68] !== handleAutocompleteOpenButtonClick ? (t23 = {
22353
22356
  onClick: handleAutocompleteOpenButtonClick
22354
- }, $[67] = handleAutocompleteOpenButtonClick, $[68] = t23) : t23 = $[68];
22357
+ }, $[68] = handleAutocompleteOpenButtonClick, $[69] = t23) : t23 = $[69];
22355
22358
  const t24 = value?._ref;
22356
22359
  let t25;
22357
- $[69] !== autocompletePopoverReferenceElement || $[70] !== elementProps || $[71] !== handleAutocompleteKeyDown || $[72] !== handleBlur || $[73] !== handleChange || $[74] !== handleFocus || $[75] !== handleQueryChange || $[76] !== hits_0 || $[77] !== path || $[78] !== renderValue || $[79] !== searchState.isLoading || $[80] !== searchState.searchString || $[81] !== t20 || $[82] !== t21 || $[83] !== t22 || $[84] !== t23 || $[85] !== t24 || $[86] !== validationError ? (t25 = /* @__PURE__ */ jsx(ReferenceAutocomplete$3, { ...elementProps, path, onFocus: handleFocus, onBlur: handleBlur, "data-testid": "autocomplete", loading: t19, referenceElement: autocompletePopoverReferenceElement, options: hits_0, radius: 2, placeholder: t20, onKeyDown: handleAutocompleteKeyDown, readOnly: t21, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$3, renderOption: t22, renderValue, openButton: t23, portalRef: autoCompletePortalRef, customValidity: validationError, value: t24 }), $[69] = autocompletePopoverReferenceElement, $[70] = elementProps, $[71] = handleAutocompleteKeyDown, $[72] = handleBlur, $[73] = handleChange, $[74] = handleFocus, $[75] = handleQueryChange, $[76] = hits_0, $[77] = path, $[78] = renderValue, $[79] = searchState.isLoading, $[80] = searchState.searchString, $[81] = t20, $[82] = t21, $[83] = t22, $[84] = t23, $[85] = t24, $[86] = validationError, $[87] = t25) : t25 = $[87];
22360
+ $[70] !== autocompletePopoverReferenceElement || $[71] !== elementProps || $[72] !== handleAutocompleteKeyDown || $[73] !== handleBlur || $[74] !== handleChange || $[75] !== handleFocus || $[76] !== handleQueryChange || $[77] !== hits_0 || $[78] !== path || $[79] !== renderValue || $[80] !== searchState.isLoading || $[81] !== searchState.searchString || $[82] !== t20 || $[83] !== t21 || $[84] !== t22 || $[85] !== t23 || $[86] !== t24 || $[87] !== validationError ? (t25 = /* @__PURE__ */ jsx(ReferenceAutocomplete$3, { ...elementProps, path, onFocus: handleFocus, onBlur: handleBlur, "data-testid": "autocomplete", loading: t19, referenceElement: autocompletePopoverReferenceElement, options: hits_0, radius: 2, placeholder: t20, onKeyDown: handleAutocompleteKeyDown, readOnly: t21, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$3, renderOption: t22, renderValue, openButton: t23, portalRef: autoCompletePortalRef, customValidity: validationError, value: t24 }), $[70] = autocompletePopoverReferenceElement, $[71] = elementProps, $[72] = handleAutocompleteKeyDown, $[73] = handleBlur, $[74] = handleChange, $[75] = handleFocus, $[76] = handleQueryChange, $[77] = hits_0, $[78] = path, $[79] = renderValue, $[80] = searchState.isLoading, $[81] = searchState.searchString, $[82] = t20, $[83] = t21, $[84] = t22, $[85] = t23, $[86] = t24, $[87] = validationError, $[88] = t25) : t25 = $[88];
22358
22361
  let t26;
22359
- $[88] !== createOptions || $[89] !== handleCreateButtonKeyDown || $[90] !== handleCreateNew || $[91] !== id2 || $[92] !== readOnly ? (t26 = createOptions.length > 0 && /* @__PURE__ */ jsx(CreateButton, { id: `${id2}-selectTypeMenuButton`, readOnly, createOptions, onCreate: handleCreateNew, onKeyDown: handleCreateButtonKeyDown, menuRef: createButtonMenuPortalRef }), $[88] = createOptions, $[89] = handleCreateButtonKeyDown, $[90] = handleCreateNew, $[91] = id2, $[92] = readOnly, $[93] = t26) : t26 = $[93];
22362
+ $[89] !== createOptions || $[90] !== handleCreateButtonKeyDown || $[91] !== handleCreateNew || $[92] !== id2 || $[93] !== readOnly ? (t26 = createOptions.length > 0 && /* @__PURE__ */ jsx(CreateButton, { id: `${id2}-selectTypeMenuButton`, readOnly, createOptions, onCreate: handleCreateNew, onKeyDown: handleCreateButtonKeyDown, menuRef: createButtonMenuPortalRef }), $[89] = createOptions, $[90] = handleCreateButtonKeyDown, $[91] = handleCreateNew, $[92] = id2, $[93] = readOnly, $[94] = t26) : t26 = $[94];
22360
22363
  let t27;
22361
- $[94] !== t25 || $[95] !== t26 ? (t27 = /* @__PURE__ */ jsxs(AutocompleteContainer, { ref: setAutocompletePopoverReferenceElement, children: [
22364
+ $[95] !== t25 || $[96] !== t26 ? (t27 = /* @__PURE__ */ jsxs(AutocompleteContainer, { ref: setAutocompletePopoverReferenceElement, children: [
22362
22365
  t25,
22363
22366
  t26
22364
- ] }), $[94] = t25, $[95] = t26, $[96] = t27) : t27 = $[96];
22367
+ ] }), $[95] = t25, $[96] = t26, $[97] = t27) : t27 = $[97];
22365
22368
  let t28;
22366
- $[97] !== t18 || $[98] !== t27 ? (t28 = /* @__PURE__ */ jsx(Stack, { space: 1, "data-testid": "reference-input", ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
22369
+ $[98] !== t18 || $[99] !== t27 ? (t28 = /* @__PURE__ */ jsx(Stack, { space: 1, "data-testid": "reference-input", ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsxs(Stack, { space: 2, children: [
22367
22370
  t18,
22368
22371
  t27
22369
- ] }) }), $[97] = t18, $[98] = t27, $[99] = t28) : t28 = $[99];
22372
+ ] }) }), $[98] = t18, $[99] = t27, $[100] = t28) : t28 = $[100];
22370
22373
  let t29;
22371
- $[100] !== props2 || $[101] !== t28 ? (t29 = /* @__PURE__ */ jsx(ReferenceInputPreview, { ...props2, children: t28 }), $[100] = props2, $[101] = t28, $[102] = t29) : t29 = $[102];
22374
+ $[101] !== props2 || $[102] !== t28 ? (t29 = /* @__PURE__ */ jsx(ReferenceInputPreview, { ...props2, children: t28 }), $[101] = props2, $[102] = t28, $[103] = t29) : t29 = $[103];
22372
22375
  let t30;
22373
- return $[103] !== props2.elementProps.style || $[104] !== t29 ? (t30 = /* @__PURE__ */ jsx("div", { style: t17, children: t29 }), $[103] = props2.elementProps.style, $[104] = t29, $[105] = t30) : t30 = $[105], t30;
22376
+ return $[104] !== props2.elementProps.style || $[105] !== t29 ? (t30 = /* @__PURE__ */ jsx("div", { style: t17, children: t29 }), $[104] = props2.elementProps.style, $[105] = t29, $[106] = t30) : t30 = $[106], t30;
22374
22377
  }
22375
22378
  function _temp3$I(hit_0) {
22376
22379
  return {
@@ -28171,17 +28174,23 @@ function List(props2) {
28171
28174
  return $[8] !== handleSortEnd || $[9] !== onItemMoveEnd || $[10] !== onItemMoveStart || $[11] !== rest || $[12] !== sortable ? (t1 = sortable ? /* @__PURE__ */ jsx(SortableList, { onItemMove: handleSortEnd, onItemMoveStart, onItemMoveEnd, ...rest }) : /* @__PURE__ */ jsx(Grid, { ...rest }), $[8] = handleSortEnd, $[9] = onItemMoveEnd, $[10] = onItemMoveStart, $[11] = rest, $[12] = sortable, $[13] = t1) : t1 = $[13], t1;
28172
28175
  }
28173
28176
  const Item = forwardRef(function(props2, ref) {
28174
- const $ = c(12);
28177
+ const $ = c(14);
28175
28178
  let disableTransition, rest, sortable;
28176
28179
  $[0] !== props2 ? ({
28177
28180
  sortable,
28178
28181
  disableTransition,
28179
28182
  ...rest
28180
28183
  } = props2, $[0] = props2, $[1] = disableTransition, $[2] = rest, $[3] = sortable) : (disableTransition = $[1], rest = $[2], sortable = $[3]);
28184
+ const rootElementRef = useRef(null);
28181
28185
  let t0;
28182
- $[4] !== disableTransition || $[5] !== ref || $[6] !== rest || $[7] !== sortable ? (t0 = sortable ? /* @__PURE__ */ jsx(SortableListItem, { ref, disableTransition, ...rest }) : /* @__PURE__ */ jsx(ListItem$2, { ref, ...rest }), $[4] = disableTransition, $[5] = ref, $[6] = rest, $[7] = sortable, $[8] = t0) : t0 = $[8];
28186
+ $[4] !== ref ? (t0 = (node) => {
28187
+ rootElementRef.current = node, typeof ref == "function" ? ref(node) : ref && (ref.current = node);
28188
+ }, $[4] = ref, $[5] = t0) : t0 = $[5];
28189
+ const setRootRef = t0;
28183
28190
  let t1;
28184
- return $[9] !== props2.id || $[10] !== t0 ? (t1 = /* @__PURE__ */ jsx(SortableItemIdContext.Provider, { value: props2.id, children: t0 }), $[9] = props2.id, $[10] = t0, $[11] = t1) : t1 = $[11], t1;
28191
+ $[6] !== disableTransition || $[7] !== rest || $[8] !== setRootRef || $[9] !== sortable ? (t1 = /* @__PURE__ */ jsx(ArrayItemRootElementContext.Provider, { value: rootElementRef, children: sortable ? /* @__PURE__ */ jsx(SortableListItem, { ref: setRootRef, disableTransition, ...rest }) : /* @__PURE__ */ jsx(ListItem$2, { ref: setRootRef, ...rest }) }), $[6] = disableTransition, $[7] = rest, $[8] = setRootRef, $[9] = sortable, $[10] = t1) : t1 = $[10];
28192
+ let t2;
28193
+ return $[11] !== props2.id || $[12] !== t1 ? (t2 = /* @__PURE__ */ jsx(SortableItemIdContext.Provider, { value: props2.id, children: t1 }), $[11] = props2.id, $[12] = t1, $[13] = t2) : t2 = $[13], t2;
28185
28194
  });
28186
28195
  function popoverReducer(state, event) {
28187
28196
  return event.type === "toggle" ? {
@@ -37312,7 +37321,7 @@ const StyledPopover$5 = /* @__PURE__ */ styled(Popover).withConfig({
37312
37321
  isLoading: !1
37313
37322
  }, NO_FILTER$2 = () => !0, REF_PATH$1 = ["_ref"];
37314
37323
  function CrossDatasetReferenceInput(props2) {
37315
- const $ = c(96), {
37324
+ const $ = c(97), {
37316
37325
  changed,
37317
37326
  focused,
37318
37327
  focusPath,
@@ -37441,15 +37450,15 @@ function CrossDatasetReferenceInput(props2) {
37441
37450
  const studioUrl = t18;
37442
37451
  let t19;
37443
37452
  $[48] !== getReferenceInfoMemo || $[49] !== schemaType ? (t19 = (option) => /* @__PURE__ */ jsx(ReferenceInputPreviewCard, { forwardedAs: "button", type: "button", radius: 2, tone: "inherit", children: /* @__PURE__ */ jsx(OptionPreview$1, { referenceType: schemaType, document: option.hit.published, getReferenceInfo: getReferenceInfoMemo }) }), $[48] = getReferenceInfoMemo, $[49] = schemaType, $[50] = t19) : t19 = $[50];
37444
- const renderOption = t19, isEditing = hasFocusAtRef || !value?._ref, clickOutsideBoundaryRef = useRef(null), autocompletePortalRef = useRef(null);
37453
+ const renderOption = t19, isEditing = hasFocusAtRef || !value?._ref, arrayItemRootElementRef = useArrayItemRootElementRef(), clickOutsideBoundaryRef = useRef(null), autocompletePortalRef = useRef(null);
37445
37454
  let t20;
37446
37455
  $[51] !== hasFocusAtRef || $[52] !== onPathFocus ? (t20 = hasFocusAtRef && (() => onPathFocus([])), $[51] = hasFocusAtRef, $[52] = onPathFocus, $[53] = t20) : t20 = $[53];
37447
37456
  let t21;
37448
- $[54] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t21 = () => [clickOutsideBoundaryRef.current, autocompletePortalRef.current], $[54] = t21) : t21 = $[54], useClickOutsideEvent(t20, t21);
37457
+ $[54] !== arrayItemRootElementRef ? (t21 = () => [clickOutsideBoundaryRef.current, autocompletePortalRef.current, arrayItemRootElementRef?.current ?? null], $[54] = arrayItemRootElementRef, $[55] = t21) : t21 = $[55], useClickOutsideEvent(t20, t21);
37449
37458
  let t22;
37450
- $[55] !== featureInfo.enabled || $[56] !== featureInfo.isLoading || $[57] !== handleClear || $[58] !== value ? (t22 = !featureInfo.isLoading && !featureInfo.enabled && /* @__PURE__ */ jsx(DisabledFeatureWarning, { value, onClearValue: handleClear }), $[55] = featureInfo.enabled, $[56] = featureInfo.isLoading, $[57] = handleClear, $[58] = value, $[59] = t22) : t22 = $[59];
37459
+ $[56] !== featureInfo.enabled || $[57] !== featureInfo.isLoading || $[58] !== handleClear || $[59] !== value ? (t22 = !featureInfo.isLoading && !featureInfo.enabled && /* @__PURE__ */ jsx(DisabledFeatureWarning, { value, onClearValue: handleClear }), $[56] = featureInfo.enabled, $[57] = featureInfo.isLoading, $[58] = handleClear, $[59] = value, $[60] = t22) : t22 = $[60];
37451
37460
  let t23;
37452
- $[60] !== actualStrength || $[61] !== autocompletePopoverReferenceElement || $[62] !== changed || $[63] !== elementProps || $[64] !== errors || $[65] !== featureInfo.enabled || $[66] !== featureInfo.isLoading || $[67] !== focused || $[68] !== handleAutocompleteFocus || $[69] !== handleAutocompleteKeyDown || $[70] !== handleAutocompleteOpenButtonClick || $[71] !== handleChange || $[72] !== handleClear || $[73] !== handleFixStrengthMismatch || $[74] !== handleFocus || $[75] !== handleQueryChange || $[76] !== handleReplace || $[77] !== inputId || $[78] !== isEditing || $[79] !== loadableReferenceInfo || $[80] !== path || $[81] !== readOnly || $[82] !== renderOption || $[83] !== schemaType || $[84] !== searchState.hits || $[85] !== searchState.isLoading || $[86] !== searchState.searchString || $[87] !== showWeakRefMismatch || $[88] !== studioUrl || $[89] !== t || $[90] !== value ? (t23 = (featureInfo.isLoading || featureInfo.enabled) && /* @__PURE__ */ jsx(Stack, { space: 1, children: isEditing ? /* @__PURE__ */ jsx(Stack, { space: 2, ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsx("div", { ref: setAutocompletePopoverReferenceElement, children: /* @__PURE__ */ jsx(ReferenceAutocomplete$2, { ...elementProps, "data-testid": "autocomplete", loading: searchState.isLoading, referenceElement: autocompletePopoverReferenceElement, portalRef: autocompletePortalRef, id: inputId || "", options: searchState.hits.map(_temp3$u), onFocus: handleAutocompleteFocus, radius: 2, placeholder: t("inputs.reference.search-placeholder"), onKeyDown: handleAutocompleteKeyDown, readOnly, disabled: loadableReferenceInfo.isLoading, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$2, renderOption, openButton: {
37461
+ $[61] !== actualStrength || $[62] !== autocompletePopoverReferenceElement || $[63] !== changed || $[64] !== elementProps || $[65] !== errors || $[66] !== featureInfo.enabled || $[67] !== featureInfo.isLoading || $[68] !== focused || $[69] !== handleAutocompleteFocus || $[70] !== handleAutocompleteKeyDown || $[71] !== handleAutocompleteOpenButtonClick || $[72] !== handleChange || $[73] !== handleClear || $[74] !== handleFixStrengthMismatch || $[75] !== handleFocus || $[76] !== handleQueryChange || $[77] !== handleReplace || $[78] !== inputId || $[79] !== isEditing || $[80] !== loadableReferenceInfo || $[81] !== path || $[82] !== readOnly || $[83] !== renderOption || $[84] !== schemaType || $[85] !== searchState.hits || $[86] !== searchState.isLoading || $[87] !== searchState.searchString || $[88] !== showWeakRefMismatch || $[89] !== studioUrl || $[90] !== t || $[91] !== value ? (t23 = (featureInfo.isLoading || featureInfo.enabled) && /* @__PURE__ */ jsx(Stack, { space: 1, children: isEditing ? /* @__PURE__ */ jsx(Stack, { space: 2, ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsx("div", { ref: setAutocompletePopoverReferenceElement, children: /* @__PURE__ */ jsx(ReferenceAutocomplete$2, { ...elementProps, "data-testid": "autocomplete", loading: searchState.isLoading, referenceElement: autocompletePopoverReferenceElement, portalRef: autocompletePortalRef, id: inputId || "", options: searchState.hits.map(_temp3$u), onFocus: handleAutocompleteFocus, radius: 2, placeholder: t("inputs.reference.search-placeholder"), onKeyDown: handleAutocompleteKeyDown, readOnly, disabled: loadableReferenceInfo.isLoading, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$2, renderOption, openButton: {
37453
37462
  onClick: handleAutocompleteOpenButtonClick
37454
37463
  }, ref: focusElementRef }) }) }) }) : /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsxs(Card, { padding: 0, border: !0, flex: 1, radius: 2, tone: readOnly ? "transparent" : loadableReferenceInfo.error || errors.length > 0 ? "critical" : "default", children: [
37455
37464
  /* @__PURE__ */ jsxs(Flex, { align: "center", padding: 1, children: [
@@ -37465,12 +37474,12 @@ function CrossDatasetReferenceInput(props2) {
37465
37474
  ] }),
37466
37475
  showWeakRefMismatch && /* @__PURE__ */ jsx(ReferenceStrengthMismatchAlertStrip, { actualStrength, handleFixStrengthMismatch }),
37467
37476
  loadableReferenceInfo.error && /* @__PURE__ */ jsx(ReferenceMetadataLoadErrorAlertStrip, { errorMessage: loadableReferenceInfo.error.message, onHandleRetry: loadableReferenceInfo.retry })
37468
- ] }) }) }), $[60] = actualStrength, $[61] = autocompletePopoverReferenceElement, $[62] = changed, $[63] = elementProps, $[64] = errors, $[65] = featureInfo.enabled, $[66] = featureInfo.isLoading, $[67] = focused, $[68] = handleAutocompleteFocus, $[69] = handleAutocompleteKeyDown, $[70] = handleAutocompleteOpenButtonClick, $[71] = handleChange, $[72] = handleClear, $[73] = handleFixStrengthMismatch, $[74] = handleFocus, $[75] = handleQueryChange, $[76] = handleReplace, $[77] = inputId, $[78] = isEditing, $[79] = loadableReferenceInfo, $[80] = path, $[81] = readOnly, $[82] = renderOption, $[83] = schemaType, $[84] = searchState.hits, $[85] = searchState.isLoading, $[86] = searchState.searchString, $[87] = showWeakRefMismatch, $[88] = studioUrl, $[89] = t, $[90] = value, $[91] = t23) : t23 = $[91];
37477
+ ] }) }) }), $[61] = actualStrength, $[62] = autocompletePopoverReferenceElement, $[63] = changed, $[64] = elementProps, $[65] = errors, $[66] = featureInfo.enabled, $[67] = featureInfo.isLoading, $[68] = focused, $[69] = handleAutocompleteFocus, $[70] = handleAutocompleteKeyDown, $[71] = handleAutocompleteOpenButtonClick, $[72] = handleChange, $[73] = handleClear, $[74] = handleFixStrengthMismatch, $[75] = handleFocus, $[76] = handleQueryChange, $[77] = handleReplace, $[78] = inputId, $[79] = isEditing, $[80] = loadableReferenceInfo, $[81] = path, $[82] = readOnly, $[83] = renderOption, $[84] = schemaType, $[85] = searchState.hits, $[86] = searchState.isLoading, $[87] = searchState.searchString, $[88] = showWeakRefMismatch, $[89] = studioUrl, $[90] = t, $[91] = value, $[92] = t23) : t23 = $[92];
37469
37478
  let t24;
37470
- return $[92] !== props2.elementProps.style || $[93] !== t22 || $[94] !== t23 ? (t24 = /* @__PURE__ */ jsxs("div", { style: props2.elementProps.style, children: [
37479
+ return $[93] !== props2.elementProps.style || $[94] !== t22 || $[95] !== t23 ? (t24 = /* @__PURE__ */ jsxs("div", { style: props2.elementProps.style, children: [
37471
37480
  t22,
37472
37481
  t23
37473
- ] }), $[92] = props2.elementProps.style, $[93] = t22, $[94] = t23, $[95] = t24) : t24 = $[95], t24;
37482
+ ] }), $[93] = props2.elementProps.style, $[94] = t22, $[95] = t23, $[96] = t24) : t24 = $[96], t24;
37474
37483
  }
37475
37484
  function _temp3$u(hit_0) {
37476
37485
  return {
@@ -37919,7 +37928,7 @@ const StyledPopover$4 = /* @__PURE__ */ styled(Popover).withConfig({
37919
37928
  isLoading: !1
37920
37929
  }, NO_FILTER$1 = () => !0, REF_PATH = ["_ref"];
37921
37930
  function GlobalDocumentReferenceInput(props2) {
37922
- const $ = c(86), {
37931
+ const $ = c(87), {
37923
37932
  changed,
37924
37933
  focused,
37925
37934
  focusPath,
@@ -38077,13 +38086,13 @@ function GlobalDocumentReferenceInput(props2) {
38077
38086
  const studioUrl = t17;
38078
38087
  let t18;
38079
38088
  $[49] !== getReferenceInfoMemo || $[50] !== schemaType ? (t18 = (option) => /* @__PURE__ */ jsx(PreviewCard, { as: "button", type: "button", radius: 2, children: /* @__PURE__ */ jsx(Box, { paddingX: 3, paddingY: 1, children: /* @__PURE__ */ jsx(OptionPreview, { referenceType: schemaType, document: option.hit.published, getReferenceInfo: getReferenceInfoMemo }) }) }), $[49] = getReferenceInfoMemo, $[50] = schemaType, $[51] = t18) : t18 = $[51];
38080
- const renderOption = t18, isEditing = hasFocusAtRef || !value?._ref, clickOutsideBoundaryRef = useRef(null), autocompletePortalRef = useRef(null);
38089
+ const renderOption = t18, isEditing = hasFocusAtRef || !value?._ref, arrayItemRootElementRef = useArrayItemRootElementRef(), clickOutsideBoundaryRef = useRef(null), autocompletePortalRef = useRef(null);
38081
38090
  let t19;
38082
38091
  $[52] !== hasFocusAtRef || $[53] !== onPathFocus ? (t19 = hasFocusAtRef && (() => onPathFocus([])), $[52] = hasFocusAtRef, $[53] = onPathFocus, $[54] = t19) : t19 = $[54];
38083
38092
  let t20;
38084
- $[55] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel") ? (t20 = () => [clickOutsideBoundaryRef.current, autocompletePortalRef.current], $[55] = t20) : t20 = $[55], useClickOutsideEvent(t19, t20);
38093
+ $[55] !== arrayItemRootElementRef ? (t20 = () => [clickOutsideBoundaryRef.current, autocompletePortalRef.current, arrayItemRootElementRef?.current ?? null], $[55] = arrayItemRootElementRef, $[56] = t20) : t20 = $[56], useClickOutsideEvent(t19, t20);
38085
38094
  let t21;
38086
- return $[56] !== actualStrength || $[57] !== autocompletePopoverReferenceElement || $[58] !== changed || $[59] !== elementProps || $[60] !== errors || $[61] !== focused || $[62] !== handleAutocompleteFocus || $[63] !== handleAutocompleteKeyDown || $[64] !== handleAutocompleteOpenButtonClick || $[65] !== handleChange || $[66] !== handleClear || $[67] !== handleFixStrengthMismatch || $[68] !== handleFocus || $[69] !== handleQueryChange || $[70] !== handleReplace || $[71] !== inputId || $[72] !== isEditing || $[73] !== loadableReferenceInfo || $[74] !== path || $[75] !== readOnly || $[76] !== renderOption || $[77] !== schemaType || $[78] !== searchState.hits || $[79] !== searchState.isLoading || $[80] !== searchState.searchString || $[81] !== showWeakRefMismatch || $[82] !== studioUrl || $[83] !== t || $[84] !== value ? (t21 = /* @__PURE__ */ jsx(Stack, { space: 1, children: isEditing ? /* @__PURE__ */ jsx(Stack, { space: 2, ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsx("div", { ref: setAutocompletePopoverReferenceElement, children: /* @__PURE__ */ jsx(ReferenceAutocomplete$1, { ...elementProps, "data-testid": "autocomplete", loading: searchState.isLoading, referenceElement: autocompletePopoverReferenceElement, portalRef: autocompletePortalRef, id: inputId || "", options: searchState.hits.map(_temp3$t), onFocus: handleAutocompleteFocus, radius: 2, placeholder: t("inputs.reference.search-placeholder"), onKeyDown: handleAutocompleteKeyDown, readOnly, disabled: loadableReferenceInfo.isLoading, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$1, renderOption, openButton: {
38095
+ return $[57] !== actualStrength || $[58] !== autocompletePopoverReferenceElement || $[59] !== changed || $[60] !== elementProps || $[61] !== errors || $[62] !== focused || $[63] !== handleAutocompleteFocus || $[64] !== handleAutocompleteKeyDown || $[65] !== handleAutocompleteOpenButtonClick || $[66] !== handleChange || $[67] !== handleClear || $[68] !== handleFixStrengthMismatch || $[69] !== handleFocus || $[70] !== handleQueryChange || $[71] !== handleReplace || $[72] !== inputId || $[73] !== isEditing || $[74] !== loadableReferenceInfo || $[75] !== path || $[76] !== readOnly || $[77] !== renderOption || $[78] !== schemaType || $[79] !== searchState.hits || $[80] !== searchState.isLoading || $[81] !== searchState.searchString || $[82] !== showWeakRefMismatch || $[83] !== studioUrl || $[84] !== t || $[85] !== value ? (t21 = /* @__PURE__ */ jsx(Stack, { space: 1, children: isEditing ? /* @__PURE__ */ jsx(Stack, { space: 2, ref: clickOutsideBoundaryRef, children: /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsx("div", { ref: setAutocompletePopoverReferenceElement, children: /* @__PURE__ */ jsx(ReferenceAutocomplete$1, { ...elementProps, "data-testid": "autocomplete", loading: searchState.isLoading, referenceElement: autocompletePopoverReferenceElement, portalRef: autocompletePortalRef, id: inputId || "", options: searchState.hits.map(_temp3$t), onFocus: handleAutocompleteFocus, radius: 2, placeholder: t("inputs.reference.search-placeholder"), onKeyDown: handleAutocompleteKeyDown, readOnly, disabled: loadableReferenceInfo.isLoading, onQueryChange: handleQueryChange, searchString: searchState.searchString, onChange: handleChange, filterOption: NO_FILTER$1, renderOption, openButton: {
38087
38096
  onClick: handleAutocompleteOpenButtonClick
38088
38097
  }, ref: focusElementRef }) }) }) }) : /* @__PURE__ */ jsx(ChangeIndicator, { path, isChanged: changed, hasFocus: !!focused, children: /* @__PURE__ */ jsxs(Card, { padding: 0, border: !0, flex: 1, radius: 1, tone: readOnly ? "transparent" : loadableReferenceInfo.error || errors.length > 0 ? "critical" : "default", children: [
38089
38098
  /* @__PURE__ */ jsxs(Flex, { align: "center", padding: 1, children: [
@@ -38099,7 +38108,7 @@ function GlobalDocumentReferenceInput(props2) {
38099
38108
  ] }),
38100
38109
  showWeakRefMismatch && /* @__PURE__ */ jsx(ReferenceStrengthMismatchAlertStrip, { actualStrength, handleFixStrengthMismatch }),
38101
38110
  loadableReferenceInfo.error && /* @__PURE__ */ jsx(ReferenceMetadataLoadErrorAlertStrip, { errorMessage: loadableReferenceInfo.error.message, onHandleRetry: loadableReferenceInfo.retry })
38102
- ] }) }) }), $[56] = actualStrength, $[57] = autocompletePopoverReferenceElement, $[58] = changed, $[59] = elementProps, $[60] = errors, $[61] = focused, $[62] = handleAutocompleteFocus, $[63] = handleAutocompleteKeyDown, $[64] = handleAutocompleteOpenButtonClick, $[65] = handleChange, $[66] = handleClear, $[67] = handleFixStrengthMismatch, $[68] = handleFocus, $[69] = handleQueryChange, $[70] = handleReplace, $[71] = inputId, $[72] = isEditing, $[73] = loadableReferenceInfo, $[74] = path, $[75] = readOnly, $[76] = renderOption, $[77] = schemaType, $[78] = searchState.hits, $[79] = searchState.isLoading, $[80] = searchState.searchString, $[81] = showWeakRefMismatch, $[82] = studioUrl, $[83] = t, $[84] = value, $[85] = t21) : t21 = $[85], t21;
38111
+ ] }) }) }), $[57] = actualStrength, $[58] = autocompletePopoverReferenceElement, $[59] = changed, $[60] = elementProps, $[61] = errors, $[62] = focused, $[63] = handleAutocompleteFocus, $[64] = handleAutocompleteKeyDown, $[65] = handleAutocompleteOpenButtonClick, $[66] = handleChange, $[67] = handleClear, $[68] = handleFixStrengthMismatch, $[69] = handleFocus, $[70] = handleQueryChange, $[71] = handleReplace, $[72] = inputId, $[73] = isEditing, $[74] = loadableReferenceInfo, $[75] = path, $[76] = readOnly, $[77] = renderOption, $[78] = schemaType, $[79] = searchState.hits, $[80] = searchState.isLoading, $[81] = searchState.searchString, $[82] = showWeakRefMismatch, $[83] = studioUrl, $[84] = t, $[85] = value, $[86] = t21) : t21 = $[86], t21;
38103
38112
  }
38104
38113
  function _temp3$t(hit_0) {
38105
38114
  return {
@@ -49042,31 +49051,32 @@ function useDeleteScheduledDraft(firstDocumentPreview, onClose, deleteOperation,
49042
49051
  const {
49043
49052
  t
49044
49053
  } = useTranslation(), toast = useToast(), [isDeleting, setIsDeleting] = useState(!1), handleDeleteSchedule = useCallback(async () => {
49045
- setIsDeleting(!0), await (async () => {
49046
- await deleteOperation();
49047
- try {
49048
- onDeleteComplete?.();
49049
- } catch (error) {
49050
- console.error("onDeleteComplete callback failed:", error);
49051
- }
49052
- toast.push({
49054
+ setIsDeleting(!0);
49055
+ let didDelete = !1;
49056
+ await (async () => {
49057
+ await deleteOperation(), didDelete = !0, toast.push({
49053
49058
  closable: !0,
49054
49059
  status: "success",
49055
49060
  description: /* @__PURE__ */ jsx(Translate, { t, i18nKey: "release.toast.delete-schedule-draft.success", values: {
49056
49061
  title: firstDocumentPreview?.title || t("preview.default.title-fallback")
49057
49062
  } })
49058
49063
  });
49059
- })().catch((error_0) => {
49060
- console.error("Failed to delete scheduled draft:", error_0), toast.push({
49064
+ })().catch((error) => {
49065
+ console.error("Failed to delete scheduled draft:", error), toast.push({
49061
49066
  closable: !0,
49062
49067
  status: "error",
49063
49068
  description: /* @__PURE__ */ jsx(Translate, { t, i18nKey: "release.toast.delete-schedule-draft.error", values: {
49064
49069
  title: firstDocumentPreview?.title || t("preview.default.title-fallback"),
49065
- error: getErrorMessage$2(error_0)
49070
+ error: getErrorMessage$2(error)
49066
49071
  } })
49067
49072
  });
49068
49073
  }).finally(() => {
49069
- setIsDeleting(!1), onClose();
49074
+ if (setIsDeleting(!1), onClose(), didDelete)
49075
+ try {
49076
+ onDeleteComplete?.();
49077
+ } catch (error_0) {
49078
+ console.error("onDeleteComplete callback failed:", error_0);
49079
+ }
49070
49080
  });
49071
49081
  }, [toast, t, firstDocumentPreview?.title, onClose, deleteOperation, onDeleteComplete]);
49072
49082
  return {