
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bd1946dd-8fc2-5914-9c84-0f3b56eacd31")}catch(e){}}();
export const DEFAULT_KANBAN_RUNTIME_HOST = "127.0.0.1";
export const DEFAULT_KANBAN_RUNTIME_PORT = 3484;
let runtimeHost = process.env.KANBAN_RUNTIME_HOST?.trim() || DEFAULT_KANBAN_RUNTIME_HOST;
export function getKanbanRuntimeHost() {
    return runtimeHost;
}
export function setKanbanRuntimeHost(host) {
    runtimeHost = host;
    process.env.KANBAN_RUNTIME_HOST = host;
}
export function parseRuntimePort(rawPort) {
    if (!rawPort) {
        return DEFAULT_KANBAN_RUNTIME_PORT;
    }
    const parsed = Number.parseInt(rawPort, 10);
    if (!Number.isFinite(parsed) || parsed < 1 || parsed > 65535) {
        throw new Error(`Invalid KANBAN_RUNTIME_PORT value "${rawPort}". Expected an integer from 1-65535.`);
    }
    return parsed;
}
let runtimePort = parseRuntimePort(process.env.KANBAN_RUNTIME_PORT?.trim());
export function getKanbanRuntimePort() {
    return runtimePort;
}
export function setKanbanRuntimePort(port) {
    const normalized = parseRuntimePort(String(port));
    runtimePort = normalized;
    process.env.KANBAN_RUNTIME_PORT = String(normalized);
}
export function getKanbanRuntimeOrigin() {
    return `http://${getKanbanRuntimeHost()}:${getKanbanRuntimePort()}`;
}
export function getKanbanRuntimeWsOrigin() {
    return `ws://${getKanbanRuntimeHost()}:${getKanbanRuntimePort()}`;
}
export function buildKanbanRuntimeUrl(pathname) {
    const normalizedPath = pathname.startsWith("/") ? pathname : `/${pathname}`;
    return `${getKanbanRuntimeOrigin()}${normalizedPath}`;
}
export function buildKanbanRuntimeWsUrl(pathname) {
    const normalizedPath = pathname.startsWith("/") ? pathname : `/${pathname}`;
    return `${getKanbanRuntimeWsOrigin()}${normalizedPath}`;
}
//# sourceMappingURL=runtime-endpoint.js.map
//# debugId=bd1946dd-8fc2-5914-9c84-0f3b56eacd31
