import {} from 'recoil';
import * as z from 'zod/v4';
import {} from '@darajs/styled-components';
import { useNotifications } from '@darajs/ui-notifications';
import {} from '@darajs/ui-utils';
import {} from '../api/http';
import {} from '../api/websocket';
/**
 * Create a RouteMatch array from a UIMatch array and a definition map
 *
 * @param uiMatches UI matches
 * @param definitionMap definition map
 */
export function createRouteMatches(uiMatches, definitionMap) {
    return uiMatches
        .filter((m) => definitionMap.has(m.id))
        .map((m) => {
        const routeDef = definitionMap.get(m.id);
        return {
            id: m.id,
            pathname: m.pathname,
            params: m.params,
            definition: routeDef,
        };
    });
}
export function isPathParamStore(store) {
    return store.__typename === '_PathParamStore';
}
export function isRouteMatchStore(store) {
    return store.__typename === '_RouteMatchStore';
}
export var ComponentType;
(function (ComponentType) {
    ComponentType["JS"] = "js";
    ComponentType["PY"] = "py";
})(ComponentType || (ComponentType = {}));
export function isRawString(instance) {
    return instance.name === 'RawString';
}
export function isInvalidComponent(instance) {
    return instance.name === 'InvalidComponent';
}
export var ConditionOperator;
(function (ConditionOperator) {
    ConditionOperator["EQUAL"] = "equal";
    ConditionOperator["GREATER_EQUAL"] = "greater_equal";
    ConditionOperator["GREATER_THAN"] = "greater_than";
    ConditionOperator["LESS_EQUAL"] = "less_equal";
    ConditionOperator["LESS_THAN"] = "less_than";
    ConditionOperator["NOT_EQUAL"] = "not_equal";
    ConditionOperator["TRUTHY"] = "truthy";
})(ConditionOperator || (ConditionOperator = {}));
export const ActionImpl = z.looseObject({
    name: z.string(),
    __typename: z.literal('ActionImpl'),
});
/**
 * User-visible error.
 * When thrown, our built-in error boundary will display its `message` property rather than a default blurb.
 */
export class UserError extends Error {
}
/**
 * Error thrown when a page loader throws an error.
 * Usually caused by on_load action errors.
 */
export class LoaderError extends Error {
    constructor(payload) {
        super(payload.stacktrace);
        this.name = 'LoaderError';
        this.payload = payload;
    }
}
//# sourceMappingURL=core.js.map