/**
 * Minimal structural view of the react-ui legend store that the bridge needs.
 *
 * `StoreApi<LegendState>` from `@carto/ps-react-ui/legend/stores` structurally
 * satisfies this interface, so react-maps takes on **no** dependency on
 * `@carto/ps-react-ui` (not even a type-only import) — the consumer, who
 * already has react-ui, resolves the store with `getLegendStore(id)` and hands
 * it in.
 *
 * @experimental This API is new and may change in a future release.
 */
export interface LegendSyncStore {
    getState: () => {
        layers: Record<string, {
            visible: boolean;
            opacity: number;
            sections?: {
                id: string;
                active: string;
            }[];
        }>;
        setVisibility: (id: string, visible: boolean) => void;
        setOpacity: (id: string, opacity: number) => void;
    };
    subscribe: (listener: () => void) => () => void;
}
/** @experimental This API is new and may change in a future release. */
export interface SyncLegendLayersOptions {
    /**
     * Fired (legend→map) when a config-select section's active value changes, so
     * the consumer can drive a layer property — e.g.
     * `({ layerId, value }) => setLayer(layerId, { props: { … } })`. There is no
     * map→legend direction for sections (the map has no section concept).
     */
    onSectionChange?: (change: {
        layerId: string;
        sectionId: string;
        value: string;
    }) => void;
}
/**
 * Bidirectionally syncs layer `visible`/`opacity` between the react-maps layer
 * store and an externally-supplied react-ui legend store, and surfaces
 * config-select section changes (legend→map) through `onSectionChange`.
 *
 * Framework-agnostic: the legend store is passed in (see {@link LegendSyncStore})
 * and the layer store is the react-maps singleton. It subscribes both stores,
 * seeds once immediately, and returns an **unsubscribe teardown**. `options` is
 * captured at call time — to change `onSectionChange`, tear down and
 * call again (the standard subscription contract). In React, call it from an
 * effect and return its result:
 *
 * @example
 * ```tsx
 * function LegendSync() {
 *   const legendStore = getLegendStore(useLegendId()) // react-ui
 *   const setLayer = useLayerStore((s) => s.setLayer)
 *   useEffect(
 *     () =>
 *       syncLegendLayers(legendStore, {
 *         onSectionChange: ({ layerId, value }) =>
 *           setLayer(layerId, { props: {  } }),
 *       }),
 *     [legendStore, setLayer],
 *   )
 *   return null
 * }
 * ```
 *
 * @param legendStore - The panel's react-ui legend store (`getLegendStore(id)`).
 * @param options - Optional id filter and `onSectionChange` handler.
 * @returns An unsubscribe function that detaches both store subscriptions.
 *
 * @experimental This API is new and may change in a future release.
 */
export declare function syncLegendLayers(legendStore: LegendSyncStore, options?: SyncLegendLayersOptions): () => void;
