import {BoxOverflow} from '@sanity/ui'
import {CardProps} from '@sanity/ui'
import {ComponentProps} from 'react'
import {ComponentType} from 'react'
import {ConfigContext} from 'sanity'
import {DocumentActionComponent} from 'sanity'
import {DocumentBadgeComponent} from 'sanity'
import {DocumentFieldAction} from 'sanity'
import {DocumentFieldActionNode} from 'sanity'
import {DocumentFormNode} from 'sanity'
import {DocumentInspector} from 'sanity'
import {DocumentLanguageFilterComponent} from 'sanity'
import {DocumentStore} from 'sanity'
import {EditStateFor} from 'sanity'
import {ElementType} from 'react'
import {ForwardRefExoticComponent} from 'react'
import {GeneralPreviewLayoutKey} from 'sanity'
import {HTMLProps} from 'react'
import {I18nTextRecord} from 'sanity'
import {InitialValueTemplateItem} from 'sanity'
import {JSX as JSX_2} from 'react'
import {LocaleSource} from 'sanity'
import {MemoExoticComponent} from 'react'
import {NamedExoticComponent} from 'react'
import {ObjectSchemaType} from '@sanity/types'
import {Observable} from 'rxjs'
import {PaneRouterContext} from 'sanity/_singletons'
import {PatchEvent} from 'sanity'
import {Path} from '@sanity/types'
import {PermissionCheckResult} from 'sanity'
import {Plugin as Plugin_2} from 'sanity'
import {PreviewLayoutKey} from 'sanity'
import {ReactNode} from 'react'
import {RefAttributes} from 'react'
import {ReleaseId} from 'sanity'
import {SanityDocument} from '@sanity/types'
import {SanityDocumentLike} from '@sanity/types'
import {SchemaType} from '@sanity/types'
import {SearchParam} from 'sanity/router'
import {SortOrdering} from '@sanity/types'
import {SortOrderingItem} from '@sanity/types'
import {Source} from 'sanity'
import {StateTree} from 'sanity'
import {TimelineStore} from 'sanity'
import {ValidationMarker} from '@sanity/types'

/**
 * @hidden
 * @beta */
export declare interface BackLinkProps {
  children?: ReactNode
}

/**
 * Interface for base generic list
 *
 * @public
 */
export declare interface BaseGenericList extends StructureNode {
  /** List layout key. */
  defaultLayout?: PreviewLayoutKey
  /** Can handle intent. See {@link IntentChecker} */
  canHandleIntent?: IntentChecker
  /** List display options. See {@link ListDisplayOptions} */
  displayOptions?: ListDisplayOptions
  /** List child. See {@link Child} */
  child: Child
  /** List initial values array. See {@link InitialValueTemplateItem} and {@link InitialValueTemplateItemBuilder} */
  initialValueTemplates?: (InitialValueTemplateItem | InitialValueTemplateItemBuilder)[]
}

/**
 * Base intent parameters
 *
 * @public
 * @todo dedupe with core
 */
export declare interface BaseIntentParams {
  /**
   * Document schema type name to create/edit.
   * Required for `create` intents, optional for `edit` (but encouraged, safer and faster)
   */
  type?: string
  /**
   * ID of the document to create/edit.
   * Required for `edit` intents, optional for `create`.
   */
  id?: string
  /**
   * Name (ID) of initial value template to use for `create` intent. Optional.
   */
  template?: string
  /**
   * Experimental field path
   *
   * @beta
   * @experimental
   * @hidden
   */
  path?: string
  /**
   * Optional "mode" to use for edit intent.
   * Known modes are `structure` and `presentation`.
   */
  mode?: string
  /**
   * Arbitrary/custom parameters are generally discouraged - try to keep them to a minimum,
   * or use `payload` (arbitrary JSON-serializable object) instead.
   */
  [key: string]: string | undefined
}

/** @internal */
export declare interface BaseResolvedPaneNode<T extends PaneNode['type']> {
  id: string
  type: T
  title: string
  i18n?: I18nTextRecord<'title'>
  menuItems?: PaneMenuItem[]
  menuItemGroups?: PaneMenuItemGroup[]
  canHandleIntent?: (
    intentName: string,
    params: Record<string, string | undefined>,
    options: {
      pane: PaneNode
      index: number
    },
  ) => boolean
  child?: UnresolvedPaneNode
}

declare interface BaseStructureToolPaneProps<T extends PaneNode['type']> {
  paneKey: string
  index: number
  itemId: string
  childItemId?: string
  isSelected?: boolean
  isActive?: boolean
  pane: Extract<
    PaneNode,
    {
      type: T
    }
  >
  /**
   * TODO: COREL - Remove this after updating sanity-assist to use <PerspectiveProvider>
   *
   * Allows to override the global version with a specific version or release.
   * @deprecated use <PerspectiveProvider> instead
   * @beta
   */
  forcedVersion?: {
    selectedPerspectiveName: ReleaseId | 'published' | undefined
    isReleaseLocked: boolean
    selectedReleaseId: ReleaseId | undefined
  }
  /**
   * @deprecated Avoid specifying a key, instead use `paneKey` if need be
   */
  key?: string
}

/**
 * Interface for base view
 *
 * @public */
export declare interface BaseView {
  /** View id */
  id: string
  /** View Title */
  title: string
  /** View Icon */
  icon?: React.ComponentType | React.ReactNode
}

/**
 * Interface for buildable component
 *
 * @public
 */
