import { ComponentType, RefAttributes, RefObject } from "react";
import { Observable } from "rxjs";
import { SanityDocument } from "@sanity/types";
import { ClientPerspective, StackablePerspective } from "@sanity/client";
import { ActorRefFrom } from "xstate";
import { DocumentStore, DocumentValuePermission, PermissionCheckResult, SanityClient as SanityClient$1 } from "sanity";
import { StatusEvent } from "@sanity/comlink";
import "@sanity/presentation-comlink";
import { PreviewUrlResolver } from "@sanity/preview-url-secret/define-preview-url";
/** @internal */
interface ResolvePreviewModeUrlInput {
  previewUrlSecret: string;
  resolvedPreviewMode: PreviewUrlPreviewMode;
  initialUrl: URL;
}
interface Context$2 {
  initialUrl: URL | null;
  previewUrl: URL | null;
  allowOrigins: URLPattern[] | null;
  error: Error | null;
  previewSearchParam: string | null;
  previewUrlSecret: {
    secret: string;
    expiresAt: Date;
  } | null;
  previewAccessSharingCreatePermission: PermissionCheckResult | null;
  previewAccessSharingReadPermission: PermissionCheckResult | null;
  previewAccessSharingUpdatePermission: PermissionCheckResult | null;
  previewUrlSecretPermission: PermissionCheckResult | null;
  previewMode: PreviewUrlPreviewMode | null;
}
type SetPreviewSearchParamEvent = {
  type: 'set preview search param';
  previewSearchParam: string | null;
};
type Input$1 = Omit<SetPreviewSearchParamEvent, 'type'>;
interface CheckPermissionInput {
  checkPermissionName: DocumentValuePermission;
  document: Partial<SanityDocument> | null;
}
declare const previewUrlMachine: import("xstate").StateMachine<Context$2, SetPreviewSearchParamEvent, {
  [x: string]: import("xstate").ActorRefFromLogic<import("xstate").ObservableActorLogic<PermissionCheckResult, CheckPermissionInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<URLPattern[], {
    initialUrl: URL;
  }, import("xstate").EventObject> | import("xstate").PromiseActorLogic<URL, ResolvePreviewModeUrlInput, import("xstate").EventObject> | import("xstate").PromiseActorLogic<URL, {
    initialUrl: URL;
    previewSearchParam: string | null | undefined;
    allowOrigins: URLPattern[];
  }, import("xstate").EventObject> | import("xstate").PromiseActorLogic<URL, {
    previewSearchParam: string | null;
  }, import("xstate").EventObject> | import("xstate").PromiseActorLogic<{
    secret: string;
    expiresAt: Date;
  }, import("xstate").NonReducibleUnknown, import("xstate").EventObject> | import("xstate").PromiseActorLogic<string | null, import("xstate").NonReducibleUnknown, import("xstate").EventObject> | import("xstate").PromiseActorLogic<false | PreviewUrlPreviewMode, {
    targetOrigin: string;
  }, import("xstate").EventObject>> | undefined;
}, {
  src: "check permission";
  logic: import("xstate").ObservableActorLogic<PermissionCheckResult, CheckPermissionInput, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "create preview secret";
  logic: import("xstate").PromiseActorLogic<{
    secret: string;
    expiresAt: Date;
  }, import("xstate").NonReducibleUnknown, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "read shared preview secret";
  logic: import("xstate").PromiseActorLogic<string | null, import("xstate").NonReducibleUnknown, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve allow patterns";
  logic: import("xstate").PromiseActorLogic<URLPattern[], {
    initialUrl: URL;
  }, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve initial url";
  logic: import("xstate").PromiseActorLogic<URL, {
    previewSearchParam: string | null;
  }, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve preview mode";
  logic: import("xstate").PromiseActorLogic<false | PreviewUrlPreviewMode, {
    targetOrigin: string;
  }, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve preview mode url";
  logic: import("xstate").PromiseActorLogic<URL, ResolvePreviewModeUrlInput, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve url from preview search param";
  logic: import("xstate").PromiseActorLogic<URL, {
    initialUrl: URL;
    previewSearchParam: string | null | undefined;
    allowOrigins: URLPattern[];
  }, import("xstate").EventObject>;
  id: string | undefined;
}, {
  type: "assign error";
  params: {
    message: string;
    error: unknown;
  };
} | {
  type: "assign preview search param";
  params: {
    previewSearchParam: string | null;
  };
} | {
  type: "notify preview will likely fail";
  params: import("xstate").NonReducibleUnknown;
}, {
  type: "can create preview secret";
  params: unknown;
} | {
  type: "has checked permissions";
  params: unknown;
} | {
  type: "has preview mode with created secret";
  params: false | PreviewUrlPreviewMode;
} | {
  type: "has preview mode with share access";
  params: false | PreviewUrlPreviewMode;
} | {
  type: "has preview mode without permissions";
  params: false | PreviewUrlPreviewMode;
} | {
  type: "search param has new origin";
  params: unknown;
}, "expiredSecret", "checkingPermissions" | "error" | "resolvingAllowPatterns" | "resolvingInitialUrl" | "resolvingPreviewMode" | "resolvingUrlFromPreviewSearchParam" | "success" | {
  previewMode: "createPreviewSecret" | "error" | "readShareAccess" | "resolvePreviewUrl" | "success";
}, "busy" | "error", Input$1, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
  id: "Preview URL";
  states: {
    readonly checkingPermissions: {};
    readonly resolvingInitialUrl: {};
    readonly error: {};
    readonly resolvingAllowPatterns: {};
    readonly resolvingUrlFromPreviewSearchParam: {
      id: "loop";
    };
    readonly resolvingPreviewMode: {};
    readonly success: {};
    readonly previewMode: {
      states: {
        readonly createPreviewSecret: {};
        readonly readShareAccess: {};
        readonly resolvePreviewUrl: {};
        readonly error: {};
        readonly success: {};
      };
    };
  };
}, import("xstate").MetaObject>;
type PreviewUrlRef = ActorRefFrom<typeof previewUrlMachine>;
interface Context$1 {
  targetOrigin: string;
  previewMode: PreviewUrlPreviewMode | null;
  /**
   * `expiresAt` is `null` for the shared preview secret, which stays valid until sharing is turned off
   */
  previewUrlSecret: {
    secret: string;
    expiresAt: Date | null;
  } | null;
  previewUrlSecretPermission: PermissionCheckResult | null;
  previewAccessSharingReadPermission: PermissionCheckResult | null;
  error: Error | null;
}
type SetTargetOriginEvent = {
  type: 'set target origin';
  targetOrigin: string;
};
type Input = Omit<SetTargetOriginEvent, 'type'>;
/**
 * Owns what the "Open preview" link needs for the origin currently shown in the iframe: the preview mode
 * resolved for that origin, and a preview URL secret that is created again when it expires, or the shared
 * secret, which is followed as sharing is turned off and on.
 *
 * The iframe itself is driven by `previewUrlMachine`. Once it has loaded through the enable route its
 * preview mode cookie is set, so it has no use for a fresh secret. The link is different: it can be clicked
 * at any time, so the secret in it has to be valid at that moment.
 * @internal
 */
