import * as react_jsx_runtime from 'react/jsx-runtime';
import { ReactNode, CSSProperties } from 'react';
import { ZodSchema, z } from 'zod';

/**
 * Discriminated union for single-value answers.
 * 'preset' = selected from predefined options
 * 'custom' = user-entered value via "Other" option
 */
type AnswerValue = {
    type: 'preset';
    value: string;
} | {
    type: 'custom';
    value: string;
};
/**
 * Multi-value answer (checkbox/multi-select).
 * Array of AnswerValue objects, can mix preset and custom.
 */
type MultiAnswerValue = AnswerValue[];
/**
 * Factory helper for creating preset answer values.
 */
declare function createPresetValue(value: string): AnswerValue;
/**
 * Factory helper for creating custom answer values.
 */
declare function createCustomValue(value: string): AnswerValue;
/**
 * Type guard to check if an answer is custom (user-entered).
 */
declare function isCustomValue(answer: AnswerValue): answer is {
    type: 'custom';
    value: string;
};
/**
 * Type guard to check if an answer is preset (from options).
 */
declare function isPresetValue(answer: AnswerValue): answer is {
    type: 'preset';
    value: string;
};
/**
 * Extract the raw string value from an AnswerValue.
 * Useful for display or simple comparisons.
 */
declare function getAnswerString(answer: AnswerValue | undefined): string;
/**
 * Extract all raw string values from MultiAnswerValue.
 */
declare function getMultiAnswerStrings(answers: MultiAnswerValue): string[];
/**
 * Check if a MultiAnswerValue contains any custom value.
 */
declare function hasCustomValue(answers: MultiAnswerValue): boolean;
/**
 * Get the custom value text from a MultiAnswerValue, if present.
 */
declare function getCustomValueText(answers: MultiAnswerValue): string | undefined;
/**
 * Check if a MultiAnswerValue contains a specific preset value.
 */
declare function hasPresetValue(answers: MultiAnswerValue, value: string): boolean;
/**
 * Extract the raw string value from an AnswerValue for display or storage.
 * For custom values, returns the user-entered text.
 * For preset values, returns the preset value.
 */
declare function extractAnswerValue(answer: AnswerValue): string;
/**
 * Extract all raw string values from a MultiAnswerValue.
 */
