import { c as _c } from "react/compiler-runtime";
import * as React from 'react';
import { Box, Text } from '../../ink.js';
import { useKeybinding } from '../../keybindings/useKeybinding.js';
import type { PromptRequest } from '../../types/hooks.js';
import { Select } from '../CustomSelect/select.js';
import { PermissionDialog } from '../permissions/PermissionDialog.js';
type Props = {
  title: string;
  toolInputSummary?: string | null;
  request: PromptRequest;
  onRespond: (key: string) => void;
  onAbort: () => void;
};
export function PromptDialog(t0) {
  const $ = _c(15);
  const {
    title,
    toolInputSummary,
    request,
    onRespond,
    onAbort
  } = t0;
  let t1;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = {
      isActive: true
    };
    $[0] = t1;
  } else {
    t1 = $[0];
  }
  useKeybinding("app:interrupt", onAbort, t1);
  let t2;
  if ($[1] !== request.options) {
    t2 = request.options.map(_temp);
    $[1] = request.options;
    $[2] = t2;
  } else {
    t2 = $[2];
  }
  const options = t2;
  let t3;
  if ($[3] !== toolInputSummary) {
    t3 = toolInputSummary ? <Text dimColor={true}>{toolInputSummary}</Text> : undefined;
    $[3] = toolInputSummary;
    $[4] = t3;
  } else {
    t3 = $[4];
  }
  let t4;
  if ($[5] !== onRespond) {
    t4 = value => {
      onRespond(value);
    };
    $[5] = onRespond;
    $[6] = t4;
  } else {
    t4 = $[6];
  }
  let t5;
  if ($[7] !== options || $[8] !== t4) {
    t5 = <Box flexDirection="column" paddingY={1}><Select options={options} onChange={t4} /></Box>;
    $[7] = options;
    $[8] = t4;
    $[9] = t5;
  } else {
    t5 = $[9];
  }
  let t6;
  if ($[10] !== request.message || $[11] !== t3 || $[12] !== t5 || $[13] !== title) {
    t6 = <PermissionDialog title={title} subtitle={request.message} titleRight={t3}>{t5}</PermissionDialog>;
    $[10] = request.message;
    $[11] = t3;
    $[12] = t5;
    $[13] = title;
    $[14] = t6;
  } else {
    t6 = $[14];
  }
  return t6;
}
function _temp(opt) {
  return {
    label: opt.label,
    value: opt.key,
    description: opt.description
  };
}
//# sourceMappingURL=data:application/json;charset=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