declare const openPreviewUrlMachine: import("xstate").StateMachine<Context$1, SetTargetOriginEvent, {
  [x: string]: import("xstate").ActorRefFromLogic<import("xstate").ObservableActorLogic<PermissionCheckResult, CheckPermissionInput, import("xstate").EventObject> | import("xstate").ObservableActorLogic<string | null, void, import("xstate").EventObject> | import("xstate").PromiseActorLogic<{
    secret: string;
    expiresAt: Date;
  }, import("xstate").NonReducibleUnknown, import("xstate").EventObject> | import("xstate").PromiseActorLogic<false | PreviewUrlPreviewMode, {
    targetOrigin: string;
  }, import("xstate").EventObject>> | undefined;
}, {
  src: "check permission";
  logic: import("xstate").ObservableActorLogic<PermissionCheckResult, CheckPermissionInput, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "create preview secret";
  logic: import("xstate").PromiseActorLogic<{
    secret: string;
    expiresAt: Date;
  }, import("xstate").NonReducibleUnknown, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "resolve preview mode";
  logic: import("xstate").PromiseActorLogic<false | PreviewUrlPreviewMode, {
    targetOrigin: string;
  }, import("xstate").EventObject>;
  id: string | undefined;
} | {
  src: "watch shared preview secret";
  logic: import("xstate").ObservableActorLogic<string | null, void, import("xstate").EventObject>;
  id: string | undefined;
}, {
  type: "assign error";
  params: {
    message: string;
    error: unknown;
  };
}, {
  type: "can create preview secret";
  params: unknown;
} | {
  type: "can read shared preview secret";
  params: unknown;
} | {
  type: "has checked permissions";
  params: unknown;
} | {
  type: "has new target origin";
  params: unknown;
} | {
  type: "has preview mode";
  params: false | PreviewUrlPreviewMode;
} | {
  type: "has shared secret";
  params: string | null | undefined;
} | {
  type: "is sharing off";
  params: string | null | undefined;
}, "expiredSecret", "checkingPermissions" | "choosingPreviewSecret" | "createdSecret" | "creatingPreviewSecret" | "error" | "resolvingPreviewMode" | "unavailable" | {
  sharedSecret: "off" | "on" | "reading";
}, "busy" | "error", Input, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
  id: "Open Preview URL";
  states: {
    readonly checkingPermissions: {};
    readonly resolvingPreviewMode: {};
    readonly choosingPreviewSecret: {};
    readonly creatingPreviewSecret: {};
    readonly createdSecret: {};
    readonly sharedSecret: {
      states: {
        readonly reading: {};
        readonly on: {};
        readonly off: {};
      };
    };
    readonly unavailable: {};
    readonly error: {};
  };
}, import("xstate").MetaObject>;
type OpenPreviewUrlRef = ActorRefFrom<typeof openPreviewUrlMachine>;
/**
 * The tracked status of a single comlink connection on a channel
 * @internal
 */