export declare interface BuildableComponent extends Partial<StructureNode> {
  /** Component of type {@link UserComponent} */
  component?: UserComponent
  /** Component child of type {@link Child} */
  child?: Child
  /** Component options */
  options?: {
    [key: string]: unknown
  }
  /** Component menu items. See {@link MenuItem} and {@link MenuItemBuilder}  */
  menuItems?: (MenuItem | MenuItemBuilder)[]
  /** Component menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
  menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[]
  canHandleIntent?: IntentChecker
}

/**
 * Interface for buildable generic list
 *
 * @public
 */
export declare interface BuildableGenericList extends Partial<BaseGenericList> {
  /** List menu items array. See {@link MenuItem} and {@link MenuItemBuilder} */
  menuItems?: (MenuItem | MenuItemBuilder)[]
  /** List menu items groups array. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
  menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[]
}

/**
 * Interface for buildable list
 *
 * @public
 */
export declare interface BuildableList extends BuildableGenericList {
  /** List items. See {@link ListItem}, {@link ListItemBuilder} and {@link Divider} */
  items?: (ListItem | ListItemBuilder | Divider)[]
}

/** @internal */
export declare type Builder =
  | CollectionBuilder
  | ComponentBuilder
  | DocumentBuilder
  | DocumentListBuilder
  | DocumentListItemBuilder
  | ListItemBuilder
  | MenuItemBuilder
  | MenuItemGroupBuilder
  | InitialValueTemplateItemBuilder

/**
 * Child of a structure node
 * See {@link Collection}, {@link CollectionBuilder} and {@link ChildResolver}
 *
 * @public
 */
export declare type Child = Collection | CollectionBuilder | ChildResolver

/**
 * @hidden
 * @beta */
export declare interface ChildLinkProps {
  childId: string
  childParameters?: Record<string, string>
  childPayload?: unknown
  children?: ReactNode
}

/**
 * Interface for child observable
 *
 * @public
 */
export declare interface ChildObservable {
  /** Subscribes to the child observable. See {@link ItemChild} */
  subscribe: (child: ItemChild | Promise<ItemChild>) => Record<string, unknown>
}

/**
 * Interface for child resolver
 *
 * @public */
export declare interface ChildResolver {
  (
    itemId: string,
    options: ChildResolverOptions,
  ): ItemChild | Promise<ItemChild> | ChildObservable | Observable<ItemChild> | undefined
}

/**
 * Interface for child resolver options
 *
 * @public
 */
export declare interface ChildResolverOptions {
  /** Child parent */
  parent: unknown
  /** Child index */
  index: number
  splitIndex: number
  /** Child path */
  path: string[]
  /** Child parameters */
  params: Record<string, string | undefined>
  /** Structure context. See {@link StructureContext} */
  structureContext: StructureContext
  /** Serialize options. See {@link SerializeOptions} */
  serializeOptions?: SerializeOptions
}

/**
 * Collection
 * See {@link List}, {@link DocumentList}, {@link EditorNode}, {@link DocumentNode} and {@link Component}
 *
 * @public
 */
export declare type Collection = List | DocumentList | EditorNode | DocumentNode | Component

/**
 * Collection builder
 * See {@link ListBuilder}, {@link DocumentListBuilder}, {@link DocumentTypeListBuilder}, {@link DocumentBuilder} and {@link ComponentBuilder}
 *
 * @public
 */
export declare type CollectionBuilder =
  | ListBuilder
  | DocumentListBuilder
  | DocumentTypeListBuilder
  | DocumentBuilder
  | ComponentBuilder

/**
 * Interface for component
 *
 * @public
 */
export declare interface Component extends StructureNode {
  /** Component of type {@link UserComponent} */
  component: UserComponent
  /** Component child of type {@link Child} */
  child?: Child
  /** Component menu items, array of type {@link MenuItem} */
  menuItems: MenuItem[]
  /** Component menu item group, array of type {@link MenuItemGroup} */
  menuItemGroups: MenuItemGroup[]
  /** Component options */
  options: {
    [key: string]: unknown
  }
  canHandleIntent?: IntentChecker
}

/** @internal */
export declare const component: (
  componentOrSpec?: UserViewComponent | Partial<ComponentView>,
) => ComponentViewBuilder

/**
 * Class for building components
 *
 * @public
 */
export declare class ComponentBuilder implements Serializable<Component> {
  /** component builder option object */
  protected spec: BuildableComponent
  constructor(spec?: ComponentInput)
  /** Set Component ID
   * @param id - component ID
   * @returns component builder based on ID provided
   */
  id(id: string): ComponentBuilder
  /** Get ID
   * @returns ID
   */
  getId(): BuildableComponent['id']
  /** Set Component title
   * @param title - component title
   * @returns component builder based on title provided (and ID)
   */
  title(title: string): ComponentBuilder
  /** Get Component title
   * @returns title
   */
  getTitle(): BuildableComponent['title']
  /** Set the i18n key and namespace used to populate the localized title.
   * @param i18n - the key and namespaced used to populate the localized title.
   * @returns component builder based on i18n key and ns provided
   */
  i18n(i18n: I18nTextRecord<'title'>): ComponentBuilder
  /** Get i18n key and namespace used to populate the localized title
   * @returns the i18n key and namespace used to populate the localized title
   */
  getI18n(): I18nTextRecord<'title'> | undefined
  /** Set Component child
   * @param child - child component
   * @returns component builder based on child component provided
   */
  child(child: Child): ComponentBuilder
  /** Get Component child
   * @returns child component
   */
  getChild(): BuildableComponent['child']
  /** Set component
   * @param component - user built component
   * @returns component builder based on component provided
   */
  component(component: UserComponent): ComponentBuilder
  /** Get Component
   * @returns component
   */
  getComponent(): BuildableComponent['component']
  /** Set Component options
   * @param options - component options
   * @returns component builder based on options provided
   */
  options(options: {[key: string]: unknown}): ComponentBuilder
  /** Get Component options
   * @returns component options
   */
  getOptions(): NonNullable<BuildableComponent['options']>
  /** Set Component menu items
   * @param menuItems - component menu items
   * @returns component builder based on menuItems provided
   */
  menuItems(menuItems: (MenuItem | MenuItemBuilder)[]): ComponentBuilder
  /** Get Component menu items
   * @returns menu items
   */
  getMenuItems(): BuildableComponent['menuItems']
  /** Set Component menu item groups
   * @param menuItemGroups - component menu item groups
   * @returns component builder based on menuItemGroups provided
   */
  menuItemGroups(menuItemGroups: (MenuItemGroup | MenuItemGroupBuilder)[]): ComponentBuilder
  /** Get Component menu item groups
   * @returns menu item groups
   */
  getMenuItemGroups(): BuildableComponent['menuItemGroups']
  canHandleIntent(canHandleIntent: IntentChecker): ComponentBuilder
  /** Serialize component
   * @param options - serialization options
   * @returns component object based on path provided in options
   *
   */
  serialize(options?: SerializeOptions): Component
  /** Clone component builder (allows for options overriding)
   * @param withSpec - component builder options
   * @returns cloned builder
   */
  clone(withSpec?: BuildableComponent): ComponentBuilder
}

/**
 * Interface for component input
 *
 * @public
 */
export declare interface ComponentInput extends StructureNode {
  /** Component of type {@link UserComponent} */
  component: UserComponent
  /** Component child of type {@link Child} */
  child?: Child
  /** Component options */
  options?: {
    [key: string]: unknown
  }
  /** Component menu items. See {@link MenuItem} and {@link MenuItemBuilder}  */
  menuItems?: (MenuItem | MenuItemBuilder)[]
  /** Component menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
  menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[]
}

/**
 * Interface for component views.
 *
 * @public */
export declare interface ComponentView<TOptions = Record<string, any>> extends BaseView {
  type: 'component'
  /** Component view components. See {@link UserViewComponent} */
  component: UserViewComponent
  /** Component view options */
  options: TOptions
}

/**
 * Class for building a component view.
 *
 * @public */
export declare class ComponentViewBuilder extends GenericViewBuilder<
  Partial<ComponentView>,
  ComponentViewBuilder
> {
  /** Partial Component view option object. See {@link ComponentView} */
  protected spec: Partial<ComponentView>
  constructor(
    /**
     * Component view component or spec
     * @param componentOrSpec - user view component or partial component view. See {@link UserViewComponent} and {@link ComponentView}
     */
    componentOrSpec?: UserViewComponent | Partial<ComponentView>,
  )
  /** Set view Component
   * @param component - component view component. See {@link UserViewComponent}
   * @returns component view builder based on component view provided. See {@link ComponentViewBuilder}
   */
  component(component: UserViewComponent): ComponentViewBuilder
  /** Get view Component
   * @returns Partial component view. See {@link ComponentView}
   */
  getComponent(): Partial<ComponentView>['component']
  /** Set view Component options
   * @param options - component view options
   * @returns component view builder based on options provided. See {@link ComponentViewBuilder}
   */
  options(options: {[key: string]: any}): ComponentViewBuilder
  /** Get view Component options
   * @returns component view options. See {@link ComponentView}
   */
  getOptions(): ComponentView['options']
  /** Serialize view Component
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns component view based on path provided in options. See {@link ComponentView}
   *
   */
  serialize(options?: SerializeOptions): ComponentView
  /** Clone Component view builder (allows for options overriding)
   * @param withSpec - partial for component view option. See {@link ComponentView}
   * @returns component view builder. See {@link ComponentViewBuilder}
   */
  clone(withSpec?: Partial<ComponentView>): ComponentViewBuilder
}

/** @internal */
export declare function ConfirmDeleteDialog(props: ConfirmDeleteDialogProps): JSX_2.Element

/** @internal */
export declare interface ConfirmDeleteDialogProps {
  /**
   * Incoming document ID used to find other referencing documents. This
   * field respects draft IDs (e.g. if you pass in a published ID when one
   * doesn't exist the document title may not show up).
   */
  id: string
  /**
   * The schema typename of the incoming document
   */
  type: string
  /**
   * The name of the action being done. (e.g. the `'unpublish'` action requires
   * the same document deletion confirmation).
   */
  action?: 'delete' | 'unpublish'
  onCancel: () => void
  onConfirm: () => void
}

/** @internal */
export declare function createStructureBuilder({
  defaultDocumentNode,
  source,
}: StructureBuilderOptions): StructureBuilder

/** @internal */
export declare interface CustomComponentPaneNode extends BaseResolvedPaneNode<'component'> {
  component: UserComponent
  options?: Record<string, unknown>
}

/** @internal */
export declare const DEFAULT_INTENT_HANDLER: unique symbol

/**
 * An object holding the documentId and schemaType for the document node being resolved.
 *
 * @public
 */
export declare interface DefaultDocumentNodeContext extends ConfigContext {
  /**
   * The id of the sanity document
   */
  documentId?: string
  /**
   * the schema of the sanity document
   */
  schemaType: string
}

/**
 * A resolver function used to return the default document node used when editing documents.
 *
 * @public
 *
 * @returns a document node builder, or null/undefined if no document node should be returned.
 *
 */
export declare type DefaultDocumentNodeResolver = (
  /**
   * S - an instance of the structure builder, that can be used to build the lists/items/panes for the structure tool
   * context - an object holding various context that may be used to customize the structure, for instance the current user.
   *  Defaults to
   * ```ts
   * (S) => S.defaults()
   * ```
   * See {@link StructureBuilder}
   */
  S: StructureBuilder,
  /**
   * An object holding the documentId and schemaType for the document node being resolved.
   * See {@link DefaultDocumentNodeContext}
   */
  options: DefaultDocumentNodeContext,
) => DocumentBuilder | null | undefined

/** @internal */
export declare function defaultInitialValueTemplateItems(
  context: StructureContext,
): InitialValueTemplateItemBuilder[]

/** @internal */
export declare const defaultIntentChecker: IntentChecker

/**
 * A `Divider` is a visual separator in the structure tree.
 *
 * @public
 */
export declare interface Divider {
  /**
   * The divider's ID
   */
  id: string
  type: 'divider'
}

/**
 * A `DocumentBuilder` is used to build a document node.
 *
 * @public */
export declare class DocumentBuilder implements Serializable<DocumentNode> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Component builder option object See {@link PartialDocumentNode} */
  protected spec: PartialDocumentNode
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: PartialDocumentNode,
  )
  /** Set Document Builder ID
   * @param id - document builder ID
   * @returns document builder based on ID provided. See {@link DocumentBuilder}
   */
  id(id: string): DocumentBuilder
  /** Get Document Builder ID
   * @returns document ID. See {@link PartialDocumentNode}
   */
  getId(): PartialDocumentNode['id']
  /** Set Document title
   * @param title - document title
   * @returns document builder based on title provided (and ID). See {@link DocumentBuilder}
   */
  title(title: string): DocumentBuilder
  /** Get Document title
   * @returns document title. See {@link PartialDocumentNode}
   */
  getTitle(): PartialDocumentNode['title']
  /** Set the i18n key and namespace used to populate the localized title.
   * @param i18n - the key and namespaced used to populate the localized title.
   * @returns component builder based on i18n key and ns provided
   */
  i18n(i18n: I18nTextRecord<'title'>): DocumentBuilder
  /** Get i18n key and namespace used to populate the localized title
   * @returns the i18n key and namespace used to populate the localized title
   */
  getI18n(): I18nTextRecord<'title'> | undefined
  /** Set Document child
   * @param child - document child
   * @returns document builder based on child provided. See {@link DocumentBuilder}
   */
  child(child: Child): DocumentBuilder
  /** Get Document child
   * @returns document child. See {@link PartialDocumentNode}
   */
  getChild(): PartialDocumentNode['child']
  /** Set Document ID
   * @param documentId - document ID
   * @returns document builder with document based on ID provided. See {@link DocumentBuilder}
   */
  documentId(documentId: string): DocumentBuilder
  /** Get Document ID
   * @returns document ID. See {@link DocumentOptions}
   */
  getDocumentId(): Partial<DocumentOptions>['id']
  /** Set Document Type
   * @param documentType - document type
   * @returns document builder with document based on type provided. See {@link DocumentBuilder}
   */
  schemaType(documentType: SchemaType | string): DocumentBuilder
  /** Get Document Type
   * @returns document type. See {@link DocumentOptions}
   */
  getSchemaType(): Partial<DocumentOptions>['type']
  /** Set Document Template
   * @param templateId - document template ID
   * @param parameters - document template parameters
   * @returns document builder with document based on template provided. See {@link DocumentBuilder}
   */
  initialValueTemplate(templateId: string, parameters?: Record<string, unknown>): DocumentBuilder
  /** Get Document Template
   * @returns document template. See {@link DocumentOptions}
   */
  getInitialValueTemplate(): Partial<DocumentOptions>['template']
  /** Get Document's initial value Template parameters
   * @returns document template parameters. See {@link DocumentOptions}
   */
  getInitialValueTemplateParameters(): Partial<DocumentOptions>['templateParameters']
  /** Set Document views
   * @param views - document views. See {@link ViewBuilder} and {@link View}
   * @returns document builder with document based on views provided. See {@link DocumentBuilder}
   */
  views(views: (View | ViewBuilder)[]): DocumentBuilder
  /** Get Document views
   * @returns document views. See {@link ViewBuilder} and {@link View}
   */
  getViews(): (View | ViewBuilder)[]
  /** Serialize Document builder
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns document node based on path, index and hint provided in options. See {@link DocumentNode}
   */
  serialize({path, index, hint}?: SerializeOptions): DocumentNode
  /** Clone Document builder
   * @param withSpec - partial document node specification used to extend the cloned builder. See {@link PartialDocumentNode}
   * @returns document builder based on context and spec provided. See {@link DocumentBuilder}
   */
  clone(withSpec?: PartialDocumentNode): DocumentBuilder
}

/**
 * @hidden
 * @beta */
export declare type DocumentFieldMenuActionNode = DocumentFieldActionNode & {
  intent?: Intent
}

/** @internal */
export declare function documentFromEditor(
  context: StructureContext,
  spec?: EditorNode,
): DocumentBuilder

/** @internal */
export declare function documentFromEditorWithInitialValue(
  {resolveDocumentNode, templates}: StructureContext,
  templateId: string,
  parameters?: Record<string, unknown>,
): DocumentBuilder

/** @internal */
export declare function DocumentInspectorHeader(
  props: DocumentInspectorHeaderProps & Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref'>,
): JSX_2.Element

declare interface DocumentInspectorHeaderProps {
  as?: CardProps['as']
  closeButtonLabel: string
  flex?: CardProps['flex']
  onClose: () => void
  title: ReactNode
}

/**
 * Interface for document list
 *
 * @public
 */
export declare interface DocumentList extends GenericList {
  type: 'documentList'
  /** Document list options. See {@link DocumentListOptions} */
  options: DocumentListOptions
  /** Document list child. See {@link Child} */
  child: Child
  /** Document schema type name */
  schemaTypeName?: string
}

/**
 * Class for building document list
 *
 * @public
 */
export declare class DocumentListBuilder extends GenericListBuilder<
  PartialDocumentList,
  DocumentListBuilder
> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Document list options. See {@link PartialDocumentList} */
  protected spec: PartialDocumentList
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: DocumentListInput,
  )
  /** Set API version
   * @param apiVersion - API version
   * @returns document list builder based on the options and API version provided. See {@link DocumentListBuilder}
   */
  apiVersion(apiVersion: string): DocumentListBuilder
  /** Get API version
   * @returns API version
   */
  getApiVersion(): string | undefined
  /** Set Document list filter
   * @param filter - GROQ-filter used to determine which documents to display. Do not support joins, since they operate on individual documents, and will ignore order-clauses and projections. See {@link https://www.sanity.io/docs/realtime-updates}
   * @returns document list builder based on the options and filter provided. See {@link DocumentListBuilder}
   */
  filter(filter: string): DocumentListBuilder
  /** Get Document list filter
   * @returns filter
   */
  getFilter(): string | undefined
  /** Set Document list schema type name
   * @param type - schema type name.
   * @returns document list builder based on the schema type name provided. See {@link DocumentListBuilder}
   */
  schemaType(type: SchemaType | string): DocumentListBuilder
  /** Get Document list schema type name
   * @returns schema type name
   */
  getSchemaType(): string | undefined
  /** Set Document list options' parameters
   * @param params - parameters
   * @returns document list builder based on the options provided. See {@link DocumentListBuilder}
   */
  params(params: Record<string, unknown>): DocumentListBuilder
  /** Get Document list options' parameters
   * @returns options
   */
  getParams(): Record<string, unknown> | undefined
  /** Set Document list default ordering
   * @param ordering - default sort ordering array. See {@link SortOrderingItem}
   * @returns document list builder based on ordering provided. See {@link DocumentListBuilder}
   */
  defaultOrdering(ordering: SortOrderingItem[]): DocumentListBuilder
  /** Get Document list default ordering
   * @returns default ordering. See {@link SortOrderingItem}
   */
  getDefaultOrdering(): SortOrderingItem[] | undefined
  /** Serialize Document list
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns document list object based on path provided in options. See {@link DocumentList}
   */
  serialize(options?: SerializeOptions): DocumentList
  /** Clone Document list builder (allows for options overriding)
   * @param withSpec - override document list spec. See {@link PartialDocumentList}
   * @returns document list builder. See {@link DocumentListBuilder}
   */
  clone(withSpec?: PartialDocumentList): DocumentListBuilder
  /** Get Document list spec
   * @returns document list spec. See {@link PartialDocumentList}
   */
  getSpec(): PartialDocumentList
}

/**
 * Interface for document list input
 *
 * @public
 */
export declare interface DocumentListInput extends GenericListInput {
  /** Document list options. See {@link DocumentListOptions} */
  options: DocumentListOptions
}

/**
 * Interface for document list item
 *
 * @public
 */
export declare interface DocumentListItem extends ListItem {
  /** Document schema type. See {@link SchemaType} */
  schemaType: SchemaType
  /** Document ID */
  _id: string
}

/**
 * Class for building a document list item
 *
 * @public
 */
export declare class DocumentListItemBuilder extends ListItemBuilder {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Document list options. See {@link PartialDocumentListItem} */
  protected spec: PartialDocumentListItem
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: DocumentListItemInput,
  )
  /**
   * Serialize document list item
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns document list item object based on path provided in options. See {@link DocumentListItem}
   */
  serialize(options?: SerializeOptions): DocumentListItem
  /** Clone Document list item builder (allows for options overriding)
   * @param withSpec - Document list item builder options. See {@link PartialDocumentListItem}
   * @returns document list item builder. See {@link DocumentListItemBuilder}
   */
  clone(withSpec?: PartialDocumentListItem): DocumentListItemBuilder
}

/**
 * Interface for document list item input
 *
 * @public
 */
export declare interface DocumentListItemInput extends ListItemInput {
  /** Document list item input schema type. See {@link SchemaType} */
  schemaType: SchemaType | string
}

/**
 * Interface for document List options
 *
 * @public
 */
export declare interface DocumentListOptions {
  /** Document list filter */
  filter: string
  /** Document list parameters */
  params?: Record<string, unknown>
  /** Document list API version */
  apiVersion?: string
  /** Document list API default ordering array. */
  defaultOrdering?: SortOrderingItem[]
}

/**
 * @internal
 */
export declare const DocumentListPane: NamedExoticComponent<
  BaseStructureToolPaneProps<'documentList'>
>

/** @internal */
export declare interface DocumentListPaneNode extends BaseResolvedPaneNode<'documentList'> {
  defaultLayout?: GeneralPreviewLayoutKey
  displayOptions?: {
    showIcons?: boolean
  }
  initialValueTemplates?: InitialValueTemplateItem[]
  options: {
    filter: string
    defaultOrdering?: Array<{
      field: string
      direction: 'asc' | 'desc'
    }>
    params?: Record<string, unknown>
    apiVersion?: string
  }
  schemaTypeName: string
  source?: string
}

/**
 * @internal
 */
export declare type DocumentListPaneProps = ComponentProps<typeof DocumentListPane>

/**
 * Interface for the document list builder (focused on the document pane)
 *
 * @public */
export declare interface DocumentNode extends StructureNode {
  /**
   * Document children. See {@link Child}
   */
  child?: Child
  /**
   * Options for the document pane
   */
  options: {
    /** Document Id */
    id: string
    /** Document Type */
    type?: string
    /** Document Template */
    template?: string
    /** Template parameters */
    templateParameters?: {
      [key: string]: any
    }
  }
  /**
   * View array for the document pane. See {@link View}
   */
  views: View[]
}

/**
 * Interface for options of Partial Documents. See {@link PartialDocumentNode}
 *
 * @public */
export declare interface DocumentOptions {
  /** Document Id */
  id: string
  /** Document Type */
  type: string
  /** Document Template */
  template?: string
  /** Template parameters */
  templateParameters?: Record<string, unknown>
}

/**
 * @internal
 */
export declare const DocumentPane: NamedExoticComponent<DocumentPaneProviderProps>

