import type { PostHogAutocaptureElement, PostHogFlagsResponse, PostHogFeatureFlagsResponse, PostHogCoreOptions, PostHogEventProperties, PostHogCaptureOptions, JsonType, PostHogRemoteConfig, FeatureFlagValue, PostHogFeatureFlagDetails, PostHogGroupProperties } from './types';
import { PostHogPersistedProperty } from './types';
import { PostHogCoreStateless } from './posthog-core-stateless';
export declare abstract class PostHogCore extends PostHogCoreStateless {
    private sendFeatureFlagEvent;
    private flagCallReported;
    private _beforeSend?;
    protected _flagsResponsePromise?: Promise<PostHogFeatureFlagsResponse | undefined>;
    protected _sessionExpirationTimeSeconds: number;
    private _sessionMaxLengthSeconds;
    protected sessionProps: PostHogEventProperties;
    protected _personProfiles: 'always' | 'identified_only' | 'never';
    constructor(apiKey: string, options?: PostHogCoreOptions);
    protected setupBootstrap(options?: Partial<PostHogCoreOptions>): void;
    private clearProps;
    on(event: string, cb: (...args: any[]) => void): () => void;
    reset(propertiesToKeep?: PostHogPersistedProperty[]): void;
    protected getCommonEventProperties(): PostHogEventProperties;
    private enrichProperties;
    /**
     * Returns the current session_id.
     *
     * @remarks
     * This should only be used for informative purposes.
     * Any actual internal use case for the session_id should be handled by the sessionManager.
     *
     * @public
     *
     * @returns The stored session ID for the current session. This may be an empty string if the client is not yet fully initialized.
     */
    getSessionId(): string;
    resetSessionId(): void;
    /**
     * Returns the current anonymous ID.
     *
     * This is the ID assigned to users before they are identified. It's used to track
     * anonymous users and link them to identified users when they sign up.
     *
     * {@label Identification}
     *
     * @example
     * ```js
     * // get the anonymous ID
     * const anonId = posthog.getAnonymousId()
     * console.log('Anonymous ID:', anonId)
     * ```
     *
     * @public
     *
     * @returns {string} The stored anonymous ID. This may be an empty string if the client is not yet fully initialized.
     */
    getAnonymousId(): string;
    /**
     * * @returns {string} The stored distinct ID. This may be an empty string if the client is not yet fully initialized.
     */
    getDistinctId(): string;
    registerForSession(properties: PostHogEventProperties): void;
    unregisterForSession(property: string): void;
    /***
     *** TRACKING
     ***/
    identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
    capture(event: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
    alias(alias: string): void;
    autocapture(eventType: string, elements: PostHogAutocaptureElement[], properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
    /***
     *** GROUPS
     ***/
    groups(groups: PostHogGroupProperties): void;
    group(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
    groupIdentify(groupType: string, groupKey: string | number, groupProperties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
    /***
     * PROPERTIES
     ***/
    setPersonPropertiesForFlags(properties: {
        [type: string]: string;
    }): void;
    resetPersonPropertiesForFlags(): void;
    setGroupPropertiesForFlags(properties: {
        [type: string]: Record<string, string>;
    }): void;
    resetGroupPropertiesForFlags(): void;
    private remoteConfigAsync;
    /***
     *** FEATURE FLAGS
     ***/
    protected flagsAsync(sendAnonDistinctId?: boolean, fetchConfig?: boolean): Promise<PostHogFeatureFlagsResponse | undefined>;
    private cacheSessionReplay;
    private _remoteConfigAsync;
    private _flagsAsync;
    private setKnownFeatureFlagDetails;
    private getKnownFeatureFlagDetails;
    private getStoredFlagDetails;
    protected getKnownFeatureFlags(): PostHogFlagsResponse['featureFlags'] | undefined;
    private getBootstrappedFeatureFlagDetails;
    private setBootstrappedFeatureFlagDetails;
    private getBootstrappedFeatureFlags;
    private getBootstrappedFeatureFlagPayloads;
    getFeatureFlag(key: string): FeatureFlagValue | undefined;
    getFeatureFlagPayload(key: string): JsonType | undefined;
    getFeatureFlagPayloads(): PostHogFlagsResponse['featureFlagPayloads'] | undefined;
    getFeatureFlags(): PostHogFlagsResponse['featureFlags'] | undefined;
    getFeatureFlagDetails(): PostHogFeatureFlagDetails | undefined;
    getFeatureFlagsAndPayloads(): {
        flags: PostHogFlagsResponse['featureFlags'] | undefined;
        payloads: PostHogFlagsResponse['featureFlagPayloads'] | undefined;
    };
    isFeatureEnabled(key: string): boolean | undefined;
    reloadFeatureFlags(options?: {
        cb?: (err?: Error, flags?: PostHogFlagsResponse['featureFlags']) => void;
    }): void;
    reloadRemoteConfigAsync(): Promise<PostHogRemoteConfig | undefined>;
    reloadFeatureFlagsAsync(sendAnonDistinctId?: boolean): Promise<PostHogFlagsResponse['featureFlags'] | undefined>;
    onFeatureFlags(cb: (flags: PostHogFlagsResponse['featureFlags']) => void): () => void;
    onFeatureFlag(key: string, cb: (value: FeatureFlagValue) => void): () => void;
    overrideFeatureFlag(flags: PostHogFlagsResponse['featureFlags'] | null): Promise<void>;
    /**
     * Capture a caught exception manually
     *
     * {@label Error tracking}
     *
     * @public
     *
     * @example
     * ```js
     * // Capture a caught exception
     * try {
     *   // something that might throw
     * } catch (error) {
     *   posthog.captureException(error)
     * }
     * ```
     *
     * @example
     * ```js
     * // With additional properties
     * posthog.captureException(error, {
     *   customProperty: 'value',
     *   anotherProperty: ['I', 'can be a list'],
     *   ...
     * })
     * ```
     *
     * @param {Error} error The error to capture
     * @param {Object} [additionalProperties] Any additional properties to add to the error event
     * @returns {CaptureResult} The result of the capture
     */
    captureException(error: unknown, additionalProperties?: PostHogEventProperties): void;
    /**
     * Capture written user feedback for a LLM trace. Numeric values are converted to strings.
     *
     * {@label LLM analytics}
     *
     * @public
     *
     * @param traceId The trace ID to capture feedback for.
     * @param userFeedback The feedback to capture.
     */
    captureTraceFeedback(traceId: string | number, userFeedback: string): void;
    /**
     * Capture a metric for a LLM trace. Numeric values are converted to strings.
     *
     * {@label LLM analytics}
     *
     * @public
     *
     * @param traceId The trace ID to capture the metric for.
     * @param metricName The name of the metric to capture.
     * @param metricValue The value of the metric to capture.
     */
    captureTraceMetric(traceId: string | number, metricName: string, metricValue: string | number | boolean): void;
    /***
     *** PERSON PROFILES
     ***/
    /**
     * Returns whether the current user is identified (has a person profile).
     *
     * This checks:
     * 1. If PersonMode is explicitly set to 'identified'
     * 2. For backwards compatibility: if DistinctId differs from AnonymousId
     *    (meaning the user was identified before the SDK was upgraded)
     *
     * @internal
     */
    protected _isIdentified(): boolean;
    /**
     * Returns the current groups object from super properties.
     * @internal
     */
    protected _getGroups(): PostHogGroupProperties;
    /**
     * Determines whether the current user should have person processing enabled.
     *
     * Returns true if:
     * - person_profiles is set to 'always', OR
     * - person_profiles is 'identified_only' AND (user is identified OR has groups OR person processing was explicitly enabled)
     *
     * Returns false if:
     * - person_profiles is 'never', OR
     * - person_profiles is 'identified_only' AND user is not identified AND has no groups AND person processing was not enabled
     *
     * @internal
     */
    protected _hasPersonProcessing(): boolean;
    /**
     * Enables person processing if the config allows it.
     *
     * If person_profiles is 'never', this logs an error and returns false.
     * Otherwise, it enables person processing and returns true.
     *
     * @param functionName - The name of the function calling this method (for error messages)
     * @returns true if person processing is enabled, false if it's blocked by config
     * @internal
     */
    protected _requirePersonProcessing(functionName: string): boolean;
    /**
     * Creates a person profile for the current user, if they don't already have one.
     *
     * If personProfiles is 'identified_only' and no profile exists, this will create one.
     * If personProfiles is 'never', this will log an error and do nothing.
     * If personProfiles is 'always' or a profile already exists, this is a no-op.
     *
     * @public
     */
    createPersonProfile(): void;
    /**
     * Override processBeforeEnqueue to run before_send hooks.
     * This runs after prepareMessage, giving users full control over the final event.
     *
     * The internal message contains many fields (event, distinct_id, properties, type, library,
     * library_version, timestamp, uuid). CaptureEvent exposes a subset matching the web SDK's
     * CaptureResult: uuid, event, properties, $set, $set_once, timestamp.
     * Note: $set/$set_once are extracted from properties.$set and properties.$set_once.
     */
    protected processBeforeEnqueue(message: PostHogEventProperties): PostHogEventProperties | null;
    /**
     * Runs the before_send hook(s) on the given capture event.
     * If any hook returns null, the event is dropped.
     *
     * @param captureEvent The event to process
     * @returns The processed event, or null if the event should be dropped
     */
    private _runBeforeSend;
}
//# sourceMappingURL=posthog-core.d.ts.map