interface ChannelConnectionStatus {
  status: ConnectionStatus;
  hasConnected: boolean;
}
/**
 * Per-connection statuses for a comlink channel, keyed by connection id
 * @internal
 */
type ChannelStatusMap = ReadonlyMap<string, ChannelConnectionStatus>;
interface Context {
  visualEditingOverlaysEnabled: boolean;
  /**
   * Per-connection statuses for the visual editing comlink channel
   */
  overlaysStatusMap: ChannelStatusMap;
  /**
   * The aggregated connection status of the visual editing comlink channel
   */
  overlaysConnection: ConnectionStatus;
  /**
   * Whether the user dismissed an overlays connection failure with "Continue anyway".
   * Unlike a load timeout dismissal (which is modelled as a state and lives only for the duration
   * of the failed load), this survives iframe reloads and is only cleared once the overlays connect.
   */
  overlaysDismissed: boolean;
  /**
   * Whether the overlays have connected at all since the iframe last loaded a page. A connection
   * that starts handshaking after that is a reconnect rather than a first connection, even when
   * it is a brand new comlink connection: the channel is torn down and recreated whenever the
   * tool's effects are, which React does without a remount when a hidden `<Activity>` boundary
   * is shown again (`beta.reactActivityMode`), and that must not bring the first-connection
   * loading overlay back over a preview that is already interactive.
   */
  overlaysHaveConnected: boolean;
}
declare const presentationMachine: import("xstate").StateMachine<Context, {
  type: 'toggle visual editing overlays';
  enabled: boolean;
} | {
  type: 'iframe loaded';
} | {
  type: 'iframe refresh';
} | {
  type: 'iframe reload';
} | {
  type: 'overlays status';
  statusEvent: StatusEvent;
} | {
  type: 'continue anyway';
}, {}, never, {
  type: "assign overlays dismissed";
  params: unknown;
} | {
  type: "assign overlays status";
  params: {
    statusEvent: StatusEvent;
  };
} | {
  type: "forget overlays connection";
  params: unknown;
} | {
  type: "notify iframe load timeout";
  params: unknown;
} | {
  type: "notify overlays connection timeout";
  params: unknown;
}, {
  type: "overlays connected";
  params: unknown;
} | {
  type: "overlays connecting for the first time";
  params: unknown;
} | {
  type: "overlays dismissed";
  params: unknown;
} | {
  type: "overlays reconnecting";
  params: unknown;
} | {
  type: "status event resolves to idle";
  params: unknown;
}, "iframe load timeout" | "overlays connection status delay" | "overlays connection timeout", {
  loaded: "refreshing" | {
    idle: "checking" | "dismissed" | "ok" | {
      connecting: "pending" | "slow" | "timedOut";
    } | {
      reconnecting: "failed" | "pending" | "slow";
    };
  } | {
    reloading: "checking" | "dismissed" | "timedOut" | "waiting";
  };
} | {
  loading: "dismissed" | "timedOut" | "waiting";
}, "busy" | "overlays connection timed out" | "prevent iframe interaction" | "show error card" | "show loading overlay" | "show overlays connection status", import("xstate").NonReducibleUnknown, import("xstate").NonReducibleUnknown, import("xstate").EventObject, import("xstate").MetaObject, {
  id: "Presentation Tool";
  states: {
    readonly loading: {
      states: {
        readonly waiting: {};
        readonly timedOut: {};
        readonly dismissed: {};
      };
    };
    readonly loaded: {
      states: {
        readonly idle: {
          states: {
            readonly checking: {};
            readonly ok: {};
            readonly dismissed: {
              id: "overlays dismissed";
            };
            readonly connecting: {
              states: {
                readonly pending: {};
                readonly slow: {};
                readonly timedOut: {};
              };
            };
            readonly reconnecting: {
              states: {
                readonly pending: {};
                readonly slow: {};
                readonly failed: {};
              };
            };
          };
        };
        readonly refreshing: {};
        readonly reloading: {
          states: {
            readonly checking: {};
            readonly waiting: {};
            readonly timedOut: {};
            readonly dismissed: {};
          };
        };
      };
    };
  };
}, import("xstate").MetaObject>;
type PresentationMachineRef = ActorRefFrom<typeof presentationMachine>;
/** @public */
interface PreviewProps {
  canSharePreviewAccess: boolean;
  canToggleSharePreviewAccess: boolean;
  canUseSharedPreviewAccess: boolean;
  header?: HeaderOptions;
  initialUrl: URL;
  loadersConnection: ConnectionStatus;
  navigatorEnabled: boolean;
  onPathChange: (nextPath: string) => void;
  onRefresh: (fallback: () => void) => void;
  openPopup: (url: string) => void;
  /**
   * Resolves preview mode for the current target origin and keeps a valid preview secret for the "Open preview" link
   */
  openPreviewUrlRef: OpenPreviewUrlRef;
  overlaysConnection: ConnectionStatus;
  presentationRef: PresentationMachineRef;
  perspective: PresentationPerspective;
  /**
   * The selected editing variant as a bare variant id, or `undefined` when no variant is selected
   */
  variant: string | undefined;
  previewUrl?: string;
  setViewport: (mode: 'desktop' | 'mobile') => void;
  targetOrigin: string;
  toggleNavigator?: () => void;
  toggleOverlay: () => void;
  viewport: PresentationViewport;
  vercelProtectionBypass: string | null;
  previewUrlRef: PreviewUrlRef;
  handlesPerspectiveChange: boolean;
  handlesVariantChange: boolean;
}
/** @public */
interface PreviewHeaderProps extends PreviewProps {
  iframeRef: RefObject<HTMLIFrameElement | null>;
  renderDefault: (props: PreviewHeaderProps) => React.JSX.Element;
}
/**
 * Represents a document location
 * @public
 */