/** @internal */
declare interface DocumentPaneContextValue {
  actions: DocumentActionComponent[] | null
  activeViewId: string | null
  badges: DocumentBadgeComponent[] | null
  changesOpen: boolean
  closeInspector: (inspectorName?: string) => void
  collapsedFieldSets: StateTree<boolean> | undefined
  collapsedPaths: StateTree<boolean> | undefined
  compareValue: Partial<SanityDocument> | null
  connectionState: 'connecting' | 'reconnecting' | 'connected'
  displayed: Partial<SanityDocument> | null
  documentId: string
  documentIdRaw: string
  documentType: string
  editState: EditStateFor | null
  fieldActions: DocumentFieldAction[]
  focusPath: Path
  index: number
  inspectOpen: boolean
  inspector: DocumentInspector | null
  inspectors: DocumentInspector[]
  menuItemGroups: PaneMenuItemGroup[]
  onBlur: (blurredPath: Path) => void
  onChange: (event: PatchEvent) => void
  onFocus: (pathOrEvent: Path) => void
  onHistoryClose: () => void
  onHistoryOpen: () => void
  onInspectClose: () => void
  onMenuAction: (item: PaneMenuItem) => void
  onPaneClose: () => void
  onPaneSplit?: () => void
  onPathOpen: (path: Path) => void
  onSetActiveFieldGroup: (path: Path, groupName: string) => void
  onSetCollapsedPath: (path: Path, expanded: boolean) => void
  onSetCollapsedFieldSet: (path: Path, expanded: boolean) => void
  openInspector: (inspectorName: string, paneParams?: Record<string, string>) => void
  openPath: Path
  paneKey: string
  previewUrl?: string | null
  ready: boolean
  schemaType: ObjectSchemaType
  /**
   * @deprecated not used anymore
   * */
  setTimelineMode?: undefined
  /**
   * @deprecated not used anymore
   * */
  timelineMode?: undefined
  setTimelineRange(since: string | null, rev: string | null): void
  setIsDeleting: (state: boolean) => void
  timelineError: Error | null
  /**
   * Soon to be deprecated with the upcoming `releases` changes.
   */
  timelineStore?: TimelineStore
  title: string | null
  validation: ValidationMarker[]
  value: SanityDocumentLike
  views: View[]
  formState: DocumentFormNode | null
  /**
   * TODO: COREL - Remove this after updating sanity-assist to use <PerspectiveProvider>
   *
   * @deprecated use `usePerspective()` instead
   */
  selectedReleaseId: ReleaseId | undefined
  permissions?: PermissionCheckResult | null
  isDeleting: boolean
  isDeleted: boolean
  isPermissionsLoading: boolean
  isInitialValueLoading?: boolean
  unstable_languageFilter: DocumentLanguageFilterComponent[]
  revisionId: string | null
  lastNonDeletedRevId: string | null
}

/** @internal */
export declare interface DocumentPaneNode extends BaseResolvedPaneNode<'document'> {
  options: {
    id: string
    type: string
    template?: string
    templateParameters?: Record<string, unknown>
  }
  source?: string
  views?: View[]
}

declare type DocumentPaneOptions = DocumentPaneNode['options']

/**
 * @internal
 */
export declare const DocumentPaneProvider: MemoExoticComponent<
  (props: DocumentPaneProviderProps) => JSX_2.Element
>

/** @internal */
export declare type DocumentPaneProviderProps = {
  children?: React.ReactNode
  onFocusPath?: (path: Path) => void
} & BaseStructureToolPaneProps<'document'>

/**
 * Class for building a document type list
 *
 * @public
 */
export declare class DocumentTypeListBuilder extends DocumentListBuilder {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Document list options. See {@link PartialDocumentList} */
  protected spec: PartialDocumentList
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: DocumentListInput,
  )
  /**
   * Set Document type list child
   * @param child - Child component. See {@link Child}
   * @returns document type list builder based on child component provided without default intent handler. See {@link DocumentTypeListBuilder}
   */
  child(child: Child): DocumentTypeListBuilder
  /** Clone Document type list builder (allows for options overriding)
   * @param withSpec - Document type list builder options. See {@link PartialDocumentList}
   * @returns document type list builder. See {@link DocumentTypeListBuilder}
   */
  clone(withSpec?: PartialDocumentList): DocumentTypeListBuilder
  /** Clone Document type list builder (allows for options overriding) and remove default intent handler
   * @param withSpec - Document type list builder options. See {@link PartialDocumentList}
   * @returns document type list builder without default intent handler. See {@link DocumentTypeListBuilder}
   */
  cloneWithoutDefaultIntentHandler(withSpec?: PartialDocumentList): DocumentTypeListBuilder
}

/**
 * Interface for document type list input
 *
 * @public
 */
export declare interface DocumentTypeListInput extends Partial<GenericListInput> {
  /** Document type list input schema type. See {@link SchemaType} */
  schemaType: SchemaType | string
}

/**
 * Interface for Editor node
 *
 * @public */
export declare interface EditorNode extends StructureNode {
  /** Editor child. See {@link Child} */
  child?: Child
  /** Editor options */
  options: {
    /** Editor ID */
    id: string
    /** Editor type */
    type?: string
    /** Editor template */
    template?: string
    /** Template parameters */
    templateParameters?: {
      [key: string]: any
    }
  }
}

/**
 * @hidden
 * @beta */
export declare interface EditReferenceOptions {
  parentRefPath: Path
  id: string
  type: string
  version?: ReleaseId
  template: {
    id: string
    params?: Record<string, string | number | boolean>
  }
}

/** @internal */
export declare const form: (spec?: Partial<FormView>) => FormViewBuilder

/**
 * Interface for form views.
 *
 * @public */
export declare interface FormView extends BaseView {
  type: 'form'
}

/**
 * Class for building a form view.
 *
 * @public */
export declare class FormViewBuilder extends GenericViewBuilder<
  Partial<BaseView>,
  FormViewBuilder
> {
  /** Document list options. See {@link FormView} */
  protected spec: Partial<FormView>
  constructor(spec?: Partial<FormView>)
  /**
   * Serialize Form view builder
   * @param options - Serialize options. See {@link SerializeOptions}
   * @returns form view builder based on path provided in options. See {@link FormView}
   */
  serialize(options?: SerializeOptions): FormView
  /**
   * Clone Form view builder (allows for options overriding)
   * @param withSpec - Partial form view builder options. See {@link FormView}
   * @returns form view builder. See {@link FormViewBuilder}
   */
  clone(withSpec?: Partial<FormView>): FormViewBuilder
}

/**
 * Interface for generic list
 *
 * @public
 */
export declare interface GenericList extends BaseGenericList {
  /** List type */
  type: string
  /** List menu items array. See {@link MenuItem} */
  menuItems: MenuItem[]
  /** List menu item groups array. See {@link MenuItemGroup} */
  menuItemGroups: MenuItemGroup[]
}

/**
 * Class for building generic lists
 *
 * @public
 */
export declare abstract class GenericListBuilder<TList extends BuildableGenericList, ConcreteImpl>
  implements Serializable<GenericList>
{
  /** Check if initial value templates are set */
  protected initialValueTemplatesSpecified: boolean
  /** Generic list option object */
  protected spec: TList
  /** Set generic list ID
   * @param id - generic list ID
   * @returns generic list builder based on ID provided.
   */
  id(id: string): ConcreteImpl
  /** Get generic list ID
   * @returns generic list ID
   */
  getId(): TList['id']
  /** Set generic list title
   * @param title - generic list title
   * @returns generic list builder based on title and ID provided.
   */
  title(title: string): ConcreteImpl
  /** Get generic list title
   * @returns generic list title
   */
  getTitle(): TList['title']
  /** Set the i18n key and namespace used to populate the localized title.
   * @param i18n - the key and namespaced used to populate the localized title.
   * @returns component builder based on i18n key and ns provided
   */
  i18n(i18n: I18nTextRecord<'title'>): ConcreteImpl
  /** Get i18n key and namespace used to populate the localized title
   * @returns the i18n key and namespace used to populate the localized title
   */
  getI18n(): TList['i18n']
  /** Set generic list layout
   * @param defaultLayout - generic list layout key.
   * @returns generic list builder based on layout provided.
   */
  defaultLayout(defaultLayout: PreviewLayoutKey): ConcreteImpl
  /** Get generic list layout
   * @returns generic list layout
   */
  getDefaultLayout(): TList['defaultLayout']
  /** Set generic list menu items
   * @param menuItems - generic list menu items. See {@link MenuItem} and {@link MenuItemBuilder}
   * @returns generic list builder based on menu items provided.
   */
  menuItems(menuItems: (MenuItem | MenuItemBuilder)[] | undefined): ConcreteImpl
  /** Get generic list menu items
   * @returns generic list menu items
   */
  getMenuItems(): TList['menuItems']
  /** Set generic list menu item groups
   * @param menuItemGroups - generic list menu item groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder}
   * @returns generic list builder based on menu item groups provided.
   */
  menuItemGroups(menuItemGroups: (MenuItemGroup | MenuItemGroupBuilder)[]): ConcreteImpl
  /** Get generic list menu item groups
   * @returns generic list menu item groups
   */
  getMenuItemGroups(): TList['menuItemGroups']
  /** Set generic list child
   * @param child - generic list child. See {@link Child}
   * @returns generic list builder based on child provided (clone).
   */
  child(child: Child): ConcreteImpl
  /** Get generic list child
   * @returns generic list child
   */
  getChild(): TList['child']
  /** Set generic list can handle intent
   * @param canHandleIntent - generic list intent checker. See {@link IntentChecker}
   * @returns generic list builder based on can handle intent provided.
   */
  canHandleIntent(canHandleIntent?: IntentChecker): ConcreteImpl
  /** Get generic list can handle intent
   * @returns generic list can handle intent
   */
  getCanHandleIntent(): TList['canHandleIntent']
  /** Set generic list display options
   * @param enabled - allow / disallow for showing icons
   * @returns generic list builder based on display options (showIcons) provided.
   */
  showIcons(enabled?: boolean): ConcreteImpl
  /** Get generic list display options
   * @returns generic list display options (specifically showIcons)
   */
  getShowIcons(): boolean | undefined
  /** Set generic list initial value templates
   * @param templates - generic list initial value templates. See {@link InitialValueTemplateItemBuilder}
   * @returns generic list builder based on templates provided.
   */
  initialValueTemplates(
    templates:
      | InitialValueTemplateItem
      | InitialValueTemplateItemBuilder
      | Array<InitialValueTemplateItem | InitialValueTemplateItemBuilder>,
  ): ConcreteImpl
  /** Get generic list initial value templates
   * @returns generic list initial value templates
   */
  getInitialValueTemplates(): TList['initialValueTemplates']
  /** Serialize generic list
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns generic list object based on path provided in options. See {@link GenericList}
   */
  serialize(options?: SerializeOptions): GenericList
  /** Clone generic list builder (allows for options overriding)
   * @param _withSpec - generic list options.
   * @returns generic list builder.
   */
  abstract clone(_withSpec?: object): ConcreteImpl
}

/**
 * Interface for generic list input
 * Allows builders and only requires things not inferrable
 *
 * @public */
export declare interface GenericListInput extends StructureNode {
  /** Input id */
  id: string
  /** Input title */
  title: string
  /** Input menu items groups. See {@link MenuItem} and {@link MenuItemBuilder} */
  menuItems?: (MenuItem | MenuItemBuilder)[]
  /** Input menu items groups. See {@link MenuItemGroup} and {@link MenuItemGroupBuilder} */
  menuItemGroups?: (MenuItemGroup | MenuItemGroupBuilder)[]
  /** Input initial value array. See {@link InitialValueTemplateItem} and {@link InitialValueTemplateItemBuilder} */
  initialValueTemplates?: (InitialValueTemplateItem | InitialValueTemplateItemBuilder)[]
  /** Input default layout. */
  defaultLayout?: PreviewLayoutKey
  /** If input can handle intent. See {@link IntentChecker} */
  canHandleIntent?: IntentChecker
  /** Input child of type {@link Child} */
  child?: Child
}

/**
 * Class for building generic views.
 *
 * @public
 */
export declare abstract class GenericViewBuilder<TView extends Partial<BaseView>, ConcreteImpl>
  implements Serializable<BaseView>
{
  /** Generic view option object */
  protected spec: TView
  /** Set generic view ID
   * @param id - generic view ID
   * @returns generic view builder based on ID provided.
   */
  id(id: string): ConcreteImpl
  /** Get generic view ID
   * @returns generic view ID
   */
  getId(): TView['id']
  /** Set generic view title
   * @param title - generic view title
   * @returns generic view builder based on title provided and (if provided) its ID.
   */
  title(title: string): ConcreteImpl
  /** Get generic view title
   * @returns generic view title
   */
  getTitle(): TView['title']
  /** Set generic view icon
   * @param icon - generic view icon
   * @returns generic view builder based on icon provided.
   */
  icon(icon: React.ComponentType | React.ReactNode): ConcreteImpl
  /** Get generic view icon
   * @returns generic view icon
   */
  getIcon(): TView['icon']
  /** Serialize generic view
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns generic view object based on path provided in options. See {@link BaseView}
   */
  serialize(options?: SerializeOptions): BaseView
  /** Clone generic view builder (allows for options overriding)
   * @param withSpec - Partial generic view builder options. See {@link BaseView}
   * @returns Generic view builder.
   */
  abstract clone(withSpec?: Partial<BaseView>): ConcreteImpl
}

/** @internal */
export declare function getOrderingMenuItem(
  context: StructureContext,
  {by, title, i18n}: SortOrdering,
  extendedProjection?: string,
): MenuItemBuilder

/** @internal */
export declare function getOrderingMenuItemsForSchemaType(
  context: StructureContext,
  typeName: SchemaType | string,
): MenuItemBuilder[]

/** @internal */
export declare function getTypeNamesFromFilter(
  filter: string,
  params?: Record<string, unknown>,
): string[]

/** @internal */
export declare enum HELP_URL {
  ID_REQUIRED = 'structure-node-id-required',
  TITLE_REQUIRED = 'structure-title-required',
  FILTER_REQUIRED = 'structure-filter-required',
  INVALID_LIST_ITEM = 'structure-invalid-list-item',
  COMPONENT_REQUIRED = 'structure-view-component-required',
  DOCUMENT_ID_REQUIRED = 'structure-document-id-required',
  DOCUMENT_TYPE_REQUIRED = 'structure-document-type-required',
  SCHEMA_TYPE_REQUIRED = 'structure-schema-type-required',
  SCHEMA_TYPE_NOT_FOUND = 'structure-schema-type-not-found',
  LIST_ITEMS_MUST_BE_ARRAY = 'structure-list-items-must-be-array',
  QUERY_PROVIDED_FOR_FILTER = 'structure-query-provided-for-filter',
  ACTION_OR_INTENT_REQUIRED = 'structure-action-or-intent-required',
  LIST_ITEM_IDS_MUST_BE_UNIQUE = 'structure-list-item-ids-must-be-unique',
  ACTION_AND_INTENT_MUTUALLY_EXCLUSIVE = 'structure-action-and-intent-mutually-exclusive',
  API_VERSION_REQUIRED_FOR_CUSTOM_FILTER = 'structure-api-version-required-for-custom-filter',
}