declare function extractMultiAnswerValues(answers: MultiAnswerValue): string[];
interface TypeformStyles {
    container?: React.CSSProperties;
    question?: React.CSSProperties;
    questionNumber?: React.CSSProperties;
    questionTitle?: React.CSSProperties;
    questionDescription?: React.CSSProperties;
    card?: React.CSSProperties;
    cardSelected?: React.CSSProperties;
    cardHovered?: React.CSSProperties;
    cardLabel?: React.CSSProperties;
    cardDescription?: React.CSSProperties;
    cardKey?: React.CSSProperties;
    cardCheckmark?: React.CSSProperties;
    input?: React.CSSProperties;
    textarea?: React.CSSProperties;
    progress?: React.CSSProperties;
    progressBar?: React.CSSProperties;
    progressText?: React.CSSProperties;
    navigation?: React.CSSProperties;
    buttonBack?: React.CSSProperties;
    buttonNext?: React.CSSProperties;
    buttonSubmit?: React.CSSProperties;
    buttonTerminate?: React.CSSProperties;
    completion?: React.CSSProperties;
    completionIcon?: React.CSSProperties;
    completionTitle?: React.CSSProperties;
    completionText?: React.CSSProperties;
    error?: React.CSSProperties;
}
interface TypeformTheme {
    colors?: {
        primary?: string;
        background?: string;
        card?: string;
        cardBorder?: string;
        text?: string;
        textMuted?: string;
    };
    spacing?: {
        questionGap?: number;
        contentMaxWidth?: number;
        pageGap?: number;
    };
    animation?: {
        duration?: number;
        easing?: string;
    };
    options?: {
        autoAdvance?: boolean;
        compact?: boolean;
    };
}
interface TypeformOption {
    value: string;
    label: string;
    description?: string;
}
interface BaseQuestion {
    id: string;
    question: string;
    description?: string;
    required?: boolean;
}
interface RadioQuestion extends BaseQuestion {
    type: 'radio';
    options: TypeformOption[];
}
interface CheckboxQuestion extends BaseQuestion {
    type: 'checkbox';
    options: TypeformOption[];
    minSelect?: number;
    maxSelect?: number;
}
interface TextQuestion extends BaseQuestion {
    type: 'text' | 'email';
    placeholder?: string;
    inputType?: 'text' | 'email' | 'tel' | 'url' | 'number';
}
interface TextareaQuestion extends BaseQuestion {
    type: 'textarea';
    placeholder?: string;
    rows?: number;
}
type PageCondition = {
    field: string;
    operator: 'equals' | 'notEquals';
    value: string;
} | {
    field: string;
    operator: 'includes' | 'notIncludes';
    value: string;
} | {
    field: string;
    operator: 'isEmpty' | 'isNotEmpty';
} | ((answers: TypeformAnswers) => boolean);
interface ContentQuestion {
    id: string;
    type: 'content';
    content: string;
    style?: 'default' | 'callout' | 'script' | 'info' | 'warning';
    condition?: PageCondition;
    question?: string;
    description?: string;
}
interface ArrayQuestion extends BaseQuestion {
    type: 'array';
    itemTemplate: {
        fields: TypeformQuestion[];
    };
    minItems?: number;
    maxItems?: number;
    addLabel?: string;
    removeLabel?: string;
    itemLabel?: (index: number) => string;
    summaryFields?: string[];
}
type TypeformInputQuestion = RadioQuestion | CheckboxQuestion | TextQuestion | TextareaQuestion | ArrayQuestion;
type TypeformQuestion = TypeformInputQuestion | ContentQuestion;
interface TypeformPage {
    id: string;
    title?: string;
    description?: string;
    questions: TypeformQuestion[];
    condition?: PageCondition;
}
interface TypeformConfig<T extends Record<string, unknown> = Record<string, unknown>> {
    questions?: TypeformQuestion[];
    pages?: TypeformPage[];
    schema?: ZodSchema<T>;
    onSubmit: (data: T) => void | Promise<void>;
    onStepChange?: (step: number, question: TypeformQuestion) => void;
    onPageChange?: (pageIndex: number, page: TypeformPage) => void;
    theme?: TypeformTheme;
    terminationAction?: {
        label: string;
        confirmText?: string;
        variant?: 'subtle' | 'outline' | 'filled';
        color?: string;
        onTerminate: (data: {
            partialData: Partial<T>;
            lastPageIndex: number;
            reason?: string;
        }) => void | Promise<void>;
    };
    initialValues?: Partial<T>;
}
type ArrayItemStatus = 'editing' | 'completed';
interface ArrayItemAnswer {
    _status: ArrayItemStatus;
    [key: string]: string | string[] | ArrayItemStatus;
}
type TypeformAnswerValue = AnswerValue | MultiAnswerValue | ArrayItemAnswer[] | string | string[];
type TypeformAnswers = Record<string, TypeformAnswerValue>;
type TypeformErrors = Record<string, string>;
interface TypeformState {
    currentIndex: number;
    answers: TypeformAnswers;
    errors: TypeformErrors;
    isSubmitting: boolean;
    isComplete: boolean;
}
interface TypeformActions {
    next: () => void;
    back: () => void;
    goTo: (index: number) => void;
    setAnswer: (questionId: string, value: TypeformAnswerValue) => void;
    setArrayItemAnswer: (questionId: string, itemIndex: number, fieldId: string, value: string | string[]) => void;
    submit: () => Promise<void>;
    reset: () => void;
}
interface UseTypeformReturn extends TypeformState, TypeformActions {
    currentQuestion: TypeformQuestion | null;
    currentPage: TypeformPage | null;
    currentPageIndex: number;
    pages: TypeformPage[];
    progress: number;
    isFirstQuestion: boolean;
    isLastQuestion: boolean;
    isFirstPage: boolean;
    isLastPage: boolean;
    canProceed: boolean;
    direction: 'forward' | 'backward';
    terminateAndSubmit: (reason?: string) => Promise<void>;
}
interface TypeformContextValue extends UseTypeformReturn {
    config: TypeformConfig;
    styles?: TypeformStyles;
}
interface TypeformSurveyProps {
    config: TypeformConfig;
    className?: string;
    styles?: TypeformStyles;
    children?: ReactNode;
    hideProgress?: boolean;
    /** Display mode: 'paginated' (default, one page at a time) or 'all' (all pages stacked) */
    mode?: 'paginated' | 'all';
    /** Optional wrapper per page section in 'all' mode. Receives the page and the rendered content. */
    renderPageSection?: (page: TypeformPage, content: ReactNode) => ReactNode;
}
interface TypeformRadioGroupProps {
    question: RadioQuestion;
    value: AnswerValue | undefined;
    onChange: (value: AnswerValue) => void;
    error?: string;
}
interface TypeformCheckboxGroupProps {
    question: CheckboxQuestion;
    value: MultiAnswerValue;
    onChange: (value: MultiAnswerValue) => void;
    error?: string;
}
interface TypeformTextInputProps {
    question: TextQuestion | TextareaQuestion;
    value: string;
    onChange: (value: string) => void;
    error?: string;
    onSubmit?: () => void;
}
interface TypeformProgressProps {
    current: number;
    total: number;
    showPercentage?: boolean;
}
interface TypeformNavigationProps {
    onBack: () => void;
    onNext: () => void;
    onSubmit: () => void;
    canGoBack: boolean;
    canGoNext: boolean;
    isLastQuestion: boolean;
    isSubmitting: boolean;
    terminationAction?: TypeformConfig['terminationAction'];
    onTerminate?: (reason?: string) => Promise<void>;
}
declare function createSurveyConfig<T extends Record<string, unknown>>(config: TypeformConfig<T>): TypeformConfig<T>;