interface DocumentLocation {
  /**
   * Title of the document
   */
  title: string;
  /**
   * URL of the document location
   */
  href: string;
  /**
   * Optional icon component to display instead of the default DesktopIcon
   */
  icon?: ComponentType;
  /**
   * Whether to show the href below the title. Defaults to true
   */
  showHref?: boolean;
}
/**
 * State for describing document locations or providing a message if locations are unavailable
 * @public
 */
interface DocumentLocationsState {
  /**
   * Array of document locations
   */
  locations?: DocumentLocation[];
  /**
   * Message to display if locations are unavailable
   */
  message?: string;
  /**
   * Tone of the message
   */
  tone?: 'positive' | 'caution' | 'critical';
}
/**
 * Function used for advanced document location resolution
 * @param params - Object with document `id` and document `type` properties
 * @param context - Object with `documentStore` property for creating listenQuery subscriptions
 * @returns Document location state, optionally as an Observable, or null/undefined if no locations are available
 * @public
 */
type DocumentLocationResolver = (params: {
  id: string;
  type: string;
  version: string | undefined;
  perspectiveStack: StackablePerspective[];
  /**
   * The selected editing variant as a bare variant id, or `undefined` when no variant is
   * selected. Pass it as the variant param in the client, alongside `perspectiveStack`.
   */
  variant?: string;
}, context: {
  documentStore: DocumentStore;
}) => DocumentLocationsState | null | undefined | Observable<DocumentLocationsState | null | undefined>;
/**
 * Configuration options for Presentation tool's optional navigator component
 * The navigator appears as a resizable sidebar panel
 *
 * @public
 */