/**
 * A `InitialValueTemplateItemBuilder` is used to build a document node with an initial value set.
 *
 * @public
 */
export declare class InitialValueTemplateItemBuilder
  implements Serializable<InitialValueTemplateItem>
{
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Initial Value template item option object. See {@link InitialValueTemplateItem} */
  protected spec: Partial<InitialValueTemplateItem>
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: Partial<InitialValueTemplateItem>,
  )
  /** Set initial value template item builder ID
   * @param id - initial value template item ID
   * @returns initial value template item based on ID provided. See {@link InitialValueTemplateItemBuilder}
   */
  id(id: string): InitialValueTemplateItemBuilder
  /** Get initial value template item builder ID
   * @returns initial value template item ID. See {@link InitialValueTemplateItem}
   */
  getId(): Partial<InitialValueTemplateItem>['id']
  /** Set initial value template item title
   * @param title - initial value template item title
   * @returns initial value template item based on title provided. See {@link InitialValueTemplateItemBuilder}
   */
  title(title: string): InitialValueTemplateItemBuilder
  /** Get initial value template item title
   * @returns initial value template item title. See {@link InitialValueTemplateItem}
   */
  getTitle(): Partial<InitialValueTemplateItem>['title']
  /** Set initial value template item description
   * @param description - initial value template item description
   * @returns initial value template item builder based on description provided. See {@link InitialValueTemplateItemBuilder}
   */
  description(description: string): InitialValueTemplateItemBuilder
  /** Get initial value template item description
   * @returns initial value template item description. See {@link InitialValueTemplateItem}
   */
  getDescription(): Partial<InitialValueTemplateItem>['description']
  /** Set initial value template ID
   * @param templateId - initial value template item template ID
   * @returns initial value template item based builder on template ID provided. See {@link InitialValueTemplateItemBuilder}
   */
  templateId(templateId: string): InitialValueTemplateItemBuilder
  /** Get initial value template item template ID
   * @returns initial value template item ID. See {@link InitialValueTemplateItem}
   */
  getTemplateId(): Partial<InitialValueTemplateItem>['templateId']
  /** Get initial value template item template parameters
   * @param parameters - initial value template item parameters
   * @returns initial value template item builder based on parameters provided. See {@link InitialValueTemplateItemBuilder}
   */
  parameters(parameters: {[key: string]: any}): InitialValueTemplateItemBuilder
  /** Get initial value template item template parameters
   * @returns initial value template item parameters. See {@link InitialValueTemplateItem}
   */
  getParameters(): Partial<InitialValueTemplateItem>['parameters']
  /** Serialize initial value template item
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns initial value template item object based on the path, index and hint provided in options. See {@link InitialValueTemplateItem}
   */
  serialize({path, index, hint}?: SerializeOptions): InitialValueTemplateItem
  /** Clone generic view builder (allows for options overriding)
   * @param withSpec - initial value template item builder options. See {@link InitialValueTemplateItemBuilder}
   * @returns initial value template item builder based on the context and options provided. See {@link InitialValueTemplateItemBuilder}
   */
  clone(withSpec?: Partial<InitialValueTemplateItem>): InitialValueTemplateItemBuilder
}

/**
 * Interface for intents
 * @public */
export declare interface Intent {
  /** Intent type */
  type: string
  /** Intent parameters. See {@link IntentParams}
   */
  params?: IntentParams
  searchParams?: SearchParam[]
}

/**
 * Interface for intent checker
 *
 * @public
 */
export declare interface IntentChecker {
  (
    /** Intent name */
    intentName: string,
    /** Intent checker parameter */
    params: {
      [key: string]: any
    },
    /** Structure context. See {@link StructureNode} */
    context: {
      pane: StructureNode
      index: number
    },
  ): boolean
  /** intent checker identify */
  identity?: symbol
}

/**
 * Intent parameters (json)
 *
 * @public
 */
export declare type IntentJsonParams = {
  [key: string]: any
}

/**
 * Intent parameters
 * See {@link structure.BaseIntentParams} and {@link structure.IntentJsonParams}
 *
 * @public
 */
export declare type IntentParams = BaseIntentParams | [BaseIntentParams, IntentJsonParams]

/** @internal */
export declare function isDocumentListItem(item: unknown): item is DocumentListItem

/**
 * Item Child. See {@link CollectionBuilder} and {@link Collection}
 *
 * @public
 */
export declare type ItemChild = CollectionBuilder | Collection | undefined

/**
 * Interface for List
 *
 * @public
 */
export declare interface List extends GenericList {
  type: 'list'
  /** List items. See {@link ListItem} and {@link Divider} */
  items: (ListItem | Divider)[]
}

/**
 * A `ListBuilder` is used to build a list of items in the structure tool.
 *
 * @public */
export declare class ListBuilder extends GenericListBuilder<BuildableList, ListBuilder> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** buildable list option object. See {@link BuildableList} */
  protected spec: BuildableList
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: ListInput,
  )
  /**
   * Set list builder based on items provided
   * @param items - list items. See {@link ListItemBuilder}, {@link ListItem} and {@link Divider}
   * @returns list builder based on items provided. See {@link ListBuilder}
   */
  items(items: (ListItemBuilder | ListItem | Divider)[]): ListBuilder
  /** Get list builder items
   * @returns list items. See {@link BuildableList}
   */
  getItems(): BuildableList['items']
  /** Serialize list builder
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns list based on path in options. See {@link List}
   */
  serialize(options?: SerializeOptions): List
  /**
   * Clone list builder and return new list builder based on context and spec provided
   * @param withSpec - list options. See {@link BuildableList}
   * @returns new list builder based on context and spec provided. See {@link ListBuilder}
   */
  clone(withSpec?: BuildableList): ListBuilder
}

/**
 * Interface for list display options
 *
 * @public */
export declare interface ListDisplayOptions {
  /** Check if list display should show icons */
  showIcons?: boolean
}

/**
 * Interface for list input
 *
 * @public
 */
export declare interface ListInput extends GenericListInput {
  /** List input items array. See {@link ListItem}, {@link ListItemBuilder} and {@link Divider} */
  items?: (ListItem | ListItemBuilder | Divider)[]
}

/**
 * Interface for List Item
 *
 * @public */
export declare interface ListItem {
  /** List item id */
  id: string
  /** List item type */
  type: string
  /**
   * The i18n key and namespace used to populate the localized title. This is
   * the recommend way to set the title if you are localizing your studio.
   */
  i18n?: I18nTextRecord<'title'>
  /** List item title. Note that the `i18n` key and namespace will take precedence. */
  title?: string
  /** List item icon */
  icon?: React.ComponentType | React.ReactNode
  /** List item child. See {@link ListItemChild} */
  child?: ListItemChild
  /** List item display options. See {@link ListItemDisplayOptions} */
  displayOptions?: ListItemDisplayOptions
  /** List item schema type. See {@link SchemaType} */
  schemaType?: SchemaType
}

/**
 * Class for building list items
 *
 * @public */
export declare class ListItemBuilder implements Serializable<ListItem> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** List item option object. See {@link PartialListItem} */
  protected spec: PartialListItem
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: ListItemInput,
  )
  /**
   * Set list item ID
   * @returns list item builder based on ID provided. See {@link ListItemBuilder}
   */
  id(id: string): ListItemBuilder
  /**
   * Get list item ID
   * @returns list item ID. See {@link PartialListItem}
   */
  getId(): PartialListItem['id']
  /**
   * Set list item title
   * @returns list item builder based on title provided. See {@link ListItemBuilder}
   */
  title(title: string): ListItemBuilder
  /**
   * Get list item title
   * @returns list item title. See {@link PartialListItem}
   */
  getTitle(): PartialListItem['title']
  /** Set the i18n key and namespace used to populate the localized title.
   * @param i18n - the key and namespaced used to populate the localized title.
   * @returns component builder based on i18n key and ns provided
   */
  i18n(i18n: I18nTextRecord<'title'>): ListItemBuilder
  /** Get i18n key and namespace used to populate the localized title
   * @returns the i18n key and namespace used to populate the localized title
   */
  getI18n(): I18nTextRecord<'title'> | undefined
  /**
   * Set list item icon
   * @returns list item builder based on icon provided. See {@link ListItemBuilder}
   */
  icon(icon: React.ComponentType | React.ReactNode): ListItemBuilder
  /**
   * Set if list item should show icon
   * @returns list item builder based on showIcon provided. See {@link ListItemBuilder}
   */
  showIcon(enabled?: boolean): ListItemBuilder
  /**
   * Check if list item should show icon
   * @returns true if it should show the icon, false if not, undefined if not set
   */
  getShowIcon(): boolean | undefined
  /**
   *Get list item icon
   * @returns list item icon. See {@link PartialListItem}
   */
  getIcon(): PartialListItem['icon']
  /**
   * Set list item child
   * @param child - list item child. See {@link UnserializedListItemChild}
   * @returns list item builder based on child provided. See {@link ListItemBuilder}
   */
  child(child: UnserializedListItemChild): ListItemBuilder
  /**
   * Get list item child
   * @returns list item child. See {@link PartialListItem}
   */
  getChild(): PartialListItem['child']
  /**
   * Set list item schema type
   * @param schemaType - list item schema type. See {@link SchemaType}
   * @returns list item builder based on schema type provided. See {@link ListItemBuilder}
   */
  schemaType(schemaType: SchemaType | string): ListItemBuilder
  /**
   * Get list item schema type
   * @returns list item schema type. See {@link PartialListItem}
   */
  getSchemaType(): PartialListItem['schemaType']
  /** Serialize list item builder
   * @param options - serialization options. See {@link ListItemSerializeOptions}
   * @returns list item node based on path provided in options. See {@link ListItem}
   */
  serialize(options?: ListItemSerializeOptions): ListItem
  /** Clone list item builder
   * @param withSpec - partial list item options. See {@link PartialListItem}
   * @returns list item builder based on context and spec provided. See {@link ListItemBuilder}
   */
  clone(withSpec?: PartialListItem): ListItemBuilder
}

/**
 * Child of List Item
 * See {@link Collection}, {@link ChildResolver}, {@link ItemChild}
 * @public
 */
export declare type ListItemChild = Collection | ChildResolver | Observable<ItemChild> | undefined

/**
 * Interface for ist item display options
 *
 * @public */
export declare interface ListItemDisplayOptions {
  /** Check if list item display should show icon */
  showIcon?: boolean
}

/**
 * interface for list item input
 *
 * @public */
export declare interface ListItemInput {
  /** List item id */
  id: string
  /** List item title */
  title?: string
  /** List item icon */
  icon?: React.ComponentType | React.ReactNode
  /** List item child. See {@link ListItemChild} */
  child?: ListItemChild
  /** List item display options. See {@link ListItemDisplayOptions} */
  displayOptions?: ListItemDisplayOptions
  /** List item schema type. See {@link SchemaType} */
  schemaType?: SchemaType | string
}

/**
 * Interface for serialize list item options
 *
 * @public
 */
export declare interface ListItemSerializeOptions extends SerializeOptions {
  /** Check if list item title is optional */
  titleIsOptional?: boolean
}

/** @internal */
export declare interface ListPaneNode extends BaseResolvedPaneNode<'list'> {
  defaultLayout?: GeneralPreviewLayoutKey
  displayOptions?: {
    showIcons?: boolean
  }
  items?: Array<PaneListItem | PaneListItemDivider>
  source?: string
}

/** @internal */
export declare function maybeSerializeInitialValueTemplateItem(
  item: InitialValueTemplateItem | InitialValueTemplateItemBuilder,
  index: number,
  path: SerializePath,
): InitialValueTemplateItem

/** @internal */
export declare function maybeSerializeMenuItem(
  item: MenuItem | MenuItemBuilder,
  index: number,
  path: SerializePath,
): MenuItem

/** @internal */
export declare function maybeSerializeMenuItemGroup(
  item: MenuItemGroup | MenuItemGroupBuilder,
  index: number,
  path: SerializePath,
): MenuItemGroup

/** @internal */
export declare function maybeSerializeView(
  item: View | Serializable<View>,
  index: number,
  path: SerializePath,
): View

/**
 * Interface for menu items
 *
 * @public */
declare interface MenuItem {
  /**
   * The i18n key and namespace used to populate the localized title. This is
   * the recommend way to set the title if you are localizing your studio.
   */
  i18n?: I18nTextRecord<'title'>
  /**
   * Menu Item title. Note that the `i18n` configuration will take
   * precedence and this title is left here as a fallback if no i18n key is
   * provided and compatibility with older plugins
   */
  title: string
  /** Menu Item action */
  action?: MenuItemActionType
  /** Menu Item intent */
  intent?: Intent
  /** Menu Item group */
  group?: string
  /** Menu Item icon */
  icon?: React.ComponentType | React.ReactNode
  /** Menu Item parameters. See {@link MenuItemParamsType} */
  params?: MenuItemParamsType
  /** Determine if it will show the MenuItem as action */
  showAsAction?: boolean
}
export {MenuItem}
export {MenuItem as StructureToolMenuItem}

/**
 * Menu item action type
 * @public */
export declare type MenuItemActionType =
  | string
  | ((params: Record<string, string> | undefined, scope?: any) => void)

/**
 * Class for building menu items.
 *
 * @public */
