import {
  codexRoundedUrl,
  geminiRoundedUrl,
  hermesRoundedUrl,
  manageAgentClaudeCodeUrl,
  manageAgentNextopUrl,
  openclawRoundedUrl
} from "./chunk-ZU3FKYMG.js";

// agent-gui/agentGuiNode/model/agentGuiRailLayout.ts
function clamp(value, min, max) {
  return Math.min(max, Math.max(min, value));
}
var AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX = 280;
var AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX = 248;
var AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX = 520;
var AGENT_GUI_DETAIL_MIN_WIDTH_PX = 220;
var AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX = 10;
var AGENT_GUI_COLLAPSED_MIN_WIDTH_PX = 460;
var AGENT_GUI_EXPANDED_MIN_WIDTH_PX = AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;
var AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX = 610;
var AGENT_GUI_EXPANDED_TARGET_WIDTH_PX = 800;
function shouldAutoCollapseAgentGUIConversationRail(containerWidthPx) {
  return Number.isFinite(containerWidthPx) && containerWidthPx > 0 && containerWidthPx <= AGENT_GUI_AUTO_COLLAPSE_WIDTH_PX;
}
function resolveAgentGUIConversationRailMaxWidthPx(containerWidthPx) {
  const safeContainerWidth = Number.isFinite(containerWidthPx) && containerWidthPx > 0 ? containerWidthPx : AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX;
  return Math.max(
    AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
    Math.min(
      AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX,
      safeContainerWidth - AGENT_GUI_DETAIL_MIN_WIDTH_PX - AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX
    )
  );
}
function clampAgentGUIConversationRailWidthPx(widthPx, containerWidthPx) {
  const preferredWidthPx = typeof widthPx === "number" && Number.isFinite(widthPx) ? Math.round(widthPx) : null;
  return clamp(
    preferredWidthPx ?? AGENT_GUI_CONVERSATION_RAIL_DEFAULT_WIDTH_PX,
    AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
    resolveAgentGUIConversationRailMaxWidthPx(containerWidthPx)
  );
}
function resolveNextAgentGUIConversationRailWidthPx(input) {
  const nextWidthPx = clampAgentGUIConversationRailWidthPx(
    input.requestedWidthPx,
    input.containerWidthPx
  );
  if (input.currentWidthPx === nextWidthPx) {
    return input.currentWidthPx;
  }
  if (input.currentWidthPx === null || input.currentWidthPx === void 0) {
    const defaultWidthPx = clampAgentGUIConversationRailWidthPx(
      null,
      input.containerWidthPx
    );
    if (nextWidthPx === defaultWidthPx) {
      return null;
    }
  }
  return nextWidthPx;
}
function resolveAgentGUIExpandedWindowFrame(input) {
  const desiredRailWidthPx = clampAgentGUIConversationRailWidthPx(
    input.conversationRailWidthPx,
    AGENT_GUI_CONVERSATION_RAIL_MAX_WIDTH_PX + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX
  );
  const desiredWidthPx = Math.max(
    Math.round(input.width),
    desiredRailWidthPx + AGENT_GUI_DETAIL_MIN_WIDTH_PX + AGENT_GUI_RAIL_RESIZE_HANDLE_WIDTH_PX,
    AGENT_GUI_EXPANDED_MIN_WIDTH_PX,
    AGENT_GUI_EXPANDED_TARGET_WIDTH_PX
  );
  const desktopWidthPx = Number.isFinite(input.desktopSize.width) && input.desktopSize.width > 0 ? Math.round(input.desktopSize.width) : desiredWidthPx;
  const nextWidthPx = Math.min(desiredWidthPx, desktopWidthPx);
  const maxX = Math.max(0, desktopWidthPx - nextWidthPx);
  const nextX = clamp(Math.round(input.position.x), 0, maxX);
  return {
    position: {
      x: nextX,
      y: input.position.y
    },
    size: {
      width: nextWidthPx,
      height: input.height
    }
  };
}

// dockIcons.ts
var agentGuiDockIconUrl = codexRoundedUrl;
var agentGuiDockIconUrls = {
  "claude-code": manageAgentClaudeCodeUrl,
  codex: codexRoundedUrl,
  gemini: geminiRoundedUrl,
  hermes: hermesRoundedUrl,
  nexight: manageAgentNextopUrl,
  openclaw: openclawRoundedUrl
};

export {
  AGENT_GUI_CONVERSATION_RAIL_MIN_WIDTH_PX,
  AGENT_GUI_DETAIL_MIN_WIDTH_PX,
  AGENT_GUI_COLLAPSED_MIN_WIDTH_PX,
  shouldAutoCollapseAgentGUIConversationRail,
  resolveAgentGUIConversationRailMaxWidthPx,
  clampAgentGUIConversationRailWidthPx,
  resolveNextAgentGUIConversationRailWidthPx,
  resolveAgentGUIExpandedWindowFrame,
  agentGuiDockIconUrl,
  agentGuiDockIconUrls
};
//# sourceMappingURL=chunk-GYG57VTA.js.map