interface NavigatorOptions {
  /**
   * Minimum width of the navigator panel in pixels
   */
  minWidth?: number;
  /**
   * Maximum width of the navigator panel in pixels
   */
  maxWidth?: number;
  /**
   * React component to render in the navigator panel
   */
  component: ComponentType;
}
/**
 * Configuration options for Presentation tool's optional custom preview header component
 *
 * @public
 */
interface HeaderOptions {
  /**
   * React component to render as the preview header, receives PreviewHeaderProps
   */
  component: ComponentType<PreviewHeaderProps>;
}
/** @public */
interface PreviewUrlAllowOptionContext {
  client: SanityClient$1;
  /**
   * Equivalent to `location.origin`
   */
  origin: string;
  /**
   * The initial URL of the preview
   */
  initialUrl: URL;
}
/** @public */
interface PreviewUrlInitialOptionContext {
  client: SanityClient$1;
  /**
   * Equivalent to `location.origin`
   */
  origin: string;
}
/** @public */
interface PreviewUrlPreviewModeOptionContext {
  client: SanityClient$1;
  /**
   * Equivalent to `location.origin`
   */
  origin: string;
  /**
   * The origin on the URL that will be used in the preview iframe
   */
  targetOrigin: string;
}
/** @public */
type PreviewUrlAllowOption = string | string[] | ((context: PreviewUrlAllowOptionContext) => string | string[] | Promise<string | string[]>);
/** @public */
type PreviewUrlInitialOption = string | ((context: PreviewUrlInitialOptionContext) => string | Promise<string>);
/** @public */
type PreviewUrlPreviewModeOption = PreviewUrlPreviewMode | ((context: PreviewUrlPreviewModeOptionContext) => false | PreviewUrlPreviewMode | Promise<false | PreviewUrlPreviewMode>);
/** @public */
interface PreviewUrlPreviewMode {
  /**
   * The route that enables Preview Mode
   * @example '/api/preview'
   * @example '/api/draft-mode/enable'
   */
  enable: string;
  /**
   * Allow sharing access to a preview with others.
   * This is enabled/disabled in the Presentation Tool. It's initially disabled, and can be enabled by someone who has access to creating draft documents in the Studio.
   * Custom roles can limit access to `_id in path("drafts.**") && _type == "sanity.previewUrlSecret"`.
   * This will create a secret that is valid until sharing is disabled. Turning sharing off and on again will create a new secret and can be used to remove access for folks that got the link in an email but should no longer have access.
   * Share URLs to previews will append this secret and give access to anyone who is given the URL, they don't need to be logged into the Studio or to Vercel.
   */
  shareAccess?: boolean;
  /**
   * The route that reports if Preview Mode is enabled or not, useful for debugging
   * @example '/api/check-preview'
   * @deprecated - this API is not yet implemented
   */
  check?: string;
  /**
   * The route that disables Preview Mode, useful for debugging
   * @example '/api/disable-preview'
   * @deprecated - this API is not yet implemented
   */
  disable?: string;
}
/**
 * @public
 */