export declare class MenuItemBuilder implements Serializable<MenuItem> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** menu item option object. See {@link PartialMenuItem} */
  protected spec: PartialMenuItem
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: MenuItem,
  )
  /**
   * Set menu item action
   * @param action - menu item action. See {@link MenuItemActionType}
   * @returns menu item builder based on action provided. See {@link MenuItemBuilder}
   */
  action(action: MenuItemActionType): MenuItemBuilder
  /**
   * Get menu item action
   * @returns menu item builder action. See {@link PartialMenuItem}
   */
  getAction(): PartialMenuItem['action']
  /**
   * Set menu item intent
   * @param intent - menu item intent. See {@link Intent}
   * @returns menu item builder based on intent provided. See {@link MenuItemBuilder}
   */
  intent(intent: Intent): MenuItemBuilder
  /**
   * Get menu item intent
   * @returns menu item intent. See {@link PartialMenuItem}
   */
  getIntent(): PartialMenuItem['intent']
  /**
   * Set menu item title
   * @param title - menu item title
   * @returns menu item builder based on title provided. See {@link MenuItemBuilder}
   */
  title(title: string): MenuItemBuilder
  /**
   * Get menu item title. Note that the `i18n` configuration will take
   * precedence and this title is left here for compatibility.
   * @returns menu item title
   */
  getTitle(): string | undefined
  /**
   * Set the i18n key and namespace used to populate the localized title.
   * @param i18n - object with i18n key and related namespace
   * @returns menu item builder based on i18n config provided. See {@link MenuItemBuilder}
   */
  i18n(i18n: I18nTextRecord<'title'>): MenuItemBuilder
  /**
   * Get the i18n key and namespace used to populate the localized title.
   * @returns the i18n key and namespace used to populate the localized title.
   */
  getI18n(): I18nTextRecord<'title'> | undefined
  /**
   * Set menu item group
   * @param group - menu item group
   * @returns menu item builder based on group provided. See {@link MenuItemBuilder}
   */
  group(group: string): MenuItemBuilder
  /**
   * Get menu item group
   * @returns menu item group. See {@link PartialMenuItem}
   */
  getGroup(): PartialMenuItem['group']
  /**
   * Set menu item icon
   * @param icon - menu item icon
   * @returns menu item builder based on icon provided. See {@link MenuItemBuilder}
   */
  icon(icon: React.ComponentType | React.ReactNode): MenuItemBuilder
  /**
   * Get menu item icon
   * @returns menu item icon. See {@link PartialMenuItem}
   */
  getIcon(): PartialMenuItem['icon']
  /**
   * Set menu item parameters
   * @param params - menu item parameters. See {@link MenuItemParamsType}
   * @returns menu item builder based on parameters provided. See {@link MenuItemBuilder}
   */
  params(params: MenuItemParamsType): MenuItemBuilder
  /**
   * Get meny item parameters
   * @returns menu item parameters. See {@link PartialMenuItem}
   */
  getParams(): PartialMenuItem['params']
  /**
   * Set menu item to show as action
   * @param showAsAction - determine if menu item should show as action
   * @returns menu item builder based on if it should show as action. See {@link MenuItemBuilder}
   */
  showAsAction(showAsAction?: boolean): MenuItemBuilder
  /**
   * Check if menu item should show as action
   * @returns true if menu item should show as action, false if not. See {@link PartialMenuItem}
   */
  getShowAsAction(): PartialMenuItem['showAsAction']
  /** Serialize menu item builder
   * @param options - serialization options. See {@link SerializeOptions}
   * @returns menu item node based on path provided in options. See {@link MenuItem}
   */
  serialize(options?: SerializeOptions): MenuItem
  /** Clone menu item builder
   * @param withSpec - menu item options. See {@link PartialMenuItem}
   * @returns menu item builder based on context and spec provided. See {@link MenuItemBuilder}
   */
  clone(withSpec?: PartialMenuItem): MenuItemBuilder
}

/**
 * Interface for menu item groups
 * @public
 */
export declare interface MenuItemGroup {
  /** Menu group Id */
  id: string
  /** Menu group title */
  title: string
  i18n?: I18nTextRecord<'title'>
}

/**
 * Class for building menu item groups.
 *
 * @public
 */
export declare class MenuItemGroupBuilder implements Serializable<MenuItemGroup> {
  /**
   * Structure context. See {@link StructureContext}
   */
  protected _context: StructureContext
  /** Menu item group ID */
  protected _id: string
  /** Menu item group title */
  protected _title: string
  protected _i18n?: I18nTextRecord<'title'>
  constructor(
    /**
     * Structure context. See {@link StructureContext}
     */
    _context: StructureContext,
    spec?: MenuItemGroup,
  )
  /**
   * Set menu item group ID
   * @param id - menu item group ID
   * @returns menu item group builder based on ID provided. See {@link MenuItemGroupBuilder}
   */
  id(id: string): MenuItemGroupBuilder
  /**
   * Get menu item group ID
   * @returns menu item group ID
   */
  getId(): string
  /**
   * Set menu item group title
   * @param title - menu item group title
   * @returns menu item group builder based on title provided. See {@link MenuItemGroupBuilder}
   */
  title(title: string): MenuItemGroupBuilder
  /**
   * Get menu item group title
   * @returns menu item group title
   */
  getTitle(): string
  /**
   * Set the i18n key and namespace used to populate the localized title.
   * @param i18n - object with i18n key and related namespace
   * @returns menu item group builder based on i18n info provided. See {@link MenuItemGroupBuilder}
   */
  i18n(i18n: I18nTextRecord<'title'>): MenuItemGroupBuilder
  /**
   * Get the i18n key and namespace used to populate the localized title.
   * @returns the i18n key and namespace used to populate the localized title.
   */
  getI18n(): I18nTextRecord<'title'> | undefined
  /**
   * Serialize menu item group builder
   * @param options - serialization options (path). See {@link SerializeOptions}
   * @returns menu item group based on path provided in options. See {@link MenuItemGroup}
   */
  serialize(options?: SerializeOptions): MenuItemGroup
}

/**
 * Menu items parameters
 *
 * @public */
export declare type MenuItemParamsType = Record<string, string | unknown | undefined>

/** @internal */
export declare function menuItemsFromInitialValueTemplateItems(
  context: StructureContext,
  templateItems: InitialValueTemplateItem[],
): MenuItem[]

/**
 * @hidden
 * @internal
 */
export declare const Pane: ForwardRefExoticComponent<
  Omit<
    PaneProps &
      Omit<CardProps, 'as' | 'overflow'> &
      Omit<HTMLProps<HTMLDivElement>, 'id' | 'style' | 'hidden' | 'as' | 'height'>,
    'ref'
  > &
    RefAttributes<HTMLDivElement>
>

/**
 * @hidden
 * @internal
 */
export declare const PaneContent: ForwardRefExoticComponent<
  PaneContentProps &
    Omit<HTMLProps<HTMLDivElement>, 'ref' | 'as' | 'height'> &
    RefAttributes<HTMLDivElement>
>

declare interface PaneContentProps {
  as?: ElementType | keyof React.JSX.IntrinsicElements
  overflow?: BoxOverflow
  padding?: number | number[]
}

/**
 *
 * @hidden
 * @beta This API will change. DO NOT USE IN PRODUCTION.
 */
export declare function PaneLayout(
  props: PaneLayoutProps &
    CardProps &
    Omit<HTMLProps<HTMLDivElement>, 'as' | 'height' | 'ref' | 'wrap'>,
): JSX_2.Element

/**
 *
 * @hidden
 * @beta This API will change. DO NOT USE IN PRODUCTION.
 */
declare interface PaneLayoutProps {
  minWidth?: number
  onCollapse?: () => void
  onExpand?: () => void
}

/** @internal */
export declare interface PaneListItem<TParams = unknown> {
  type: 'listItem'
  id: string
  _id?: string
  schemaType?: SchemaType
  title: string
  i18n?: I18nTextRecord<'title'>
  icon?: React.ComponentType | false
  displayOptions?: {
    showIcon?: boolean
  }
  action?: (t: TParams) => unknown
  params?: TParams
}

/** @internal */
export declare interface PaneListItemDivider {
  type: 'divider'
}

/**
 * Represents what can be passed into `menuItems` inside of structure-tool panes
 *
 * @see BaseResolvedPaneNode
 *
 * @internal
 */
export declare interface PaneMenuItem extends MenuItem {
  isDisabled?: boolean
  shortcut?: string
  selected?: boolean
  tone?: 'primary' | 'positive' | 'caution' | 'critical'
}

/** @internal */
export declare interface PaneMenuItemGroup {
  id: string
  title?: string
  i18n?: I18nTextRecord<'title'>
}

/** @internal */
export declare type PaneNode =
  | CustomComponentPaneNode
  | DocumentPaneNode
  | DocumentListPaneNode
  | ListPaneNode

/** @internal */
export declare type PaneNodeResolver = (
  id: string,
  context: RouterPaneSiblingContext,
) => UnresolvedPaneNode

declare interface PaneProps {
  children?: ReactNode
  currentMinWidth?: number
  currentMaxWidth?: number
  flex?: number
  id: string
  minWidth?: number
  maxWidth?: number
  selected?: boolean
}

export {PaneRouterContext}

/**
 * @hidden
 * @beta */
export declare interface PaneRouterContextValue {
  /**
   * Zero-based index (position) of pane, visually
   */
  index: number
  /**
   * Zero-based index of pane group (within URL structure)
   */
  groupIndex: number
  /**
   * Zero-based index of pane within sibling group
   */
  siblingIndex: number
  /**
   * Payload of the current pane
   */
  payload?: unknown
  /**
   * Params of the current pane
   */
  params?: RouterPaneSibling['params']
  /**
   * Whether or not the pane has any siblings (within the same group)
   */
  hasGroupSiblings: boolean
  /**
   * The length of the current group
   */
  groupLength: number
  /**
   * Current router state for the "panes" property
   */
  routerPanesState: RouterPanes
  /**
   * Curried StateLink that passes the correct state automatically
   */
  ChildLink: ComponentType<ChildLinkProps>
  /**
   * Curried StateLink that pops off the last pane group
   */
  BackLink?: ComponentType<BackLinkProps>
  /**
   * A specialized `ChildLink` that takes in the needed props to open a
   * referenced document to the right
   */
  ReferenceChildLink: ComponentType<ReferenceChildLinkProps>
  /**
   * Similar to `ReferenceChildLink` expect without the wrapping component
   */
  handleEditReference: (options: EditReferenceOptions) => void
  /**
   * Curried StateLink that passed the correct state, but merges params/payload
   */
  ParameterizedLink: ComponentType<ParameterizedLinkProps>
  /**
   * Replaces the current pane with a new one
   */
  replaceCurrent: (pane: {id?: string; payload?: unknown; params?: Record<string, string>}) => void
  /**
   * Removes the current pane from the group
   */
  closeCurrent: () => void
  /**
   * Removes all panes to the right including current pane
   */
  closeCurrentAndAfter: (expandLast?: boolean) => void
  /**
   * Duplicate the current pane, with optional overrides for item ID and parameters
   */
  duplicateCurrent: (pane?: {payload?: unknown; params?: Record<string, string>}) => void
  /**
   * Set the current "view" for the pane
   */
  setView: (viewId: string | null) => void
  /**
   * Set the parameters for the current pane
   */
  setParams: (params: Record<string, string | undefined>) => void
  /**
   * Set the payload for the current pane
   */
  setPayload: (payload: unknown) => void
  /**
   * A function that creates a path with the given parameters without navigating to it.
   * Useful for creating links that can be e.g. copied to clipboard and shared.
   */
  createPathWithParams: (params: Record<string, string | undefined>) => string
  /**
   * Proxied navigation to a given intent. Consider just exposing `router` instead?
   */
  navigateIntent: (
    intentName: string,
    params: Record<string, string>,
    options?: {
      replace?: boolean
    },
  ) => void
}

/**
 * @hidden
 * @beta */
export declare interface ParameterizedLinkProps {
  params?: Record<string, string>
  payload?: unknown
}

/**
 * Partial document list
 *
 * @public
 */
export declare interface PartialDocumentList extends BuildableGenericList {
  /** Document list options. See {@link DocumentListOptions} */
  options?: DocumentListOptions
  /** Schema type name */
  schemaTypeName?: string
}

/**
 * Partial document list item
 *
 * @public
 */
export declare type PartialDocumentListItem = Partial<UnserializedListItem>

/**
 * Interface for partial document (focused on the document pane)
 *
 * @public */
export declare interface PartialDocumentNode {
  /** Document Id */
  id?: string
  /** Document title */
  title?: string
  /** I18n key and namespace used to populate the localized title */
  i18n?: I18nTextRecord<'title'>
  /** Document children of type {@link Child} */
  child?: Child
  /**
   * Views for the document pane. See {@link ViewBuilder} and {@link View}
   */
  views?: (View | ViewBuilder)[]
  /**
   * Document options. See {@link DocumentOptions}
   */
  options?: Partial<DocumentOptions>
}

/**
 * Partial list item. See {@link UnserializedListItem}
 *
 * @public */
export declare type PartialListItem = Partial<UnserializedListItem>

/**
 * Partial menu items
 * @public
 */
export declare type PartialMenuItem = Partial<MenuItem>

/**
 * @hidden
 * @beta */
export declare interface ReferenceChildLinkProps {
  documentId: string
  documentType: string
  parentRefPath: Path
  template?: {
    id: string
    params?: Record<string, string | number | boolean>
  }
  children: ReactNode
}

/**
 * Represents a "pane group" in the router.
 *
 * @see RouterPanes
 *
 *
 * @hidden
 * @beta
 */
export declare type RouterPaneGroup = RouterPaneSibling[]

/**
 * Represents the state of the `panes` inside the structure-tool router
 *
 * - The structure tool stores the state of the current panes inside of the router.
 * - The panes are stored in groups delimited in the URL by `;`.
 * - In each group, there can be one or more sibling (aka split) panes delimited
 *   by `|`.
 * - Each item pane can contain it's own parameters and payloads
 * - Per item pane in each group, if not specified separately, the ID, params,
 *   and payload will be inherited from the first item pane in the pane group
 *   (unless it's an `exclusiveParam`)
 *
 * E.g. `/structure/books;book-123|,view=preview` will parse to:
 *
 * ```js
 * [
 *   // first pane group
 *   [{id: 'book'}],
 *
 *   // second pane group
 *   [
 *     [
 *       // first pane item
 *       {id: 'book-123'},
 *       // second pane item
 *       {id: 'book-123', params: {view: 'preview'}},
 *     ],
 *   ],
 * ]
 * ```
 *
 * @hidden
 * @beta
 */
export declare type RouterPanes = RouterPaneGroup[]

/**
 * Represents a "sibling pane" or "split pane" in the router.
 *
 * @see RouterPanes
 *
 *
 * @hidden
 * @beta
 */
export declare interface RouterPaneSibling {
  id: string
  params?: Record<string, string | undefined>
  payload?: unknown
}

/**
 * Passed as the second argument to the item of resolving pane children
 *
 * @see RouterPanes
 *
 * @internal
 */