declare function useTypeformContext(): TypeformContextValue;
declare function TypeformSurvey({ config, className, styles, hideProgress, mode, renderPageSection }: TypeformSurveyProps): react_jsx_runtime.JSX.Element;

declare function TypeformProgress({ current, total, showPercentage, usePortal, }: TypeformProgressProps & {
    usePortal?: boolean;
}): react_jsx_runtime.JSX.Element;

declare function TypeformNavigation({ onBack, onNext, onSubmit, canGoBack, canGoNext, isLastQuestion, isSubmitting, terminationAction, onTerminate }: TypeformNavigationProps): react_jsx_runtime.JSX.Element;

interface TypeformQuestionWrapperProps {
    question: string;
    description?: string;
    questionNumber: number;
    isActive: boolean;
    children: ReactNode;
    error?: string;
    direction?: 'forward' | 'backward';
    theme?: {
        animation?: {
            duration?: number;
            easing?: string;
        };
        spacing?: {
            contentMaxWidth?: number;
        };
    };
    compact?: boolean;
    styles?: {
        question?: CSSProperties;
        questionNumber?: CSSProperties;
        questionTitle?: CSSProperties;
        questionDescription?: CSSProperties;
        error?: CSSProperties;
    };
}
/**
 * Wrapper for a single question (legacy, for backwards compatibility)
 */
declare function TypeformQuestionWrapper({ question, description, questionNumber, isActive, children, error, direction, theme, compact, styles: customStyles, }: TypeformQuestionWrapperProps): react_jsx_runtime.JSX.Element;

declare function TypeformRadioGroup({ question, value, onChange, error }: TypeformRadioGroupProps): react_jsx_runtime.JSX.Element;

declare function TypeformCheckboxGroup({ question, value, onChange, error }: TypeformCheckboxGroupProps): react_jsx_runtime.JSX.Element;

declare function TypeformTextInput({ question, value, onChange, error, onSubmit }: TypeformTextInputProps): react_jsx_runtime.JSX.Element;

interface TypeformArrayFieldProps {
    question: ArrayQuestion;
    value: ArrayItemAnswer[];
    onChange: (value: ArrayItemAnswer[]) => void;
    errors?: TypeformErrors;
    renderField: (question: TypeformQuestion, itemIndex: number, fieldId: string, value: string | string[], onFieldChange: (value: string | string[]) => void, error?: string) => React.ReactNode;
    theme?: TypeformTheme;
}
declare function TypeformArrayField({ question, value, onChange, errors, renderField, theme: _theme }: TypeformArrayFieldProps): react_jsx_runtime.JSX.Element;

declare function useTypeform(config: TypeformConfig): UseTypeformReturn;

/**
 * Shared hook for card styling used by RadioGroup and CheckboxGroup.
 * Ensures consistent styling and avoids duplication.
 */
declare function useCardStyle(): {
    getCardStyle: (isSelected: boolean, isHovered: boolean) => CSSProperties;
    getKeyStyle: (isSelected: boolean, isHovered: boolean) => CSSProperties;
    theme: TypeformTheme | undefined;
    styles: TypeformStyles | undefined;
};

declare const defaultTheme: TypeformTheme;
declare function mergeTheme(theme?: TypeformTheme): Required<TypeformTheme>;