interface PreviewUrlResolverOptions {
  /**
   * The default preview URL, used when the URL to use is not yet known, or there's no `&preview=...` search param in the studio URL.
   * @example '/en/preview?q=shoes'
   * @example 'https://example.com'
   * @defaultValue `location.origin`
   */
  initial?: PreviewUrlInitialOption;
  previewMode?: PreviewUrlPreviewModeOption;
  /**
   * @defaultValue `location.origin`
   * @deprecated - use `initial` instead
   */
  origin?: string;
  /**
   * @defaultValue '/'
   * @deprecated - use `initial` instead
   */
  preview?: string;
  /**
   * @deprecated - use `previewMode` instead
   */
  draftMode?: {
    /**
     * @deprecated - use `previewMode.enable` instead
     */
    enable: string;
    /**
     * @deprecated - use `previewMode.shareAccess` instead
     */
    shareAccess?: boolean;
    /**
     * @deprecated - use `previewMode.check` instead
     */
    check?: string;
    /**
     * @deprecated - use `previewMode.disable` instead
     */
    disable?: string;
  };
}
/**
 * @deprecated the `previewUrl.initial`, `previewUrl.allowOrigins` and `previewUrl.previewMode.enable` supports async functions that offer advanced control over how preview URLs are resolved
 * @public
 */
type DeprecatedPreviewUrlResolver = PreviewUrlResolver<SanityClient$1>;
/** @public */
type PreviewUrlOption = string | DeprecatedPreviewUrlResolver | PreviewUrlResolverOptions;
/**
 * Object of document location resolver definitions per document type
 * @public
 */
type DocumentLocationResolvers = Record<string, DocumentLocationResolverObject | DocumentLocationsState>;
/**
 * Document location resolver object
 * @public
 */
type DocumentLocationResolverObject<K extends string = string> = {
  /**
   * Object for selecting document fields
   */
  select: Record<K, string>;
  /**
   * Function that accepts a document with the selected fields and returns an optional document location state
   */
  resolve: (value: Record<K, any> | null) => DocumentLocationsState | null | undefined | void;
};
/**
 * Context object passed to functions used in `DocumentResolver` definitions.
 * Contains information about the current URL being matched against route patterns.
 *
 * @example
 * For a route pattern `/blog/:category/:slug` matching URL `https://example.com/blog/tech/hello-world`:
 * ```ts
 * {
 *   origin: 'https://example.com',
 *   params: { category: 'tech', slug: 'hello-world' },
 *   path: '/blog/tech/hello-world'
 * }
 * ```
 *
 * @public
 */
interface DocumentResolverContext {
  /**
   * The origin (protocol + hostname + port) of the matched URL
   */
  origin: string;
  /**
   * Extracted route parameters from URL path matching (e.g., `:slug` → `{slug: 'value'}`)
   */
  params: Record<string, string>;
  /**
   * The pathname of the matched URL (without query parameters)
   */
  path: string;
}
/**
 * Generic function type used in `DocumentResolver` definitions that receives a `DocumentResolverContext` and returns a computed value.
 * @param context - `DocumentResolverContext` containing route information (origin, params, path)
 * @returns Computed value based on the context (typically a string for filters or an object for parameters)
 * @public
 */
type ContextFn<T> = (context: DocumentResolverContext) => T;
/**
 * Configuration object for resolving documents based on URL route patterns.
 * Used to define the main document when navigating to specific URLs in
 * Presentation tool's preview iframe.
 *
 * Supports three different resolution strategies:
 *
 * **Simple type-based resolution:**
 * ```ts
 * {
 *   route: '/blog',
 *   type: 'blog'  // Useful for singleton documents
 * }
 * ```
 *
 * **GROQ filter-based resolution:**
 * ```ts
 * {
 *   route: '/blog/:category/:slug',
 *   filter: ({ params }) => `_type == "post" && slug.current == "${params.slug}"`,
 *   params: ({ params }) => ({ category: params.category })
 * }
 * ```
 *
 * **Advanced resolution with custom logic:**
 * ```ts
 * {
 *   route: '/products/:id',
 *   resolve: ({ params }) => ({
 *     filter: `_type == "product" && _id == $id`,
 *     params: { id: params.id }
 *   })
 * }
 * ```
 *
 * @public
 */
type DocumentResolver = {
  route: string | Array<string>;
  type: string;
  filter?: never;
  params?: never;
  resolve?: never;
} | {
  route: string | Array<string>;
  type?: never;
  filter: ContextFn<string> | string;
  params?: ContextFn<Record<string, string>> | Record<string, string>;
  resolve?: never;
} | {
  route: string | Array<string>;
  type?: never;
  filter?: never;
  params?: never;
  resolve: ContextFn<{
    filter: string;
    params?: Record<string, string>;
  } | undefined>;
};
/**
 * Configuration options for the Presentation tool.
 * @public
 */