export declare interface RouterPaneSiblingContext {
  id: string
  parent: PaneNode | null
  index: number
  splitIndex: number
  path: string[]
  params: Record<string, string | undefined>
  payload: unknown
  structureContext: StructureContext
  serializeOptions?: {
    path: (string | number)[]
    index?: number
    hint?: string
  }
}

/**
 *  A interface for serializing a structure node to a plain JavaScript object.
 *
 * @public
 */
export declare interface Serializable<T> {
  serialize(options: SerializeOptions): T
}

/** @internal */
export declare type SerializablePaneNode = {
  serialize(context: RouterPaneSiblingContext): UnresolvedPaneNode
}

/** @internal */
export declare class SerializeError extends Error {
  readonly path: SerializePath
  helpId?: HELP_URL
  constructor(
    message: string,
    parentPath: SerializePath,
    pathSegment: string | number | undefined,
    hint?: string,
  )
  withHelpUrl(id: HELP_URL): SerializeError
}

/**
 * Interface for seraializing a structure node
 * @public */
export declare interface SerializeOptions {
  /** path. See {@link SerializePath} */
  path: SerializePath
  /** index */
  index?: number
  /** hint */
  hint?: string
}

/**
 * Path of a serialized structure node
 *
 * @public
 */
export declare type SerializePath = (string | number)[]

/** @internal */
export declare const shallowIntentChecker: IntentChecker

/** @internal */
export declare interface SortMenuItem extends MenuItem {
  params: {
    by: SortOrderingItem[]
  }
}

/**
 * Interface for the structure builder.
 *
 * @public
 */
export declare interface StructureBuilder {
  /**
   * @internal
   */
  component: (spec?: ComponentInput | UserComponent) => ComponentBuilder
  /** By giving an object of options with documentID and its schema type receive the the respective Document builder
   * @param options - an object holding the documentId and schemaType for the document node being resolved.
   * @returns a Document builder. See {@link DocumentBuilder}
   */
  defaultDocument: (options: {documentId?: string; schemaType: string}) => DocumentBuilder
  /** Get an array of Item builders that take Initial Value template into consideration
   * @returns an array of initial value template item builders. See {@link ListItemBuilder}
   */
  defaultInitialValueTemplateItems: () => InitialValueTemplateItemBuilder[]
  /** Get the default List builder
   * @returns a List builder. See {@link ListBuilder}
   */
  defaults: () => ListBuilder
  /** Get a structure Divider
   * @returns a Divider. See {@link Divider}
   */
  divider: () => Divider
  /** By giving a partial Document Node receive the respective Document Builder
   * @param spec - a partial document node. See {@link PartialDocumentNode}
   * @returns a Document builder. See {@link DocumentBuilder}
   */
  document: (spec?: PartialDocumentNode) => DocumentBuilder
  /** By giving a Document List Input receive the respective Document List Builder
   * @param spec - a document list input. See {@link DocumentListInput}
   * @returns a Document List builder. See {@link DocumentListBuilder}
   */
  documentList: (spec?: DocumentListInput) => DocumentListBuilder
  /** By giving a Document List Item Input receive the respective Document List Item builder
   * @param spec - a document list item input. See {@link DocumentListItemInput}
   * @returns a Document List Item builder. See {@link DocumentListItemBuilder}
   */
  documentListItem: (spec?: DocumentListItemInput) => DocumentListItemBuilder
  /** By giving a type name or Document Type List Input receive the respective Document List Builder
   * @param typeNameOrSpec - a type name or a document type list input. See {@link DocumentTypeListInput}
   * @returns a Document List builder. See {@link DocumentListBuilder}
   */
  documentTypeList: (typeNameOrSpec: string | DocumentTypeListInput) => DocumentListBuilder
  /** By providing a type name receive a List Item builder
   * @param typeName - a type name
   * @returns a List Item builder. See {@link ListItemBuilder}
   */
  documentTypeListItem: (typeName: string) => ListItemBuilder
  /** Get an array of List Item builders
   * @returns an array of list item builders. See {@link ListItemBuilder}
   */
  documentTypeListItems: () => ListItemBuilder[]
  /** By giving a templateID and a set of parameters receive a Document builder that takes InitialValueTemplate into account
   * @param templateId - a template ID
   * @param parameters - an object of parameters
   * @returns a Document builder. See {@link DocumentBuilder}
   */
  documentWithInitialValueTemplate: (
    templateId: string,
    parameters?: Record<string, unknown>,
  ) => DocumentBuilder
  /** By giving a Editor Node receive the respective Document Builder
   * @param spec - an editor node. See {@link EditorNode}
   * @returns a Document builder. See {@link DocumentBuilder}
   */
  editor: (spec?: EditorNode) => DocumentBuilder
  /** By giving a templateID and a set of parameters receive an Item Builder that takes InitialValueTemplate into account
   * @param templateId - a template ID
   * @param parameters - an object of parameters
   * @returns an Item builder. See {@link ListItemBuilder}
   */
  initialValueTemplateItem: (
    templateId: string,
    parameters?: Record<string, any>,
  ) => InitialValueTemplateItemBuilder
  /** By giving a List Input receive the respective Builder, otherwise return default ListBuilder builder
   * @param spec - a list input. See {@link ListInput}
   * @returns a List builder. See {@link ListBuilder}
   */
  list: (spec?: ListInput) => ListBuilder
  /** By giving a List Item Input receive the respective Builder, otherwise return default ListItem builder
   * @param spec - a list item input. See {@link ListItemInput}
   * @returns a List Item builder. See {@link ListItemBuilder}
   */
  listItem: (spec?: ListItemInput) => ListItemBuilder
  /** By giving a Menu Item receive the respective Builder, otherwise return default MenuItem builder
   * @param spec - a menu item. See {@link MenuItem}
   * @returns a Menu Item builder. See {@link MenuItemBuilder}
   */
  menuItem: (spec?: MenuItem) => MenuItemBuilder
  /** By giving a Menu Item Group receive the respective Builder
   * @param spec - a menu item group. See {@link MenuItemGroup}
   * @returns a Menu Item Group builder. See {@link MenuItemGroupBuilder}
   */
  menuItemGroup: (spec?: MenuItemGroup) => MenuItemGroupBuilder
  /** By giving an array of initial value template receive an array of Menu Items, otherwise return default MenuItem builder
   * @param templateItems - an array of initial value template items. See {@link InitialValueTemplateItem}
   * @returns an array of Menu Items. See {@link MenuItem}
   */
  menuItemsFromInitialValueTemplateItems: (templateItems: InitialValueTemplateItem[]) => MenuItem[]
  /** By giving a sort ordering object receive a Menu Item Builder
   * @param ordering - a sort ordering object. See {@link SortOrdering}
   * @returns a Menu Item builder. See {@link MenuItemBuilder}
   */
  orderingMenuItem: (ordering: SortOrdering) => MenuItemBuilder
  /** By giving a type receive a list of Menu Items ordered by it
   * @param type - a type
   * @returns an array of Menu Items. See {@link MenuItem}
   */
  orderingMenuItemsForType: (type: string) => MenuItemBuilder[]
  /** View for structure */
  view: {
    /** form for view
     * @param spec - a partial form view. See {@link FormView}
     * @returns a Form View builder. See {@link FormViewBuilder}
     */
    form: (spec?: Partial<FormView>) => FormViewBuilder
    /** component for view
     * @param componentOrSpec - a partial component view or a React component. See {@link ComponentView}
     * @returns a Component View builder. See {@link ComponentViewBuilder}
     */
    component: (
      componentOrSpec?: Partial<ComponentView> | React.ComponentType<any>,
    ) => ComponentViewBuilder
  }
  /** Context for the structure builder. See {@link StructureContext} */
  context: StructureContext
}

/** @internal */
export declare interface StructureBuilderOptions {
  source: Source
  defaultDocumentNode?: DefaultDocumentNodeResolver
}

/**
 * Interface for the structure builder context.
 *
 * @public
 */
export declare interface StructureContext extends Source {
  /** Resolve document method
   * @returns a document node builder, or null/undefined if no document node should be returned.
   * See {@link DocumentBuilder}
   */
  resolveDocumentNode: (
    /** an object holding the documentId and schemaType for the document node being resolved. */
    options: {
      documentId?: string
      schemaType: string
    },
  ) => DocumentBuilder
  /** Get structure builder
   * @returns a structure builder. See {@link StructureBuilder}
   */
  getStructureBuilder: () => StructureBuilder
}

/**
 * The locale namespace for the structure tool
 *
 * @public
 */
export declare const structureLocaleNamespace: 'structure'

/**
 * @alpha
 */
export declare type StructureLocaleResourceKeys = keyof typeof structureLocaleStrings

/**
 * Defined locale strings for the structure tool, in US English.
 *
 * @internal
 */
