UNPKG

sanity

Version:

Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches

765 lines (761 loc) • 4.33 MB
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime"; import { c } from "react/compiler-runtime"; import { Badge, Grid, Stack, Box, rem, Layer, Card, Spinner, Text as Text$1, usePrefersDark, Flex, Heading, Container as Container$4, Dialog, useTheme, Button as Button$2, Skeleton, useToast, Avatar, AvatarStack, Inline, Breadcrumbs, Code, useClickOutsideEvent, useLayer, Portal, LayerProvider, MenuDivider, Menu, useElementRect, useBoundaryElement, Autocomplete, useMediaIndex, useGlobalKeyDown, Checkbox as Checkbox$1, Switch as Switch$1, TextInput as TextInput$1, Select as Select$1, ElementQuery, TabList, rgba, MenuItem as MenuItem$1, BoundaryElementProvider, usePortal, PortalProvider, _responsive, useRootTheme, useArrayProp, TextArea, TextSkeleton, useElementSize, isHTMLElement, Radio, TabPanel, AvatarCounter, studioTheme, ThemeColorProvider, DialogProvider, focusLastDescendant, focusFirstDescendant, ThemeProvider, Label, ToastProvider, VirtualList } from "@sanity/ui"; import * as PathUtils from "@sanity/util/paths"; import { toString, FOCUS_TERMINATOR, startsWith, isEqual as isEqual$2, pathFor, fromString, get as get$1, trimChildPath as trimChildPath$1, trimLeft } from "@sanity/util/paths"; 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"; import deepEquals from "react-fast-compare"; 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, SingleDocReleaseEnabledContext, SingleDocReleaseContext, 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"; import { useVirtualizer, defaultRangeExtractor, elementScroll } from "@tanstack/react-virtual"; import throttle from "lodash-es/throttle.js"; import { styled, css, useTheme as useTheme$1, keyframes, createGlobalStyle } from "styled-components"; import { EllipsisHorizontalIcon } from "@sanity/icons/EllipsisHorizontal"; import { createMemoryHistory, createBrowserHistory } from "history"; import { ArrowLeftIcon } from "@sanity/icons/ArrowLeft"; import { LaunchIcon } from "@sanity/icons/Launch"; import { Button as Button$1, ErrorBoundary, Tooltip, Popover, MenuItem, MenuButton, TooltipDelayGroupProvider, Dialog as Dialog$1, Tab, generateHelpUrl } from "./index.js"; import { I18nextProvider, useTranslation as useTranslation$1, initReactI18next, I18nContext } from "react-i18next"; import { catchError, tap, switchMap, map, scan, distinctUntilChanged, skip, filter, startWith, shareReplay, mergeMap, share as share$1, mergeMapTo, takeUntil, take as take$1, publishReplay, refCount, withLatestFrom, concatMap as concatMap$1, groupBy as groupBy$1, throttleTime, last, mergeAll, toArray as toArray$1, distinct, first, debounceTime, timeout, auditTime, switchMapTo, delay, reduce as reduce$2, finalize as finalize$1, bufferWhen, expand, mapTo, debounce as debounce$2, retry as retry$1 } from "rxjs/operators"; import { useObservable, useObservableEvent } from "react-rx"; import { of, concat, defer, EMPTY as EMPTY$5, map as map$1, BehaviorSubject, using, fromEvent, merge, share, ReplaySubject, timer, defaultIfEmpty, catchError as catchError$1, switchMap as switchMap$1, take, concatMap, from, Observable, skip as skip$1, firstValueFrom, throwError, NEVER, Subject, tap as tap$1, finalize, combineLatest, asyncScheduler, bufferTime, mergeMap as mergeMap$1, filter as filter$1, lastValueFrom, partition as partition$1, distinctUntilChanged as distinctUntilChanged$1, asapScheduler, repeat, scan as scan$1, shareReplay as shareReplay$1, pipe, iif, startWith as startWith$1, concatWith, count, toArray as toArray$2, reduce as reduce$1, switchScan, delayWhen, first as first$1, zipWith, takeWhile, debounceTime as debounceTime$1, find, zip, isObservable, retry, debounce as debounce$1, delay as delay$1, timeout as timeout$1, connect, forkJoin } from "rxjs"; import { getVersionId, getDraftId, getPublishedId, isPublishedId, isDraftId, getVersionFromId, isVersionId, DRAFTS_FOLDER } from "@sanity/client/csm"; import { tz, TZDate } from "@date-fns/tz"; import { formatRelative } from "date-fns/formatRelative"; import { isValid } from "date-fns/isValid"; import { parse } from "date-fns/parse"; import QuickLRU from "quick-lru"; import isEqual$1 from "lodash-es/isEqual.js"; import { SanityLogo, SanityMonogram } from "@sanity/logos"; import { ChevronRightIcon } from "@sanity/icons/ChevronRight"; import { createClient, ClientError, ServerError } from "@sanity/client"; import { SANITY_VERSION } from "./version.js"; import { CheckmarkIcon } from "@sanity/icons/Checkmark"; import { isValidElementType } from "react-is"; import { DocumentIcon } from "@sanity/icons/Document"; import { ImageIcon } from "@sanity/icons/Image"; import { encodeJsonParams, IntentLink, useRouter, route, useIntentLink, useRouterState, StateLink, RouteScope, useStateLink, STICKY_PARAMS, RouterProvider } from "sanity/router"; import { createAgentBundlesStore, INITIAL_STATE as INITIAL_STATE$d, isAgentBundleName } from "./createAgentBundlesStore.js"; import memoize$1 from "lodash-es/memoize.js"; import isNativeNetworkError from "is-network-error"; import { WarningOutlineIcon } from "@sanity/icons/WarningOutline"; import { uuid } from "@sanity/uuid"; import { COLOR_HUES, hues, white, red, yellow, purple, black, green, blue, gray } from "@sanity/color"; import { darken, lighten, hasBadContrast, readableColor } from "color2k"; import isString$1 from "lodash-es/isString.js"; import { CopyIcon } from "@sanity/icons/Copy"; import { isIndexSegment, isKeySegment, isIndexTuple, isKeyedObject, isReference as isReference$1, isArrayOfBlocksSchemaType, isSlug, isTypedObject as isTypedObject$1, isGlobalDocumentReference, isObjectSchemaType, isArraySchemaType, isPortableTextSpan, isPortableTextTextBlock, isPrimitiveSchemaType, isArrayOfObjectsSchemaType, isArrayOfPrimitivesSchemaType, isArrayOfStringsSchemaType, isCreateMutation, isCreateOrReplaceMutation, isCreateIfNotExistsMutation, isBooleanSchemaType, isDateTimeSchemaType, isCrossDatasetReferenceSchemaType, isReferenceSchemaType, isNumberSchemaType, isStringSchemaType, isDocumentSchemaType, isCrossDatasetReference, isTitledListValue, isImage, isValidationErrorMarker, isBlockSchemaType, isSpanSchemaType, isImageSchemaType, isSearchStrategy, searchStrategies as searchStrategies$1, defineType, defineField, defineArrayMember, isValidationWarningMarker, isValidationInfoMarker, isDeprecatedSchemaType, isFileSchemaType } from "@sanity/types"; import { observableCallback } from "observable-callback"; import { useTelemetry, TelemetryProvider, DeferredTelemetryProvider } from "@sanity/telemetry/react"; import { ClipboardIcon } from "@sanity/icons/Clipboard"; import { usePortableTextEditor, PortableTextEditor, usePortableTextEditorSelection, useEditor, useEditorSelector, PortableTextEditable, defineTextBlock, defineBlockObject, defineInlineObject, EditorProvider, defineSchema, keyGenerator as keyGenerator$1 } from "@portabletext/editor"; import { fromUrl } from "@sanity/bifur-client"; import debug$c from "debug"; import startCase from "lodash-es/startCase.js"; import { DocumentsIcon } from "@sanity/icons/Documents"; import { DownloadIcon } from "@sanity/icons/Download"; import { InfoOutlineIcon } from "@sanity/icons/InfoOutline"; import uniqueId from "lodash-es/uniqueId.js"; import { defineEvent, createSessionId, createBatchedStore } from "@sanity/telemetry"; import { isDraftId as isDraftId$1, isVersionId as isVersionId$1, getVersionNameFromId } from "@sanity/id-utils"; import { useSyncExternalStoreWithSelector } from "use-sync-external-store/with-selector"; import escapeRegExp$1 from "lodash-es/escapeRegExp.js"; import { DesktopIcon } from "@sanity/icons/Desktop"; import { MoonIcon } from "@sanity/icons/Moon"; import { SunIcon } from "@sanity/icons/Sun"; import intersection from "lodash-es/intersection.js"; import isEmpty$1 from "lodash-es/isEmpty.js"; import { AddIcon } from "@sanity/icons/Add"; import { isHotkey } from "is-hotkey-esm"; import FocusLock from "react-focus-lock"; import { SearchIcon } from "@sanity/icons/Search"; import { RevertIcon } from "@sanity/icons/Revert"; import { cleanupEfficiency, makeDiff, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL, applyPatches, parsePatch, makePatches } from "@sanity/diff-match-patch"; import flatten$1 from "lodash-es/flatten.js"; import orderBy from "lodash-es/orderBy.js"; import { getTheme_v2, rgba as rgba$1, parseColor, rgbToHex, screen as screen$1, multiply, createColorTheme, buildTheme } from "@sanity/ui/theme"; import difference from "lodash-es/difference.js"; import { UnknownIcon } from "@sanity/icons/Unknown"; import uniq from "lodash-es/uniq.js"; import { ErrorOutlineIcon } from "@sanity/icons/ErrorOutline"; import { createPortableTextMemberSchemaTypes, getSanitySubSchema, sanitySchemaToPortableTextSchema } from "@portabletext/sanity-bridge"; import { differenceInDays } from "date-fns/differenceInDays"; import { differenceInHours } from "date-fns/differenceInHours"; import { differenceInMinutes } from "date-fns/differenceInMinutes"; import { differenceInMonths } from "date-fns/differenceInMonths"; import { differenceInSeconds } from "date-fns/differenceInSeconds"; import { differenceInWeeks } from "date-fns/differenceInWeeks"; import { differenceInYears } from "date-fns/differenceInYears"; import { nanoid, customAlphabet } from "nanoid"; import { AddCircleIcon } from "@sanity/icons/AddCircle"; import { CalendarIcon } from "@sanity/icons/Calendar"; import { CircleIcon } from "@sanity/icons/Circle"; import { CloseIcon } from "@sanity/icons/Close"; import { EditIcon } from "@sanity/icons/Edit"; import { PublishIcon } from "@sanity/icons/Publish"; import { TimelineIcon } from "@sanity/icons/Timeline"; import { TrashIcon } from "@sanity/icons/Trash"; import { UnpublishIcon } from "@sanity/icons/Unpublish"; import { ArrowDownIcon } from "@sanity/icons/ArrowDown"; import { ArrowRightIcon } from "@sanity/icons/ArrowRight"; import * as legacyDateFormat from "@sanity/util/legacyDateFormat"; import { sanitizeLocale, format as format$1, DEFAULT_DATE_FORMAT, parse as parse$2, isValidTimeZoneString, DEFAULT_TIME_FORMAT } from "@sanity/util/legacyDateFormat"; import { getImageDimensions, isDefaultCrop, isDefaultHotspot, isImageSource, isFileSource, tryGetImageDimensions, isSanityImageUrl, parseImageAssetUrl, isAssetObjectStub, isImageAssetId, isFileAssetId } from "@sanity/asset-utils"; import { createImageUrlBuilder } from "@sanity/image-url"; import { ChevronDownIcon } from "@sanity/icons/ChevronDown"; import partition from "lodash-es/partition.js"; import { DEFAULT_MAX_FIELD_DEPTH, builtinTypes, validateSchema, groupProblems, DescriptorConverter, ALL_FIELDS_GROUP_NAME, isActionEnabled, processSchemaSynchronization, getWorkspaceSchemaId } from "@sanity/schema/_internal"; import groupBy from "lodash-es/groupBy.js"; import sortBy from "lodash-es/sortBy.js"; import compact from "lodash-es/compact.js"; import keyBy from "lodash-es/keyBy.js"; import toLower from "lodash-es/toLower.js"; import union from "lodash-es/union.js"; import words from "lodash-es/words.js"; import flow from "lodash-es/flow.js"; import trim from "lodash-es/trim.js"; import { ControlsIcon } from "@sanity/icons/Controls"; import { SpinnerIcon } from "@sanity/icons/Spinner"; import { format } from "date-fns/format"; import { motion, AnimatePresence } from "motion/react"; import omit from "lodash-es/omit.js"; import { renderToString, renderToStaticMarkup } from "react-dom/server"; import { ClockIcon } from "@sanity/icons/Clock"; import { SortIcon } from "@sanity/icons/Sort"; import uniqBy from "lodash-es/uniqBy.js"; import debounce from "lodash-es/debounce.js"; import isFinite from "lodash-es/isFinite.js"; import { createNode } from "@sanity/comlink"; import { Mutation, BufferedDocument, extractWithPath, arrayToJSONMatchPath } from "@sanity/mutator"; import TTLCache from "@isaacs/ttlcache"; import { toHTML } from "@portabletext/to-html"; import { isPortableTextBlock, toPlainText } from "@portabletext/toolkit"; import { randomKey as randomKey$1, isDeepEmpty, resolveTypeName as resolveTypeName$1, isShallowEmptyObject } from "@sanity/util/content"; import { addHours } from "date-fns/addHours"; import { startOfHour } from "date-fns/startOfHour"; import { BoltIcon } from "@sanity/icons/Bolt"; import { DotIcon } from "@sanity/icons/Dot"; import { EarthGlobeIcon } from "@sanity/icons/EarthGlobe"; import { ChevronLeftIcon } from "@sanity/icons/ChevronLeft"; import { addDays } from "date-fns/addDays"; import { addMonths } from "date-fns/addMonths"; import { setDate } from "date-fns/setDate"; import { setHours } from "date-fns/setHours"; import { setMinutes } from "date-fns/setMinutes"; import { setMonth } from "date-fns/setMonth"; import { setYear } from "date-fns/setYear"; import { isSameDay } from "date-fns/isSameDay"; import { isSameMonth } from "date-fns/isSameMonth"; import { isPast } from "date-fns/isPast"; import { eachWeekOfInterval } from "date-fns/eachWeekOfInterval"; import { getWeek } from "date-fns/getWeek"; import { lastDayOfMonth } from "date-fns/lastDayOfMonth"; import { startOfMonth } from "date-fns/startOfMonth"; import xor from "lodash-es/xor.js"; import { diffItem } from "@sanity/diff-patch"; import { diffInput, wrap as wrap$1 } from "@sanity/diff"; import { applyPatch as applyPatch$1, incremental } from "mendoza"; import { getMinutes } from "date-fns/getMinutes"; import { parseISO } from "date-fns/parseISO"; import { EarthAmericasIcon } from "@sanity/icons/EarthAmericas"; import noop$6 from "lodash-es/noop.js"; import { ComposeSparklesIcon } from "@sanity/icons/ComposeSparkles"; import { LockIcon } from "@sanity/icons/Lock"; import { UnlockIcon } from "@sanity/icons/Unlock"; import { mergeMapArray } from "rxjs-mergemap-array"; import { AccessDeniedIcon } from "@sanity/icons/AccessDenied"; import pick from "lodash-es/pick.js"; import get from "lodash-es/get.js"; import { lcs_dp } from "@algorithm.ts/lcs"; import stringify$1 from "json-stable-stringify"; import shallowEquals from "shallow-equals"; import { Rule as Rule$1, Schema } from "@sanity/schema"; import isPlainObject$1 from "lodash-es/isPlainObject.js"; import { createClientConcurrencyLimiter } from "@sanity/util/client"; import { ConcurrencyLimiter } from "@sanity/util/concurrency-limiter"; import { createInstance } from "i18next"; import { reduce } from "json-reduce"; import { exhaustMapWithTrailing } from "rxjs-exhaustmap-with-trailing"; import DataLoader from "dataloader"; import raf from "raf"; import { parse as parse$1, evaluate } from "groq-js"; import sample from "lodash-es/sample.js"; import scrollIntoView$1 from "scroll-into-view-if-needed"; import { SyncIcon } from "@sanity/icons/Sync"; import capitalize from "lodash-es/capitalize.js"; import { UndoIcon } from "@sanity/icons/Undo"; import exif from "exif-component"; import { BinaryDocumentIcon } from "@sanity/icons/BinaryDocument"; import { endOfDay } from "date-fns/endOfDay"; import { endOfMinute } from "date-fns/endOfMinute"; import { startOfDay } from "date-fns/startOfDay"; import { startOfMinute } from "date-fns/startOfMinute"; import { startOfToday } from "date-fns/startOfToday"; import { sub } from "date-fns/sub"; import { BulbOutlineIcon } from "@sanity/icons/BulbOutline"; import { ToggleArrowRightIcon } from "@sanity/icons/ToggleArrowRight"; import { useSensors, useSensor, PointerSensor, KeyboardSensor, DndContext, closestCenter } from "@dnd-kit/core"; import { restrictToHorizontalAxis, restrictToVerticalAxis } from "@dnd-kit/modifiers"; import { sortableKeyboardCoordinates, useSortable, SortableContext, horizontalListSortingStrategy, verticalListSortingStrategy } from "@dnd-kit/sortable"; import { CSS as CSS$1 } from "@dnd-kit/utilities"; import { InsertMenu as InsertMenu$2 } from "@sanity/insert-menu"; import { DragHandleIcon } from "@sanity/icons/DragHandle"; import { AddDocumentIcon } from "@sanity/icons/AddDocument"; import { InsertAboveIcon } from "@sanity/icons/InsertAbove"; import { InsertBelowIcon } from "@sanity/icons/InsertBelow"; import { UploadIcon } from "@sanity/icons/Upload"; import last$1 from "lodash-es/last.js"; import getSlug from "speakingurl"; import { defineBehavior, raise, forward } from "@portabletext/editor/behaviors"; import { NodePlugin, BehaviorPlugin, EventListenerPlugin } from "@portabletext/editor/plugins"; import { OneLinePlugin } from "@portabletext/plugin-one-line"; import { ResetIcon } from "@sanity/icons/Reset"; import { HelpCircleIcon } from "@sanity/icons/HelpCircle"; import { PortableText as PortableText$1, toPlainText as toPlainText$1 } from "@portabletext/react"; import { Icon } from "@sanity/icons"; import { LinkIcon } from "@sanity/icons/Link"; import pickBy from "lodash-es/pickBy.js"; import useSWR from "swr"; import { ConfirmPopover, MenuGroup } from "./MenuGroup.js"; import castArray from "lodash-es/castArray.js"; import { useHotModuleReload } from "use-hot-module-reload"; import { clsx } from "clsx"; import { EyeOpenIcon } from "@sanity/icons/EyeOpen"; import { useDevicePixelRatio, getDevicePixelRatio } from "use-device-pixel-ratio"; import { MenuIcon } from "@sanity/icons/Menu"; import { SparkleIcon } from "@sanity/icons/Sparkle"; import { EyeClosedIcon } from "@sanity/icons/EyeClosed"; import sortedIndex from "lodash-es/sortedIndex.js"; import identity$2 from "lodash-es/identity.js"; import values from "lodash-es/values.js"; import { AddUserIcon } from "@sanity/icons/AddUser"; import { CogIcon } from "@sanity/icons/Cog"; import { LeaveIcon } from "@sanity/icons/Leave"; import createPubSub from "nano-pubsub"; import { UsersIcon } from "@sanity/icons/Users"; import { LinkRemovedIcon } from "@sanity/icons/LinkRemoved"; import semver, { satisfies } from "semver"; import { inboundFiltersIntegration, functionToStringIntegration, browserApiErrorsIntegration, breadcrumbsIntegration, globalHandlersIntegration, linkedErrorsIntegration, dedupeIntegration, httpContextIntegration, isInitialized, getClient, getCurrentScope, BrowserClient, makeFetchTransport, defaultStackParser, Scope, init, withScope, captureException } from "@sentry/react"; import { FaceHappyIcon } from "@sanity/icons/FaceHappy"; import { FaceIndifferentIcon } from "@sanity/icons/FaceIndifferent"; import { FaceSadIcon } from "@sanity/icons/FaceSad"; import { FeedbackIcon } from "@sanity/icons/Feedback"; import { GithubIcon } from "@sanity/icons/Github"; import { RefreshIcon } from "@sanity/icons/Refresh"; import max from "lodash-es/max.js"; import sum$1 from "lodash-es/sum.js"; import { createRoot } from "react-dom/client"; import { addWeeks } from "date-fns/addWeeks"; import { isAfter } from "date-fns/isAfter"; import { isBefore } from "date-fns/isBefore"; import { getLuminance, parseToRgb, rgb, mix } from "polished"; import { getSelectionStartBlock, getSelectionEndBlock, getValue as getValue$1 } from "@portabletext/editor/selectors"; import findIndex$1 from "lodash-es/findIndex.js"; import { ChevronUpIcon } from "@sanity/icons/ChevronUp"; import { useSelector, useActorRef } from "@xstate/react"; import { setup, and, or, stateIn, fromPromise, fromObservable, not, assign as assign$1, sendParent, sendTo, forwardTo } from "xstate"; import range from "lodash-es/range.js"; import { UserIcon } from "@sanity/icons/User"; import { CheckmarkCircleIcon } from "@sanity/icons/CheckmarkCircle"; import deburr from "lodash-es/deburr.js"; import { isThisISOWeek } from "date-fns/isThisISOWeek"; import { isToday } from "date-fns/isToday"; import { formatDistance } from "date-fns/formatDistance"; import { onLCP, onFCP, onCLS, onTTFB, onINP } from "web-vitals/attribution"; import isObject from "lodash-es/isObject.js"; import { DoubleChevronRightIcon } from "@sanity/icons/DoubleChevronRight"; import { CropIcon } from "@sanity/icons/Crop"; import { ReadOnlyIcon } from "@sanity/icons/ReadOnly"; import { DndProvider, useDropPosition } from "@portabletext/plugin-dnd"; import { ListIndexProvider, useListIndex } from "@portabletext/plugin-list-index"; import { CollapseIcon } from "@sanity/icons/Collapse"; import { ExpandIcon } from "@sanity/icons/Expand"; import { BlockElementIcon } from "@sanity/icons/BlockElement"; import { BoldIcon } from "@sanity/icons/Bold"; import { CodeIcon } from "@sanity/icons/Code"; import { InlineElementIcon } from "@sanity/icons/InlineElement"; import { ItalicIcon } from "@sanity/icons/Italic"; import { OlistIcon } from "@sanity/icons/Olist"; import { StrikethroughIcon } from "@sanity/icons/Strikethrough"; import { UlistIcon } from "@sanity/icons/Ulist"; import { UnderlineIcon } from "@sanity/icons/Underline"; import upperFirst from "lodash-es/upperFirst.js"; import { getEnclosingBlock, getSpan } from "@portabletext/editor/traversal"; import set$2 from "lodash-es/set.js"; import { htmlToPortableText } from "@portabletext/html"; import { MarkdownShortcutsPlugin } from "@portabletext/plugin-markdown-shortcuts"; import { PasteLinkPlugin } from "@portabletext/plugin-paste-link"; import { createDecoratorGuard, TypographyPlugin } from "@portabletext/plugin-typography"; import find$1 from "lodash-es/find.js"; import clone from "lodash-es/clone.js"; import { set as set$3 } from "date-fns/set"; import { at, setIfMissing as setIfMissing$1, unset as unset$1, append, set as set$1, SanityEncoder } from "@sanity/mutate"; import { BlockContentIcon } from "@sanity/icons/BlockContent"; import { NumberIcon } from "@sanity/icons/Number"; import { StringIcon } from "@sanity/icons/String"; import { UnlinkIcon } from "@sanity/icons/Unlink"; import { CommentIcon } from "@sanity/icons/Comment"; import { TaskIcon } from "@sanity/icons/Task"; function BetaBadge(props2) { const $ = c(8); let rest, t0, t1; $[0] !== props2 ? ({ fontSize: t0, children: t1, ...rest } = props2, $[0] = props2, $[1] = rest, $[2] = t0, $[3] = t1) : (rest = $[1], t0 = $[2], t1 = $[3]); const fontSize = t0 === void 0 ? 1 : t0, children = t1 === void 0 ? "Beta" : t1; let t2; return $[4] !== children || $[5] !== fontSize || $[6] !== rest ? (t2 = /* @__PURE__ */ jsx(Badge, { ...rest, fontSize, radius: 2, tone: "primary", children }), $[4] = children, $[5] = fontSize, $[6] = rest, $[7] = t2) : t2 = $[7], t2; } function focusRingBorderStyle$3(border) { return `inset 0 0 0 ${border.width}px ${border.color}`; } const ColumnarGrid = /* @__PURE__ */ styled(Grid).withConfig({ displayName: "ColumnarGrid", componentId: "sc-16a5dys-0" })(["align-items:flex-start;"]); function focusRingStyle$2(opts) { const { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)"; return [focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`, border && focusRingBorderStyle$3(border), focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`, focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`].filter(Boolean).join(","); } const LIST_ITEM_DATA_ATTR_ACTIVE = "data-active", LIST_ITEM_INTERACTIVE_SELECTOR = "a,button", FocusOverlayDiv = /* @__PURE__ */ styled.div.withConfig({ displayName: "FocusOverlayDiv", componentId: "sc-1ds81n6-0" })(({ theme, offset }) => css` bottom: ${-offset}px; border-radius: ${rem(theme.sanity.radius[1])}; left: ${-offset}px; pointer-events: none; position: absolute; right: ${-offset}px; top: ${-offset}px; z-index: 2; ${VirtualListBox}:focus-visible & { box-shadow: ${focusRingStyle$2({ base: theme.sanity.color.base, focusRing: theme.sanity.focusRing })}; } `), PointerOverlayDiv = /* @__PURE__ */ styled.div.withConfig({ displayName: "PointerOverlayDiv", componentId: "sc-1ds81n6-1" })(["bottom:0;display:none;left:0;position:absolute;right:0;top:0;z-index:1;@media (hover:hover){&[data-enabled='true']{display:block;}}"]), VirtualListBox = /* @__PURE__ */ styled(Box).withConfig({ displayName: "VirtualListBox", componentId: "sc-1ds81n6-2" })(["height:100%;outline:none;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;width:100%;"]), VirtualListChildBox = /* @__PURE__ */ styled(Box).attrs(({ $height }) => ({ style: { height: `${$height}px` } })).withConfig({ displayName: "VirtualListChildBox", componentId: "sc-1ds81n6-3" })(["position:relative;width:100%;"]), CommandListComponent = forwardRef(function({ activeItemDataAttr = LIST_ITEM_DATA_ATTR_ACTIVE, ariaLabel, ariaMultiselectable = !1, autoFocus, canReceiveFocus, fixedHeight, focusRingOffset = 0, getItemDisabled, getItemKey: getItemKey2, getItemSelected, initialIndex, initialScrollAlign = "start", inputElement, itemHeight, items, onEndReached, onEndReachedIndexOffset = 0, onlyShowSelectionWhenActive, overscan, renderItem: renderItem2, testId, wrapAround = !0, ...responsivePaddingProps }, ref) { const isMountedRef = useRef(!1), [commandListId] = useState(useId()), activeIndexRef = useRef(initialIndex ?? 0), [childContainerElement, setChildContainerElement] = useState(null), [hovered, setHovered] = useState(!1), [pointerOverlayElement, setPointerOverlayElement] = useState(null), [virtualListElement, setVirtualListElement] = useState(null), handleChange = useCallback((v) => { if (!onEndReached) return; const [lastItem] = [...v.getVirtualItems()].reverse(); lastItem && lastItem.index >= items.length - onEndReachedIndexOffset - 1 && isMountedRef.current && onEndReached(); }, [onEndReached, items.length, onEndReachedIndexOffset]), virtualizer = useVirtualizer({ count: items.length, getItemKey: getItemKey2, getScrollElement: () => virtualListElement, estimateSize: () => itemHeight, onChange: handleChange, overscan }), itemIndices = useMemo(() => getItemIndicies(items, getItemDisabled, getItemSelected), [getItemDisabled, getItemSelected, items]), activeItemCount = useMemo(() => itemIndices.filter((v_0) => !v_0.disabled).length, [itemIndices]), enableChildContainerPointerEvents = useCallback((enabled) => pointerOverlayElement?.setAttribute("data-enabled", (!enabled).toString()), [pointerOverlayElement]), getChildDescendantId = useCallback((index) => `${commandListId}-item-${index}`, [commandListId]), getCommandListChildrenId = useCallback(() => `${commandListId}-children`, [commandListId]), showChildrenActiveState = useCallback(() => { const hasFocus = [inputElement, virtualListElement].some((el) => document.activeElement === el); onlyShowSelectionWhenActive && !hasFocus && !hovered || Array.from(childContainerElement?.children || [])?.forEach((child) => { const virtualIndex = Number(child.dataset?.index), targetIndex = itemIndices[virtualIndex]?.activeIndex; child.querySelector(LIST_ITEM_INTERACTIVE_SELECTOR)?.toggleAttribute(activeItemDataAttr, targetIndex === activeIndexRef.current); }); }, [activeItemDataAttr, childContainerElement?.children, hovered, inputElement, itemIndices, onlyShowSelectionWhenActive, virtualListElement]), hideChildrenActiveState = useCallback(() => { Array.from(childContainerElement?.children || [])?.forEach((child_0) => { child_0.querySelector(LIST_ITEM_INTERACTIVE_SELECTOR)?.toggleAttribute(activeItemDataAttr, !1); }); }, [activeItemDataAttr, childContainerElement?.children]), refreshChildrenActiveStateThrottled = useMemo(() => throttle(showChildrenActiveState, 200), [showChildrenActiveState]), handleUpdateActiveDescendant = useCallback(() => { const activeIndex = activeIndexRef?.current; items.length > 0 ? (inputElement?.setAttribute("aria-activedescendant", getChildDescendantId(activeIndex)), virtualListElement?.setAttribute("aria-activedescendant", getChildDescendantId(activeIndex))) : (inputElement?.removeAttribute("aria-activedescendant"), virtualListElement?.removeAttribute("aria-activedescendant")); }, [getChildDescendantId, inputElement, items.length, virtualListElement]), handleGetTopIndex = useCallback(() => { const childContainerParentElement = childContainerElement?.parentElement; if (childContainerElement && childContainerParentElement) { const offset = childContainerParentElement.getBoundingClientRect().top - childContainerElement.getBoundingClientRect().top; return virtualizer.getVirtualItemForOffset(offset)?.index ?? -1; } return -1; }, [childContainerElement, virtualizer]), setActiveIndex = useCallback(({ index: index_0, scrollAlign, scrollIntoView: scrollIntoView2 = !0 }) => { if (activeIndexRef.current = index_0, handleUpdateActiveDescendant(), showChildrenActiveState(), scrollIntoView2) { const virtualListIndex = itemIndices.findIndex((i) => i.activeIndex === index_0); virtualListIndex > -1 && virtualizer.scrollToIndex(virtualListIndex, scrollAlign ? { align: scrollAlign } : {}); } }, [handleUpdateActiveDescendant, itemIndices, showChildrenActiveState, virtualizer]), selectAdjacentItemIndex = useCallback((direction) => { let nextIndex = -1; const lastIndex = activeItemCount - 1; if (direction === "next") { const wrapAroundIndex = wrapAround ? 0 : lastIndex; nextIndex = activeIndexRef.current < activeItemCount - 1 ? activeIndexRef.current + 1 : wrapAroundIndex; } if (direction === "previous") { const wrapAroundIndex_0 = wrapAround ? lastIndex : 0; nextIndex = activeIndexRef.current > 0 ? activeIndexRef.current - 1 : wrapAroundIndex_0; } setActiveIndex({ index: nextIndex, scrollIntoView: !0 }), enableChildContainerPointerEvents(!1); }, [activeItemCount, enableChildContainerPointerEvents, setActiveIndex, wrapAround]), focusElement = useCallback((type) => { switch (type) { case "input": inputElement?.focus(); break; case "list": virtualListElement?.focus(); break; } }, [inputElement, virtualListElement]), focusInputElement = useCallback(() => { inputElement?.focus(); }, [inputElement]), focusListElement = useCallback(() => { virtualListElement?.focus(); }, [virtualListElement]), handleChildMouseEnter = useCallback((index_1) => () => { setActiveIndex({ index: index_1, scrollIntoView: !1 }); }, [setActiveIndex]), handleFocus = useCallback(() => { showChildrenActiveState(); }, [showChildrenActiveState]), handleKeyDown = useCallback((type_0) => (event) => { const childElements_1 = Array.from(childContainerElement?.children || []); if (childElements_1.length && (event.key === "ArrowDown" && (event.preventDefault(), focusElement(type_0), selectAdjacentItemIndex("next")), event.key === "ArrowUp" && (event.preventDefault(), focusElement(type_0), selectAdjacentItemIndex("previous")), event.key === "Enter")) { event.preventDefault(), focusElement(type_0); const currentElement = childElements_1.find((el_0) => Number(el_0.dataset.index) === itemIndices.findIndex((i_0) => i_0.activeIndex === activeIndexRef.current)); currentElement && currentElement?.querySelector(LIST_ITEM_INTERACTIVE_SELECTOR)?.click(); } }, [childContainerElement?.children, focusElement, itemIndices, selectAdjacentItemIndex]), handleKeyDownInput = useCallback((event_0) => handleKeyDown("input")(event_0), [handleKeyDown]), handleKeyDownList = useCallback((event_1) => handleKeyDown("list")(event_1), [handleKeyDown]), handleVirtualListMouseEnter = useCallback(() => { onlyShowSelectionWhenActive && (showChildrenActiveState(), setHovered(!0)); }, [onlyShowSelectionWhenActive, showChildrenActiveState]), handleVirtualListMouseLeave = useCallback(() => { onlyShowSelectionWhenActive && (hideChildrenActiveState(), setHovered(!1)); }, [hideChildrenActiveState, onlyShowSelectionWhenActive]); useImperativeHandle(ref, () => ({ focusInputElement() { focusInputElement(); }, focusListElement() { focusListElement(); }, getTopIndex() { return handleGetTopIndex(); }, scrollToIndex(index_2) { setActiveIndex({ index: index_2 }), enableChildContainerPointerEvents(!0); } }), [enableChildContainerPointerEvents, focusInputElement, focusListElement, handleGetTopIndex, setActiveIndex]), useEffect(() => { typeof initialIndex < "u" && !isMountedRef.current && setActiveIndex({ index: initialIndex, scrollAlign: initialScrollAlign, scrollIntoView: !0 }), isMountedRef.current = !0; }, [initialIndex, initialScrollAlign, onlyShowSelectionWhenActive, setActiveIndex]), useEffect(() => { function handleMouseEvent() { enableChildContainerPointerEvents(!0); } return virtualListElement?.addEventListener("mousemove", handleMouseEvent), virtualListElement?.addEventListener("wheel", handleMouseEvent, { passive: !0 }), () => { virtualListElement?.removeEventListener("mousemove", handleMouseEvent), virtualListElement?.removeEventListener("wheel", handleMouseEvent); }; }, [enableChildContainerPointerEvents, virtualListElement]), useEffect(() => (inputElement?.addEventListener("focus", handleFocus), inputElement?.addEventListener("keydown", handleKeyDownInput), virtualListElement?.addEventListener("focus", handleFocus), virtualListElement?.addEventListener("keydown", handleKeyDownList), () => { inputElement?.removeEventListener("focus", handleFocus), inputElement?.removeEventListener("keydown", handleKeyDownInput), virtualListElement?.removeEventListener("focus", handleFocus), virtualListElement?.removeEventListener("keydown", handleKeyDownList); }), [canReceiveFocus, handleFocus, handleKeyDown, handleKeyDownInput, handleKeyDownList, hideChildrenActiveState, inputElement, showChildrenActiveState, virtualListElement]), useEffect(() => { handleUpdateActiveDescendant(); }, [handleUpdateActiveDescendant, items]), useEffect(() => { const mutationObserver = new MutationObserver(refreshChildrenActiveStateThrottled); return childContainerElement && mutationObserver.observe(childContainerElement, { childList: !0, subtree: !0 }), () => { mutationObserver.disconnect(); }; }, [childContainerElement, refreshChildrenActiveStateThrottled]), useEffect(() => { inputElement?.setAttribute("aria-autocomplete", "list"), inputElement?.setAttribute("aria-expanded", "true"), inputElement?.setAttribute("aria-controls", getCommandListChildrenId()), inputElement?.setAttribute("role", "combobox"); }, [getCommandListChildrenId, inputElement]), useEffect(() => { autoFocus && focusElement(autoFocus); }, [autoFocus, canReceiveFocus, focusListElement, focusInputElement, focusElement]); const rootTabIndex = canReceiveFocus ? 0 : -1; return /* @__PURE__ */ jsxs(VirtualListBox, { id: getCommandListChildrenId(), onMouseEnter: handleVirtualListMouseEnter, onMouseLeave: handleVirtualListMouseLeave, ref: setVirtualListElement, sizing: "border", tabIndex: rootTabIndex, "data-testid": testId, ...responsivePaddingProps, children: [ canReceiveFocus && /* @__PURE__ */ jsx(FocusOverlayDiv, { offset: focusRingOffset }), /* @__PURE__ */ jsx(PointerOverlayDiv, { "aria-hidden": "true", "data-enabled": "false", ref: setPointerOverlayElement }), virtualizer && /* @__PURE__ */ jsx(VirtualListChildBox, { forwardedAs: "ul", $height: virtualizer.getTotalSize(), "aria-label": ariaLabel, "aria-multiselectable": ariaMultiselectable, flex: 1, ref: setChildContainerElement, role: "listbox", children: virtualizer.getVirtualItems().map((virtualRow) => { const virtualIndex_0 = virtualRow.index, { activeIndex: activeIndex_0, disabled, selected } = itemIndices[virtualIndex_0], itemToRender = renderItem2(items[virtualIndex_0], { activeIndex: activeIndex_0, disabled, selected, virtualIndex: virtualIndex_0 }), clonedItem = isValidElement(itemToRender) && itemToRender.type != Fragment ? cloneElement(itemToRender, { // @ts-expect-error @TODO shift the responsibility of setting tabIndex to the consumer, so we can remove the need to clone tabIndex: -1 }) : itemToRender; return /* @__PURE__ */ jsx(CommandListItem2, { ref: fixedHeight ? void 0 : virtualizer.measureElement, activeIndex: activeIndex_0, activeItemCount, ariaMultiselectable, disabled, fixedHeight: fixedHeight ? `${virtualRow.size}px` : void 0, getChildDescendantId, handleChildMouseEnter, selected, virtualIndex: virtualIndex_0, virtualRowStart: virtualRow.start, children: clonedItem }, virtualRow.key); }) }) ] }); }), CommandList = memo(CommandListComponent); CommandList.displayName = "Memo(ForwardRef(CommandList))"; const CommandListItemComponent = forwardRef(function(props2, forwardedRef) { const $ = c(21), { children, activeIndex, activeItemCount, ariaMultiselectable, disabled, fixedHeight, getChildDescendantId, handleChildMouseEnter, selected, virtualIndex, virtualRowStart } = props2; let t0; $[0] !== activeIndex || $[1] !== disabled || $[2] !== handleChildMouseEnter ? (t0 = typeof activeIndex == "number" && !disabled ? handleChildMouseEnter(activeIndex) : void 0, $[0] = activeIndex, $[1] = disabled, $[2] = handleChildMouseEnter, $[3] = t0) : t0 = $[3]; const onMouseEnter = t0; let t1; $[4] !== activeIndex || $[5] !== activeItemCount || $[6] !== ariaMultiselectable || $[7] !== disabled || $[8] !== getChildDescendantId || $[9] !== selected ? (t1 = typeof activeIndex == "number" && !disabled ? { "aria-posinset": activeIndex + 1, ...ariaMultiselectable ? { "aria-selected": selected.toString() } : {}, "aria-setsize": activeItemCount, id: getChildDescendantId(activeIndex), role: "option" } : {}, $[4] = activeIndex, $[5] = activeItemCount, $[6] = ariaMultiselectable, $[7] = disabled, $[8] = getChildDescendantId, $[9] = selected, $[10] = t1) : t1 = $[10]; const activeAriaAttributes = t1, t2 = `translateY(${virtualRowStart}px)`; let t3; $[11] !== fixedHeight || $[12] !== t2 ? (t3 = { flex: 1, height: fixedHeight, left: 0, position: "absolute", top: 0, transform: t2, width: "100%" }, $[11] = fixedHeight, $[12] = t2, $[13] = t3) : t3 = $[13]; const style = t3; let t4; return $[14] !== activeAriaAttributes || $[15] !== children || $[16] !== forwardedRef || $[17] !== onMouseEnter || $[18] !== style || $[19] !== virtualIndex ? (t4 = /* @__PURE__ */ jsx(Stack, { as: "li", "data-index": virtualIndex, ref: forwardedRef, style, tabIndex: -1, ...activeAriaAttributes, onMouseEnter, children }), $[14] = activeAriaAttributes, $[15] = children, $[16] = forwardedRef, $[17] = onMouseEnter, $[18] = style, $[19] = virtualIndex, $[20] = t4) : t4 = $[20], t4; }), CommandListItem2 = memo(CommandListItemComponent); CommandListItem2.displayName = "Memo(ForwardRef(CommandListItem))"; function getItemIndicies(items, getItemDisabled, getItemSelected) { let i = -1; return items.reduce((acc, _, index) => { const disabled = getItemDisabled?.(index) ?? !1, selected = getItemSelected?.(index) ?? !1; return disabled || (i += 1), acc[index] = { activeIndex: disabled ? null : i, disabled, selected }, acc; }, []); } const ContextMenuButton = forwardRef(function(props2, ref) { const $ = c(17); let rest, t0, tone, tooltipProps; $[0] !== props2 ? ({ mode: t0, tooltipProps, tone, ...rest } = props2, $[0] = props2, $[1] = rest, $[2] = t0, $[3] = tone, $[4] = tooltipProps) : (rest = $[1], t0 = $[2], tone = $[3], tooltipProps = $[4]); const mode = t0 === void 0 ? "bleed" : t0, { t } = useTranslation(); let t1; $[5] !== t || $[6] !== tooltipProps?.content ? (t1 = tooltipProps?.content || t("common.context-menu-button.tooltip"), $[5] = t, $[6] = tooltipProps?.content, $[7] = t1) : t1 = $[7]; let t2; $[8] !== t1 || $[9] !== tooltipProps ? (t2 = { ...tooltipProps, content: t1 }, $[8] = t1, $[9] = tooltipProps, $[10] = t2) : t2 = $[10]; let t3; return $[11] !== mode || $[12] !== ref || $[13] !== rest || $[14] !== t2 || $[15] !== tone ? (t3 = /* @__PURE__ */ jsx(Button$1, { ...rest, icon: EllipsisHorizontalIcon, mode, ref, tone, tooltipProps: t2 }), $[11] = mode, $[12] = ref, $[13] = rest, $[14] = t2, $[15] = tone, $[16] = t3) : t3 = $[16], t3; }), DEBUG_MODE$2 = !1, SPINNER_DELAY = 750, TEXT_DELAY = 2e3, StyledCard$6 = /* @__PURE__ */ styled(Card).withConfig({ displayName: "StyledCard", componentId: "sc-m78l3s-0" })(({ $fill }) => css` align-items: center; box-sizing: border-box; display: flex; flex-direction: column; justify-content: center; ${$fill ? css` bottom: 0; height: 100%; left: 0; position: absolute; right: 0; top: 0; width: 100%; ` : css` min-height: 75px; height: stretch; height: -webkit-fill-available; width: stretch; width: -webkit-fill-available; `} ${DEBUG_MODE$2} > * { position: absolute; } `), StyledSpinner = /* @__PURE__ */ styled(Spinner).withConfig({ displayName: "StyledSpinner", componentId: "sc-m78l3s-1" })(({ $animatePosition = !0 }) => css` @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } @keyframes slideUp { from { transform: translateY(0); } to { transform: translateY(-15px); } } animation: ${$animatePosition ? `500ms ease-out ${SPINNER_DELAY}ms 1 normal both running fadeIn, 750ms ease-out ${TEXT_DELAY}ms 1 normal both running slideUp` : `500ms ease-out ${SPINNER_DELAY}ms 1 normal both running fadeIn`}; `), StyledText$6 = /* @__PURE__ */ styled(Text$1).withConfig({ displayName: "StyledText", componentId: "sc-m78l3s-2" })(["@keyframes fadeIn{from{opacity:0;}to{opacity:1;}}@keyframes slideDown{from{transform:translateY(0);}to{transform:translateY(15px);}}animation:1500ms ease-out ", "ms 1 normal both running fadeIn,750ms ease-out ", "ms 1 normal both running slideDown;"], TEXT_DELAY, TEXT_DELAY); function LoadingBlock(t0) { const $ = c(10), { fill, showText, title } = t0, t1 = fill ? Layer : "div", t2 = !!showText; let t3; $[0] !== t2 ? (t3 = /* @__PURE__ */ jsx(StyledSpinner, { $animatePosition: t2, muted: !0 }), $[0] = t2, $[1] = t3) : t3 = $[1]; let t4; $[2] !== showText || $[3] !== title ? (t4 = showText && /* @__PURE__ */ jsx(LoadingText, { title }), $[2] = showText, $[3] = title, $[4] = t4) : t4 = $[4]; let t5; return $[5] !== fill || $[6] !== t1 || $[7] !== t3 || $[8] !== t4 ? (t5 = /* @__PURE__ */ jsxs(StyledCard$6, { $fill: fill, as: t1, "data-testid": "loading-block", children: [ t3, t4 ] }), $[5] = fill, $[6] = t1, $[7] = t3, $[8] = t4, $[9] = t5) : t5 = $[9], t5; } function LoadingText(t0) { const $ = c(5), { title } = t0, { t } = useTranslation(); let t1; $[0] !== t || $[1] !== title ? (t1 = title || t("common.loading"), $[0] = t, $[1] = title, $[2] = t1) : t1 = $[2]; let t2; return $[3] !== t1 ? (t2 = /* @__PURE__ */ jsx(StyledText$6, { muted: !0, size: 1, children: t1 }), $[3] = t1, $[4] = t2) : t2 = $[4], t2; } function defineLocaleResourceBundle(bundle) { return bundle; } function defineLocale(locale) { return locale; } function isStaticResourceBundle(bundle) { return !("then" in bundle.resources && typeof bundle.resources.then == "function"); } function defineLocalesResources(namespace, resources) { return resources; } function removeUndefinedLocaleResources(resources) { const result = {}; for (const key in resources) typeof resources[key] < "u" && (result[key] = resources[key]); return result; } const studioLocaleNamespace = "studio", validationLocaleNamespace = "validation", copyPasteLocalNamespace = "copy-paste", feedbackLocaleNamespace = "feedback", copyPasteLocaleStrings = defineLocalesResources("copy-paste", { /** Text on the field action button to copy a document */ "copy-paste.field-action-copy-button.document.title": "Copy document", /** Text on the field action button to copy a field */ "copy-paste.field-action-copy-button.field.title": "Copy field", /** Text on the field action button to paste a document */ "copy-paste.field-action-paste-button.document.title": "Paste document", /** Text on the field action button to paste a field */ "copy-paste.field-action-paste-button.field.title": "Paste field", /** --- On paste --- */ /** The validation message that is shown when pasting a value into a read-only target */ "copy-paste.on-paste.validation.read-only-target.description": "The target is read-only", /** The validation message that is shown when read-only fields are skipped during document paste */ "copy-paste.on-paste.validation.read-only-fields-skipped.description": "Skipped read-only fields: {{fieldNames}}", /** The validation message for skipped read-only fields when truncated */ "copy-paste.on-paste.validation.read-only-fields-skipped-truncated.description": "Skipped read-only fields: {{fieldNames}} and {{count}} more", /** The validation message that is shown when the source and target schema types are incompatible */ "copy-paste.on-paste.validation.schema-type-incompatible.description": "Source and target schema types are not compatible", /** The validation message that is shown when reference types are incompatible */ "copy-paste.on-paste.validation.reference-type-incompatible.description": 'References of type "{{sourceReferenceType}}" is not allowed in reference field that accepts types "{{targetReferenceTypes}}"', /** The validation message that is shown when reference is incompatible with filter */ "copy-paste.on-paste.validation.reference-filter-incompatible.description": "Reference is not allowed in reference field according to filter", /** The validation message that is shown when reference does not exist */ "copy-paste.on-paste.validation.reference-validation-failed.description": 'The referenced document "{{ref}}" does not exist', /** The validation message that is shown when image files are incompatible */ "copy-paste.on-paste.validation.image-file-incompatible.description": 'A "{{sourceSchemaType}}" is not allowed in a "{{targetSchemaType}}"', /** The validation message that is shown when array types are incompatible */ "copy-paste.on-paste.validation.array-type-incompatible.description": 'Value of type "{{type}}" is not allowed in this array field', /** The validation message that is shown when array values are incompatible */ "copy-paste.on-paste.validation.array-value-incompatible.description": 'Value of type "{{type}}" is not allowed in this array field', /** The validation message that is shown when string values are incompatible */ "copy-paste.on-paste.validation.string-value-incompatible.description": 'Value "{{value}}" is not allowed in "{{allowedStrings}}"', /** The validation message that is shown when primitive types are incompatible */ "copy-paste.on-paste.validation.primitive-type-incompatible.description": 'Value of type "{{type}}" is not allowed in this field', /** The validation message that is shown when the clipboard is empty */ "copy-paste.on-paste.validation.clipboard-empty.title": "Nothing to paste", /** The validation message that is shown when the clipboard item is invalid */ "copy-paste.on-paste.validation.clipboard-invalid.title": "Invalid clipboard item", /** The validation message that is shown when schema types are incompatible */ "copy-paste.on-paste.validation.schema-type-incompatible.title": "Coul