interface PresentationPluginOptions {
  devMode?: boolean | (() => boolean);
  icon?: ComponentType;
  name?: string;
  title?: string;
  allowOrigins?: PreviewUrlAllowOption;
  previewUrl: PreviewUrlOption;
  /**
   * @deprecated use `resolve.locations` instead
   */
  locate?: DocumentLocationResolver;
  resolve?: {
    mainDocuments?: DocumentResolver[];
    locations?: DocumentLocationResolvers | DocumentLocationResolver;
  };
  components?: {
    unstable_header?: HeaderOptions;
    unstable_navigator?: NavigatorOptions;
  };
  /**
   * @deprecated this feature flag is no longer needed
   */
  unstable_showUnsafeShareUrl?: boolean;
}
/**
 * Presentation specific state that is stored in the pathname section of the URL
 * @public
 */
interface PresentationStateParams {
  type?: string;
  id?: string;
  path?: string;
}
/**
 * Presentation specific URL search parameters, they should persist when
 * navigating between the document pane and document list pane
 * @public
 */
interface PresentationSearchParams {
  preview?: string;
  perspective?: string;
  viewport?: string;
}
/**
 * Document Pane specific URL search parameters, they should not persist when
 * navigating between the document pane and document list pane
 * @public
 */
interface StructureDocumentPaneParams extends InspectorTab {
  inspect?: string;
  parentRefPath?: string;
  path?: string;
  rev?: string;
  since?: string;
  template?: string;
  templateParams?: string;
  version?: string;
  view?: string;
  pathKey?: string;
  instruction?: string;
  comment?: string;
  scheduledDraft?: string;
}
/**
 * parameters for the changes inspector
 * @public
 */
interface InspectorTab {
  changesInspectorTab?: 'history' | 'review';
}
/**
 * All possible URL search parameters used by the Presentation tool
 * @public
 */
interface CombinedSearchParams extends StructureDocumentPaneParams, PresentationSearchParams {}
/**
 * All possible parameters that can be used to describe the state of the
 * Presentation tool, stored in the pathname and as search parameters of the URL
 * @public
 */
interface PresentationParamsContextValue extends PresentationStateParams, CombinedSearchParams {}
/** @public */
type PresentationNavigateOptions = ({
  state: PresentationStateParams;
  params?: CombinedSearchParams;
} | {
  params: CombinedSearchParams;
  state?: PresentationStateParams;
}) & {
  replace?: boolean;
};
/** @public */
type PresentationNavigate = (options: PresentationNavigateOptions) => void;
/** @public */
type PresentationPerspective = Exclude<ClientPerspective, 'raw'>;
/** @public */
type PresentationViewport = 'desktop' | 'mobile';
/**
 * Represents the connection status between the Sanity Studio and Presentation's preview iframe.
 * @public
 */
type ConnectionStatus = 'connected' | 'connecting' | 'reconnecting' | 'idle';
/** @public */
type PresentationNavigateContextValue = (preview: string | undefined, document?: {
  type: string;
  id: string;
}) => void;
interface PresentationContextValue {
  devMode: boolean;
  name: string;
  navigate: PresentationNavigate;
  params: PresentationParamsContextValue;
  structureParams: StructureDocumentPaneParams;
  searchParams: PresentationSearchParams;
}
export { PreviewUrlResolver as C, PreviewProps as D, PreviewHeaderProps as E, PreviewUrlOption as S, StructureDocumentPaneParams as T, PresentationPerspective as _, DocumentLocationResolver as a, PresentationStateParams as b, DocumentLocationsState as c, HeaderOptions as d, InspectorTab as f, PresentationParamsContextValue as g, PresentationNavigateContextValue as h, DocumentLocation as i, DocumentResolver as l, PresentationContextValue as m, ConnectionStatus as n, DocumentLocationResolverObject as o, NavigatorOptions as p, ContextFn as r, DocumentLocationResolvers as s, CombinedSearchParams as t, DocumentResolverContext as u, PresentationPluginOptions as v, PreviewUrlResolverOptions as w, PresentationViewport as x, PresentationSearchParams as y };
//# sourceMappingURL=types-BhjcxLtO.d.ts.map