declare const structureLocaleStrings: {
  /** Label for the "Copy Document URL" document action */
  'action.copy-document-url.label': string
  /** Tooltip when action button is disabled because the operation is not ready   */
  'action.delete.disabled.not-ready': string
  /** Tooltip when action button is disabled because the document does not exist */
  'action.delete.disabled.nothing-to-delete': string
  /** Label for the "Delete" document action button */
  'action.delete.label': string
  /** Label for the "Delete" document action while the document is being deleted */
  'action.delete.running.label': string
  /** Message prompting the user to confirm discarding changes */
  'action.discard-changes.confirm-dialog.confirm-discard-changes': string
  /** Tooltip when action is disabled because the document has no unpublished changes */
  'action.discard-changes.disabled.no-change': string
  /** Tooltip when action is disabled because the document is not published */
  'action.discard-changes.disabled.not-published': string
  /** Tooltip when action button is disabled because the operation is not ready   */
  'action.discard-changes.disabled.not-ready': string
  /** Label for the "Discard changes" document action */
  'action.discard-changes.label': string
  /** Tooltip when action is disabled because the operation is not ready   */
  'action.duplicate.disabled.not-ready': string
  /** Tooltip when action is disabled because the document doesn't exist */
  'action.duplicate.disabled.nothing-to-duplicate': string
  /** Label for the "Duplicate" document action */
  'action.duplicate.label': string
  /** Label for the "Duplicate" document action while the document is being duplicated */
  'action.duplicate.running.label': string
  /** Tooltip when publish button is disabled because the document is already published, and published time is unavailable.*/
  'action.publish.already-published.no-time-ago.tooltip': string
  /** Tooltip when publish button is disabled because the document is already published.*/
  'action.publish.already-published.tooltip': string
  /** Tooltip when action is disabled because the studio is not ready.*/
  'action.publish.disabled.not-ready': string
  /** Label for action when there are pending changes.*/
  'action.publish.draft.label': string
  /** Label for the "Publish" document action */
  'action.publish.label': string
  /** Label for the "Publish" document action when the document has live edit enabled.*/
  'action.publish.live-edit.label': string
  /** Fallback tooltip for the "Publish" document action when publish is invoked for a document with live edit enabled.*/
  'action.publish.live-edit.publish-disabled': string
  /** Tooltip for the "Publish" document action when the document has live edit enabled.*/
  'action.publish.live-edit.tooltip': string
  /** Tooltip when publish button is disabled because there are no changes.*/
  'action.publish.no-changes.tooltip': string
  /** Label for the "Publish" document action when there are no changes.*/
  'action.publish.published.label': string
  /** Label for the "Publish" document action while publish is being executed.*/
  'action.publish.running.label': string
  /** Tooltip when the "Publish" document action is disabled due to validation issues */
  'action.publish.validation-issues.tooltip': string
  /** Tooltip when publish button is waiting for validation and async tasks to complete.*/
  'action.publish.waiting': string
  /** Message prompting the user to confirm that they want to restore to an earlier revision*/
  'action.restore.confirm.message': string
  /** Fallback tooltip for when user is looking at the initial revision */
  'action.restore.disabled.cannot-restore-initial': string
  /** Label for the "Restore" document action */
  'action.restore.label': string
  /** Default tooltip for the action */
  'action.restore.tooltip': string
  /** Tooltip when action is disabled because the document is not already published */
  'action.unpublish.disabled.not-published': string
  /** Tooltip when action is disabled because the operation is not ready   */
  'action.unpublish.disabled.not-ready': string
  /** Label for the "Unpublish" document action */
  'action.unpublish.label': string
  /** Fallback tooltip for the Unpublish document action when publish is invoked for a document with live edit enabled.*/
  'action.unpublish.live-edit.disabled': string
  /** Description for the archived release banner, rendered when viewing the history of a version document from the publihed view */
  'banners.archived-release.description': string
  /** The text for the restore button on the deleted document banner */
  'banners.deleted-document-banner.restore-button.text': string
  /** The text content for the deleted document banner */
  'banners.deleted-document-banner.text': string
  /** The text content for the deprecated document type banner */
  'banners.deprecated-document-type-banner.text': string
  /** The text for publish action for discarding the version */
  'banners.live-edit-draft-banner.discard.tooltip': string
  /** The text for publish action for the draft banner */
  'banners.live-edit-draft-banner.publish.tooltip': string
  /** The text content for the live edit document when it's a draft */
  'banners.live-edit-draft-banner.text': string
  /** The text for the permission check banner if the user only has one role, and it does not allow publishing this document */
  'banners.permission-check-banner.missing-permission_create_one': string
  /** The text for the permission check banner if the user only has multiple roles, but they do not allow publishing this document */
  'banners.permission-check-banner.missing-permission_create_other': string
  /** The text for the permission check banner if the user only has one role, and it does not allow editing this document */
  'banners.permission-check-banner.missing-permission_update_one': string
  /** The text for the permission check banner if the user only has multiple roles, but they do not allow editing this document */
  'banners.permission-check-banner.missing-permission_update_other': string
  /** The pending text for the request permission button that appears for viewer roles */
  'banners.permission-check-banner.request-permission-button.sent': string
  /** The text for the request permission button that appears for viewer roles */
  'banners.permission-check-banner.request-permission-button.text': string
  /** Description for the archived release banner, rendered when viewing the history of a version document from the published view */
  'banners.published-release.description': string
  /** The text for the reload button */
  'banners.reference-changed-banner.reason-changed.reload-button.text': string
  /** The text for the reference change banner if the reason is that the reference has been changed */
  'banners.reference-changed-banner.reason-changed.text': string
  /** The text for the close button */
  'banners.reference-changed-banner.reason-removed.close-button.text': string
  /** The text for the reference change banner if the reason is that the reference has been deleted */
  'banners.reference-changed-banner.reason-removed.text': string
  /** The text that appears for the action button to add the current document to the global release */
  'banners.release.action.add-to-release': string
  /** The text that appears for the action button to add the current document to the global release */
  'banners.release.action.open-to-edit': string
  /** Toast description in case an error occurs when adding a document to a release  */
  'banners.release.error.description': string
  /** Toast title in case an error occurs when adding a document to a release  */
  'banners.release.error.title': string
  /** The text for the banner that appears when a document only has versions but is in a draft or published pinned release */
  'banners.release.navigate-to-edit-description': string
  /** The text for the banner that appears when a document only has versions but is in a draft or published pinned release */
  'banners.release.navigate-to-edit-description-end_one': string
  /** The text for the banner that appears when a document only has versions but is in a draft or published pinned release */
  'banners.release.navigate-to-edit-description-end_other': string
  /** The text for the banner that appears when there are multiple versions but no drafts or published, only one extra releases */
  'banners.release.navigate-to-edit-description-multiple_one': string
  /** The text for the banner that appears when there are multiple versions but no drafts or published, more than one extra releases */
  'banners.release.navigate-to-edit-description-multiple_other': string
  /** The text for the banner that appears when a document only has one version but is in a draft or published pinned release */
  'banners.release.navigate-to-edit-description-single': string
  /** The text for the banner that appears when a document is not in the current global release */
  'banners.release.not-in-release': string
  /** Description of toast that will appear in case of latency between the user adding a document to a release and the UI reflecting it */
  'banners.release.waiting.description': string
  /** Title of toast that will appear in case of latency between the user adding a document to a release and the UI reflecting it */
  'banners.release.waiting.title': string
  /** The text content for the unpublished document banner when is part of a release */
  'banners.unpublished-release-banner.text': string
  /** Browser/tab title when creating a new document of a given type */
  'browser-document-title.new-document': string
  /** Browser/tab title when editing a document where the title cannot be resolved from preview configuration */
  'browser-document-title.untitled-document': string
  /** The action menu button aria-label */
  'buttons.action-menu-button.aria-label': string
  /** The action menu button tooltip */
  'buttons.action-menu-button.tooltip': string
  /** The aria-label for the split pane button on the document panel header */
  'buttons.split-pane-button.aria-label': string
  /** The tool tip for the split pane button on the document panel header */
  'buttons.split-pane-button.tooltip': string
  /** The title for the close button on the split pane on the document panel header */
  'buttons.split-pane-close-button.title': string
  /** The title for the close group button on the split pane on the document panel header */
  'buttons.split-pane-close-group-button.title': string
  /** The label used in the changes inspector for the from selector */
  'changes.from.label': string
  'changes.tab.history': string
  'changes.tab.review-changes': string
  /** The label used in the changes inspector for the to selector */
  'changes.to.label': string
  /** The error message shown when the specified document comparison mode is not supported */
  'compare-version.error.invalidModeParam': string
  /** The error message shown when the next document for comparison could not be extracted from the URL */
  'compare-version.error.invalidNextDocumentParam': string
  /** The error message shown when the document comparison URL could not be parsed */
  'compare-version.error.invalidParams.title': string
  /** The error message shown when the previous document for comparison could not be extracted from the URL */
  'compare-version.error.invalidPreviousDocumentParam': string
  /** The text for the "Compare versions" action for a document */
  'compare-versions.menu-item.title': string
  /** The string used to label draft documents */
  'compare-versions.status.draft': string
  /** The string used to label published documents */
  'compare-versions.status.published': string
  /** The title used when comparing versions of a document */
  'compare-versions.title': string
  /** The text in the "Cancel" button in the confirm delete dialog that cancels the action and closes the dialog */
  'confirm-delete-dialog.cancel-button.text': string
  /** Used in `confirm-delete-dialog.cdr-summary.title` */
  'confirm-delete-dialog.cdr-summary.document-count_one': string
  /** Used in `confirm-delete-dialog.cdr-summary.title` */
  'confirm-delete-dialog.cdr-summary.document-count_other': string
  /** The text that appears in the subtitle `<summary>` that lists the datasets below the title */
  'confirm-delete-dialog.cdr-summary.subtitle_one': string
  /** The text that appears in the subtitle `<summary>` that lists the datasets below the title */
  'confirm-delete-dialog.cdr-summary.subtitle_other': string
  /** The text that appears in the subtitle `<summary>` that lists the datasets below the title */
  'confirm-delete-dialog.cdr-summary.subtitle_unavailable_one': string
  /** The text that appears in the subtitle `<summary>` that lists the datasets below the title */
  'confirm-delete-dialog.cdr-summary.subtitle_unavailable_other': string
  /** The text that appears in the title `<summary>` that includes the list of CDRs (singular) */
  'confirm-delete-dialog.cdr-summary.title_one': string
  /** The text that appears in the title `<summary>` that includes the list of CDRs (plural) */
  'confirm-delete-dialog.cdr-summary.title_other': string
  /** Appears when hovering over the copy button to copy */
  'confirm-delete-dialog.cdr-table.copy-id-button.tooltip': string
  /** The header for the dataset column in the list of cross-dataset references found */
  'confirm-delete-dialog.cdr-table.dataset.label': string
  /** The header for the document ID column in the list of cross-dataset references found */
  'confirm-delete-dialog.cdr-table.document-id.label': string
  /** The toast title when the copy button has been clicked but copying failed */
  'confirm-delete-dialog.cdr-table.id-copied-toast.title-failed': string
  /** The header for the project ID column in the list of cross-dataset references found */
  'confirm-delete-dialog.cdr-table.project-id.label': string
  /** The text in the "Delete anyway" button in the confirm delete dialog that confirms the action */
  'confirm-delete-dialog.confirm-anyway-button.text_delete': string
  /** The text in the "Unpublish anyway" button in the confirm delete dialog that confirms the action */
  'confirm-delete-dialog.confirm-anyway-button.text_unpublish': string
  /** The text in the "Delete now" button in the confirm delete dialog that confirms the action */
  'confirm-delete-dialog.confirm-button.text_delete': string
  /** The text in the "Unpublish now" button in the confirm delete dialog that confirms the action */
  'confirm-delete-dialog.confirm-button.text_unpublish': string
  /** If no referring documents are found, this text appears above the cancel and confirmation buttons */
  'confirm-delete-dialog.confirmation.text_delete': string
  /** If no referring documents are found, this text appears above the cancel and confirmation buttons */
  'confirm-delete-dialog.confirmation.text_unpublish': string
  /** The text body of the error dialog. */
  'confirm-delete-dialog.error.message.text': string
  /** The text in the retry button of the confirm delete dialog if an error occurred. */
  'confirm-delete-dialog.error.retry-button.text': string
  /** The header of the confirm delete dialog if an error occurred while the confirm delete dialog was open. */
  'confirm-delete-dialog.error.title.text': string
  /** The header of the confirm delete dialog */
  'confirm-delete-dialog.header.text_delete': string
  /** The header of the confirm delete dialog */
  'confirm-delete-dialog.header.text_unpublish': string
  /** The text that appears while the referring documents are queried */
  'confirm-delete-dialog.loading.text': string
  /** Shown if there are references to other documents but the user does not have the permission to see the relevant document IDs */
  'confirm-delete-dialog.other-reference-count.title_one': string
  /** Shown if there are references to other documents but the user does not have the permission to see the relevant document IDs */
  'confirm-delete-dialog.other-reference-count.title_other': string
  /** Text in the tooltip of this component if hovering over the info icon */
  'confirm-delete-dialog.other-reference-count.tooltip': string
  /** Appears when unable to render a document preview in the referring document list */
  'confirm-delete-dialog.preview-item.preview-unavailable.subtitle': string
  /** Appears when unable to render a document preview in the referring document list */
  'confirm-delete-dialog.preview-item.preview-unavailable.title': string
  /** Warns the user of affects to other documents if the action is confirmed (delete) */
  'confirm-delete-dialog.referential-integrity-disclaimer.text_delete': string
  /** Warns the user of affects to other documents if the action is confirmed (unpublish) */
  'confirm-delete-dialog.referential-integrity-disclaimer.text_unpublish': string
  /** Tells the user the count of how many other referring documents there are before listing them. (singular) */
  'confirm-delete-dialog.referring-document-count.text_one': string
  /** Tells the user the count of how many other referring documents there are before listing them. (plural) */
  'confirm-delete-dialog.referring-document-count.text_other': string
  /** Describes the list of documents that refer to the one trying to be deleted (delete) */
  'confirm-delete-dialog.referring-documents-descriptor.text_delete': string
  /** Describes the list of documents that refer to the one trying to be deleted (unpublish) */
  'confirm-delete-dialog.referring-documents-descriptor.text_unpublish': string
  /** The text for the cancel button in the confirm dialog used in document action shortcuts if none is provided */
  'confirm-dialog.cancel-button.fallback-text': string
  /** The text for the confirm button in the confirm dialog used in document action shortcuts if none is provided */
  'confirm-dialog.confirm-button.fallback-text': string
  /** For the default structure definition, the title for the "Content" pane */
  'default-definition.content-title': string
  /** The text shown if there was an error while getting the document's title via a preview value */
  'doc-title.error.text': string
  /** The text shown if the preview value for a document is non-existent or empty */
  'doc-title.fallback.text': string
  /** The text shown if a document's title via a preview value cannot be determined due to an unknown schema type */
  'doc-title.unknown-schema-type.text': string
  /** Tooltip text shown for the close button of the document inspector */
  'document-inspector.close-button.tooltip': string
  /** The title shown in the dialog header, when inspecting a valid document */
  'document-inspector.dialog.title': string
  /** The title shown in the dialog header, when the document being inspected is not created yet/has no value */
  'document-inspector.dialog.title-no-value': string
  /** Title shown for menu item that opens the "Inspect" dialog */
  'document-inspector.menu-item.title': string
  /** the placeholder text for the search input on the inspect dialog */
  'document-inspector.search.placeholder': string
  /** The "parsed" view mode, meaning the JSON is searchable, collapsible etc */
  'document-inspector.view-mode.parsed': string
  /** The "raw" view mode, meaning the JSON is presented syntax-highlighted, but with no other features - optimal for copying */
  'document-inspector.view-mode.raw-json': string
  /** The text for when a form is hidden */
  'document-view.form-view.form-hidden': string
  /** Fallback title shown when a form title is not provided */
  'document-view.form-view.form-title-fallback': string
  /** The text for when the form view is loading a document */
  'document-view.form-view.loading': string
  /** The description of the sync lock toast on the form view */
  'document-view.form-view.sync-lock-toast.description': string
  /** The title of the sync lock toast on the form view */
  'document-view.form-view.sync-lock-toast.title': string
  /**The title for the menu items that will be shown when expanding a publish release event to inspect the document */
  'events.inspect.release': string
  /**The title for the menu items that will be shown when expanding a publish draft event to inspect the draft document*/
  'events.open.draft': string
  /**The title for the menu items that will be shown when expanding a publish release event to inspect the release*/
  'events.open.release': string
  /** The loading messaging for when the tooltip is still loading permission info */
  'insufficient-permissions-message-tooltip.loading-text': string
  /** --- Menu items --- */
  /** The menu item group title to use for the Action menu items */
  'menu-item-groups.actions-group': string
  /** The menu item group title to use for the Layout menu items */
  'menu-item-groups.layout-group': string
  /** The menu item group title to use for the Sort menu items */
  'menu-item-groups.sorting-group': string
  /** The menu item title to use the compact view */
  'menu-items.layout.compact-view': string
  /** The menu item title to use the detailed view */
  'menu-items.layout.detailed-view': string
  /** The menu item title to Sort by Created */
  'menu-items.sort-by.created': string
  /** The menu item title to Sort by Last Edited */
  'menu-items.sort-by.last-edited': string
  /** The link text of the no document type screen that appears directly below the subtitle */
  'no-document-types-screen.link-text': string
  /** The subtitle of the no document type screen that appears directly below the title */
  'no-document-types-screen.subtitle': string
  /** The title of the no document type screen */
  'no-document-types-screen.title': string
  /** Text shown on back button visible on smaller breakpoints */
  'pane-header.back-button.text': string
  /** tooltip text (via `title` attribute) for the menu button */
  'pane-header.context-menu-button.tooltip': string
  /** Appears in a document list pane header if there are more than one option for create. This is the label for that menu */
  'pane-header.create-menu.label': string
  /** Tooltip displayed on the create new button in document lists */
  'pane-header.create-new-button.tooltip': string
  /** The `aria-label` for the disabled button in the pane header if create permissions are granted */
  'pane-header.disabled-created-button.aria-label': string
  /** The text shown in the tooltip of pane item previews of documents if there are unpublished edits */
  'pane-item.draft-status.has-draft.tooltip': string
  /** The text shown in the tooltip of pane item previews of documents if there are no unpublished edits */
  'pane-item.draft-status.no-draft.tooltip': string
  /** The subtitle tor pane item previews if there isn't a matching schema type found */
  'pane-item.missing-schema-type.subtitle': string
  /** The title tor pane item previews if there isn't a matching schema type found */
  'pane-item.missing-schema-type.title': string
  /** The text shown in the tooltip of pane item previews of documents if there are unpublished edits */
  'pane-item.published-status.has-published.tooltip': string
  /** The text shown in the tooltip of pane item previews of documents if there are no unpublished edits */
  'pane-item.published-status.no-published.tooltip': string
  /** The text used in the document header title if there is an error */
  'panes.document-header-title.error.text': string
  /** The text used in the document header title if creating a new item */
  'panes.document-header-title.new.text': string
  /** The text used in the document header title if no other title can be determined */
  'panes.document-header-title.untitled.text': string
  /** The error text on the document list pane */
  'panes.document-list-pane.error.text': string
  /** The error title on the document list pane */
  'panes.document-list-pane.error.title': string
  /** The text of the document list pane if more than a maximum number of documents are returned */
  'panes.document-list-pane.max-items.text': string
  /** The text of the document list pane if no documents are found for a specified type */
  'panes.document-list-pane.no-documents-of-type.text': string
  /** The text of the document list pane if no documents are found */
  'panes.document-list-pane.no-documents.text': string
  /** The text of the document list pane if no documents are found matching specified criteria */
  'panes.document-list-pane.no-matching-documents.text': string
  /** The aria-label for the search input on the document list pane */
  'panes.document-list-pane.search-input.aria-label': string
  /** The search input for the search input on the document list pane */
  'panes.document-list-pane.search-input.placeholder': string
  /** The summary title when displaying an error for a document operation result */
  'panes.document-operation-results.error.summary.title': string
  /** The text when a generic operation failed (fallback, generally not shown)  */
  'panes.document-operation-results.operation-error': string
  /** The text when a delete operation failed  */
  'panes.document-operation-results.operation-error_delete': string
  /** The text when an unpublish operation failed  */
  'panes.document-operation-results.operation-error_unpublish': string
  /** The text when a generic operation succeeded (fallback, generally not shown)  */
  'panes.document-operation-results.operation-success': string
  /** The text when copy URL operation succeeded  */
  'panes.document-operation-results.operation-success_copy-url': string
  /**  */
  'panes.document-operation-results.operation-success_createVersion': string
  /** The text when a delete operation succeeded  */
  'panes.document-operation-results.operation-success_delete': string
  /** The text when a discard changes operation succeeded  */
  'panes.document-operation-results.operation-success_discardChanges': string
  /** The text when a duplicate operation succeeded  */
  'panes.document-operation-results.operation-success_duplicate': string
  /** The text when a publish operation succeeded  */
  'panes.document-operation-results.operation-success_publish': string
  /** The text when a restore operation succeeded  */
  'panes.document-operation-results.operation-success_restore': string
  /** The text when an unpublish operation succeeded  */
  'panes.document-operation-results.operation-success_unpublish': string
  /** The document title shown when document title is "undefined" in operation message */
  'panes.document-operation-results.operation-undefined-title': string
  /** The loading message for the document not found pane */
  'panes.document-pane.document-not-found.loading': string
  /** The text of the document not found pane if the schema is known */
  'panes.document-pane.document-not-found.text': string
  /** The title of the document not found pane if the schema is known */
  'panes.document-pane.document-not-found.title': string
  /** The text of the document not found pane if the schema is not found */
  'panes.document-pane.document-unknown-type.text': string
  /** The title of the document not found pane if the schema is not found or unknown */
  'panes.document-pane.document-unknown-type.title': string
  /** The title of the document not found pane if the schema is unknown */
  'panes.document-pane.document-unknown-type.without-schema.text': string
  /** Default message shown while resolving the structure definition for an asynchronous node */
  'panes.resolving.default-message': string
  /** Message shown while resolving the structure definition for an asynchronous node and it is taking a while (more than 5s) */
  'panes.resolving.slow-resolve-message': string
  /** The text to display when type is missing */
  'panes.unknown-pane-type.missing-type.text': string
  /** The title of the unknown pane */
  'panes.unknown-pane-type.title': string
  /** The text to display when type is unknown */
  'panes.unknown-pane-type.unknown-type.text': string
  /** The text for the "Open preview" action for a document */
  'production-preview.menu-item.title': string
  /** The text for the confirm button in the request permission dialog used in the permissions banner */
  'request-permission-dialog.confirm-button.text': string
  /** The description text for the request permission dialog used in the permissions banner */
  'request-permission-dialog.description.text': string
  /** The header/title for the request permission dialog used in the permissions banner */
  'request-permission-dialog.header.text': string
  /** The text describing the note input for the request permission dialog used in the permissions banner */
  'request-permission-dialog.note-input.description.text': string
  /** The placeholder for the note input in the request permission dialog used in the permissions banner */
  'request-permission-dialog.note-input.placeholder.text': string
  /** The error/warning text in the request permission dialog when the user's request has been declined */
  'request-permission-dialog.warning.denied.text': string
  /** The error/warning text in the request permission dialog when the user's request has been denied due to too many outstanding requests */
  'request-permission-dialog.warning.limit-reached.text': string
  /** Label for button when status is saved */
  'status-bar.document-status-pulse.status.saved.text': string
  /** Label for button when status is syncing */
  'status-bar.document-status-pulse.status.syncing.text': string
  /** Accessibility label indicating when the document was last published, in relative time, eg "3 weeks ago" */
  'status-bar.publish-status-button.last-published-time.aria-label': string
  /** Text for tooltip showing explanation of timestamp/relative time, eg "Last published <RelativeTime/>" */
  'status-bar.publish-status-button.last-published-time.tooltip': string
  /** Accessibility label indicating when the document was last updated, in relative time, eg "2 hours ago" */
  'status-bar.publish-status-button.last-updated-time.aria-label': string
  /** Text for tooltip showing explanation of timestamp/relative time, eg "Last updated <RelativeTime/>" */
  'status-bar.publish-status-button.last-updated-time.tooltip': string
  /** Aria label for the button */
  'status-bar.review-changes-button.aria-label': string
  /** Label for button when status is saved */
  'status-bar.review-changes-button.status.saved.text': string
  /** Label for button when status is syncing */
  'status-bar.review-changes-button.status.syncing.text': string
  /** Text for the secondary text for tooltip for the button */
  'status-bar.review-changes-button.tooltip.changes-saved': string
  /** Primary text for tooltip for the button */
  'status-bar.review-changes-button.tooltip.text': string
  /** The text that appears in side the documentation link */
  'structure-error.docs-link.text': string
  /** Labels the error message or error stack of the structure error screen */
  'structure-error.error.label': string
  /** The header that appears at the top of the error screen */
  'structure-error.header.text': string
  /** The text in the reload button to retry rendering the structure */
  'structure-error.reload-button.text': string
  /** Labels the structure path of the structure error screen */
  'structure-error.structure-path.label': string
  /** The aria label for the menu button in the timeline item */
  'timeline-item.menu-button.aria-label': string
  /** The text for the tooltip in menu button the timeline item */
  'timeline-item.menu-button.tooltip': string
  /** The text for the collapse action in the timeline item menu */
  'timeline-item.menu.action-collapse': string
  /** The text for the expand action in the timeline item menu */
  'timeline-item.menu.action-expand': string
}