/**
 * Brochure-style theme preset
 * Emulates the Black Tap brochure aesthetic with glass cards, dark background, and blue accent
 */
declare const brochureTheme: TypeformTheme;
/**
 * Brochure-style styles preset
 * Glass morphism cards with subtle borders and backdrop blur
 *
 * NOTE: Use backgroundColor for solid colors to avoid conflicts with Mantine's internal styles.
 * Only use background shorthand for gradients or complex backgrounds.
 */
declare const brochureStyles: TypeformStyles;

/**
 * Zod schemas for Typeform answer validation.
 * Separated from types.ts to avoid Next.js server/client boundary issues.
 */

/**
 * Zod schema for a single AnswerValue (preset or custom).
 */
declare const answerValueSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"preset">;
    value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"custom">;
    value: z.ZodString;
}, z.core.$strip>], "type">;
/**
 * Zod schema for MultiAnswerValue (array of AnswerValue).
 */
declare const multiAnswerValueSchema: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"preset">;
    value: z.ZodString;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"custom">;
    value: z.ZodString;
}, z.core.$strip>], "type">>;
/**
 * Create a Zod schema for a radio field with "Other" option.
 * Accepts either a preset value from the enum OR a custom value.
 *
 * @param presetValues - Array of valid preset values (e.g., ['hubspot', 'salesforce'])
 * @returns Zod schema that validates AnswerValue with preset constraint
 *
 * @example
 * const crmSchema = radioWithOtherSchema(['hubspot', 'salesforce', 'pipedrive'])
 * // Accepts: { type: 'preset', value: 'hubspot' }
 * // Accepts: { type: 'custom', value: 'Freshsales' }
 * // Rejects: { type: 'preset', value: 'invalid' }
 */
declare function radioWithOtherSchema<T extends string>(presetValues: readonly T[]): z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"preset">;
    value: z.ZodEnum<{ [k_1 in T]: k_1; } extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"custom">;
    value: z.ZodString;
}, z.core.$strip>], "type">;
/**
 * Create a Zod schema for a checkbox field with "Other" option.
 * Each selected value is either a preset or custom AnswerValue.
 *
 * @param presetValues - Array of valid preset values
 * @returns Zod schema that validates MultiAnswerValue with preset constraint
 *
 * @example
 * const toolsSchema = checkboxWithOtherSchema(['zapier', 'make', 'n8n'])
 * // Accepts: [{ type: 'preset', value: 'zapier' }, { type: 'custom', value: 'Tray.io' }]
 */
declare function checkboxWithOtherSchema<T extends string>(presetValues: readonly T[]): z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
    type: z.ZodLiteral<"preset">;
    value: z.ZodEnum<{ [k_1 in T]: k_1; } extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never>;
}, z.core.$strip>, z.ZodObject<{
    type: z.ZodLiteral<"custom">;
    value: z.ZodString;
}, z.core.$strip>], "type">>;

export { TypeformArrayField, TypeformCheckboxGroup, TypeformNavigation, TypeformProgress, TypeformQuestionWrapper, TypeformRadioGroup, TypeformSurvey, TypeformTextInput, answerValueSchema, brochureStyles, brochureTheme, checkboxWithOtherSchema, createCustomValue, createPresetValue, createSurveyConfig, defaultTheme, extractAnswerValue, extractMultiAnswerValues, getAnswerString, getCustomValueText, getMultiAnswerStrings, hasCustomValue, hasPresetValue, isCustomValue, isPresetValue, mergeTheme, multiAnswerValueSchema, radioWithOtherSchema, useCardStyle, useTypeform, useTypeformContext };
export type { AnswerValue, ArrayItemAnswer, ArrayQuestion, BaseQuestion, CheckboxQuestion, ContentQuestion, MultiAnswerValue, PageCondition, RadioQuestion, TextQuestion, TextareaQuestion, TypeformActions, TypeformAnswerValue, TypeformAnswers, TypeformArrayFieldProps, TypeformCheckboxGroupProps, TypeformConfig, TypeformContextValue, TypeformErrors, TypeformInputQuestion, TypeformNavigationProps, TypeformOption, TypeformPage, TypeformProgressProps, TypeformQuestion, TypeformRadioGroupProps, TypeformState, TypeformStyles, TypeformSurveyProps, TypeformTextInputProps, TypeformTheme, UseTypeformReturn };