/**
 * Interface for the structure builder node.
 *
 * @public
 */
export declare interface StructureNode {
  /** Node ID */
  id: string
  /** Node ID */
  title?: string
  i18n?: I18nTextRecord<'title'>
  /** Node type */
  type?: string
}

/**
 * Lets you configure how lists, documents, views, menus, and initial value templates are organized in the Sanity Studio’s structure-tool.
 *
 * @public
 *
 * @returns A structure builder, or null/undefined if no structure should be returned. See {@link StructureBuilder}
 * @example Configuring structure
 * ```ts
 * // sanity.config.js
 *
 * import {defineConfig} from 'sanity'
 * import {structureTool} from 'sanity/structure'
 * import {schemaTypes} from './schema'
 *
 * export default defineConfig({
 *  name: 'default',
 *  title: 'My Cool Project',
 *  projectId: 'my-project-id',
 *  dataset: 'production',
 *  plugins: [
 *    structureTool({
 *      structure: (S, context) => {
 *        console.log(context) // returns { currentUser, dataset, projectId, schema, getClient, documentStore }
 *        return S.documentTypeList('post')
 *      },
 *    })
 *  ],
 *  schema: schemaTypes
 * })
 * ```
 *
 */
export declare type StructureResolver = (
  /**
   * S - An instance of the structure builder, that can be used to build the lists/items/panes for the structure tool
   * context - an object holding various context that may be used to customize the structure, for instance the current user.
   *  Defaults to
   * ```ts
   * (S) => S.defaults()
   * ```
   * See {@link StructureBuilder}
   */
  S: StructureBuilder,
  /**
   * An object containing pane and index information for the current structure tool.
   * See {@link StructureResolverContext}
   */
  context: StructureResolverContext,
) => unknown

/**
 *  Structure tool context. Extends from {@link ConfigContext}.
 *  @hidden
 *  @public
 */
export declare interface StructureResolverContext extends ConfigContext {
  /**
   * This can be replaced by a different API in the future.
   * It is provided as-is to support common structure patterns found in V2 in V3.
   * @alpha
   * */
  documentStore: DocumentStore
  /** @alpha */
  i18n: LocaleSource
}

/**
 * The structureTool is a studio plugin which adds the “structure tool” – a tool within
 * Sanity Studio in which content editors can drill down to specific documents to edit them.
 * You can configure your Studio's structure tool(s).
 *
 * @public
 * @param options - Options for the structure tool. See {@link StructureToolOptions}
 * @example Minimal example
 * ```ts
 * // sanity.config.ts
 * import { defineConfig } from 'sanity'
 * import { structureTool } from 'sanity/structure'
 *
 * export default defineConfig((
 *  // ...
 *  plugins: [
 *    structureTool() // use defaults
 *  ]
 * })
 * ```
 *
 * @example To customise your structure tool
 * ```ts
 * // sanity.config.ts
 * import { defineConfig } from 'sanity'
 * import { structureTool } from 'sanity/structure'
 * import { FaCar } from 'react-icons'

 * export default defineConfig((
 *	 // ...
 *   plugins: [
 *    structureTool({
 *      name: 'cars',
 *      title: 'Cars',
 *      icon: FaCar,
 *      structure: (S) => S.documentTypeList('car'),
 *      defaultDocumentNode: (S) =>
 *        S.document().views([
 *          S.view.form(),
 *          S.view.component(Preview).title('Preview')
 *        ])
 *    })
 *  ]
 * })
 * ```
 * */
export declare const structureTool: Plugin_2<void | StructureToolOptions>

/** @internal */
export declare interface StructureToolContextValue {
  features: StructureToolFeatures
  layoutCollapsed: boolean
  setLayoutCollapsed: (layoutCollapsed: boolean) => void
  rootPaneNode: UnresolvedPaneNode
  structureContext: StructureContext
}

/** @internal */
export declare interface StructureToolFeatures {
  /**
   * @hidden
   * @beta
   */
  backButton: boolean
  resizablePanes: boolean
  reviewChanges: boolean
  splitPanes: boolean
  splitViews: boolean
}

/**
 * The params for the `structureTool` api. See {@link structureTool}
 *
 * @public */
export declare interface StructureToolOptions {
  icon?: React.ComponentType
  name?: string
  /**
     * A workspace can have different "sources". These sources were meant to allow using multiple datasets within the same workspace, for instance.
     * This is not supported yet, but the API is still here.
     *
     @hidden
     @alpha
     */
  source?: string
  /**
   * A structure resolver function. See {@link StructureResolver}
   */
  structure?: StructureResolver
  /**
   * A resolver function used to return the default document node used when editing documents. See {@link DefaultDocumentNodeResolver}
   */
  defaultDocumentNode?: DefaultDocumentNodeResolver
  /**
   * The title that will be displayed for the tool. Defaults to Structure
   */
  title?: string
}

/** @internal */
export declare type StructureToolPaneActionHandler = (params: any, scope?: unknown) => void

/** @internal */
export declare function StructureToolProvider({
  defaultDocumentNode,
  structure: resolveStructure,
  children,
}: StructureToolProviderProps): React.JSX.Element

/** @internal */
export declare interface StructureToolProviderProps {
  structure?: StructureResolver
  defaultDocumentNode?: DefaultDocumentNodeResolver
  children: ReactNode
}

/** @internal */
export declare type UnresolvedPaneNode =
  | PaneNodeResolver
  | SerializablePaneNode
  | Observable<UnresolvedPaneNode>
  | PromiseLike<UnresolvedPaneNode>
  | PaneNode

/**
 * Interface for unserialized list items.
 *
 * @public
 */
export declare interface UnserializedListItem {
  /** List item ID */
  id: string
  /** List item title */
  title: string
  /**
   * The i18n key and namespace used to populate the localized title. This is
   * the recommend way to set the title if you are localizing your studio.
   */
  i18n?: I18nTextRecord<'title'>
  /** List item icon */
  icon?: React.ComponentType | React.ReactNode
  /** List item child. See {@link UnserializedListItemChild} */
  child?: UnserializedListItemChild
  /** List item display options. See {@link ListItemDisplayOptions} */
  displayOptions?: ListItemDisplayOptions
  /** List item schema. See {@link SchemaType} */
  schemaType?: SchemaType | string
}

/**
 * Unserialized list item child.
 * See {@link Collection}, {@link CollectionBuilder}, {@link ChildResolver} and {@link ItemChild}
 *
 * @public
 */
export declare type UnserializedListItemChild =
  | Collection
  | CollectionBuilder
  | ChildResolver
  | Observable<ItemChild>

/** @internal */
export declare function useDocumentPane(): DocumentPaneContextValue

/**
 * useDocumentTitle hook return type.
 *
 * @beta
 * @hidden
 */
declare interface UseDocumentTitle {
  error?: string
  title?: string
}

/**
 * React hook that returns the document title for the current document in the document pane.
 *
 * @beta
 * @hidden
 *
 * @returns The document title or error. See {@link UseDocumentTitle}
 */
export declare function useDocumentTitle(): UseDocumentTitle

/**
 * @internal
 */
export declare function usePaneOptions(
  options: DocumentPaneOptions,
  params?: Record<string, string | undefined>,
): DocumentPaneOptions

/**
 *
 * @hidden
 * @beta
 */
export declare function usePaneRouter(): PaneRouterContextValue

/**
 * User defined component
 *
 * @public
 */
export declare type UserComponent = React.ComponentType<{
  /** Component child. See {@link ComponentBuilder} */
  child?: ComponentBuilder
  /** Component child item ID */
  childItemId?: string
  /** Component ID */
  id: string
  /** Is component active */
  isActive?: boolean
  /** Is component selected */
  isSelected?: boolean
  /** item ID */
  itemId: string
  /** Component options */
  options?: Record<string, unknown>
  /** Pane key */
  paneKey: string
  /** URL parameters */
  urlParams: Record<string, string | undefined> | undefined
}>

/**
 * User view component
 *
 * @public */
export declare type UserViewComponent<TOptions = Record<string, any>> = React.ComponentType<{
  document: {
    draft: SanityDocument | null
    displayed: Partial<SanityDocument>
    historical: Partial<SanityDocument> | null
    published: SanityDocument | null
  }
  documentId: string
  options: TOptions
  schemaType: SchemaType
}>

/** @internal */
export declare function useStructureTool(): StructureToolContextValue

/**
 * View. See {@link FormView} and {@link ComponentView}
 *
 * @public
 */
export declare type View = FormView | ComponentView

/**
 * View builder. See {@link ComponentViewBuilder} and {@link FormViewBuilder}
 *
 * @public
 */
export declare type ViewBuilder = ComponentViewBuilder | FormViewBuilder

export {}
