import { c as _c } from "react-compiler-runtime";
import { resolve as resolvePath } from 'path';
import * as React from 'react';
import { useEffect, useRef, useState } from 'react';
import { useRegisterOverlay } from '../context/overlayContext.js';
import { useTerminalSize } from '../hooks/useTerminalSize.js';
import { Text } from '../ink.js';
import { logEvent } from '../services/analytics/index.js';
import { getCwd } from '../utils/cwd.js';
import { openFileInExternalEditor } from '../utils/editor.js';
import { truncatePathMiddle, truncateToWidth } from '../utils/format.js';
import { highlightMatch } from '../utils/highlightMatch.js';
import { relativePath } from '../utils/permissions/filesystem.js';
import { readFileInRange } from '../utils/readFileInRange.js';
import { ripGrepStream } from '../utils/ripgrep.js';
import { FuzzyPicker } from './design-system/FuzzyPicker.js';
import { LoadingState } from './design-system/LoadingState.js';
type Props = {
  onDone: () => void;
  onInsert: (text: string) => void;
};
type Match = {
  file: string;
  line: number;
  text: string;
};
const VISIBLE_RESULTS = 12;
const DEBOUNCE_MS = 100;
const PREVIEW_CONTEXT_LINES = 4;
// rg -m is per-file; we also cap the parsed array to keep memory bounded.
const MAX_MATCHES_PER_FILE = 10;
const MAX_TOTAL_MATCHES = 500;

/**
 * Global Search dialog (ctrl+shift+f / cmd+shift+f).
 * Debounced ripgrep search across the workspace.
 */
export function GlobalSearchDialog(t0) {
  const $ = _c(40);
  const {
    onDone,
    onInsert
  } = t0;
  useRegisterOverlay("global-search");
  const {
    columns,
    rows
  } = useTerminalSize();
  const previewOnRight = columns >= 140;
  const visibleResults = Math.min(VISIBLE_RESULTS, Math.max(4, rows - 14));
  let t1;
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
    t1 = [];
    $[0] = t1;
  } else {
    t1 = $[0];
  }
  const [matches, setMatches] = useState(t1);
  const [truncated, setTruncated] = useState(false);
  const [isSearching, setIsSearching] = useState(false);
  const [query, setQuery] = useState("");
  const [focused, setFocused] = useState(undefined);
  const [preview, setPreview] = useState(null);
  const abortRef = useRef(null);
  const timeoutRef = useRef(null);
  let t2;
  let t3;
  if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
    t2 = () => () => {
      if (timeoutRef.current) {
        clearTimeout(timeoutRef.current);
      }
      abortRef.current?.abort();
    };
    t3 = [];
    $[1] = t2;
    $[2] = t3;
  } else {
    t2 = $[1];
    t3 = $[2];
  }
  useEffect(t2, t3);
  let t4;
  let t5;
  if ($[3] !== focused) {
    t4 = () => {
      if (!focused) {
        setPreview(null);
        return;
      }
      const controller = new AbortController();
      const absolute = resolvePath(getCwd(), focused.file);
      const start = Math.max(0, focused.line - PREVIEW_CONTEXT_LINES - 1);
      readFileInRange(absolute, start, PREVIEW_CONTEXT_LINES * 2 + 1, undefined, controller.signal).then(r => {
        if (controller.signal.aborted) {
          return;
        }
        setPreview({
          file: focused.file,
          line: focused.line,
          content: r.content
        });
      }).catch(() => {
        if (controller.signal.aborted) {
          return;
        }
        setPreview({
          file: focused.file,
          line: focused.line,
          content: "(preview unavailable)"
        });
      });
      return () => controller.abort();
    };
    t5 = [focused];
    $[3] = focused;
    $[4] = t4;
    $[5] = t5;
  } else {
    t4 = $[4];
    t5 = $[5];
  }
  useEffect(t4, t5);
  let t6;
  if ($[6] === Symbol.for("react.memo_cache_sentinel")) {
    t6 = q => {
      setQuery(q);
      if (timeoutRef.current) {
        clearTimeout(timeoutRef.current);
      }
      abortRef.current?.abort();
      if (!q.trim()) {
        setMatches(_temp);
        setIsSearching(false);
        setTruncated(false);
        return;
      }
      const controller_0 = new AbortController();
      abortRef.current = controller_0;
      setIsSearching(true);
      setTruncated(false);
      const queryLower = q.toLowerCase();
      setMatches(m_0 => {
        const filtered = m_0.filter(match => match.text.toLowerCase().includes(queryLower));
        return filtered.length === m_0.length ? m_0 : filtered;
      });
      timeoutRef.current = setTimeout(_temp4, DEBOUNCE_MS, q, controller_0, setMatches, setTruncated, setIsSearching);
    };
    $[6] = t6;
  } else {
    t6 = $[6];
  }
  const handleQueryChange = t6;
  const listWidth = previewOnRight ? Math.floor((columns - 10) * 0.5) : columns - 8;
  const maxPathWidth = Math.max(20, Math.floor(listWidth * 0.4));
  const maxTextWidth = Math.max(20, listWidth - maxPathWidth - 4);
  const previewWidth = previewOnRight ? Math.max(40, columns - listWidth - 14) : columns - 6;
  let t7;
  if ($[7] !== matches.length || $[8] !== onDone) {
    t7 = m_3 => {
      const opened = openFileInExternalEditor(resolvePath(getCwd(), m_3.file), m_3.line);
      logEvent("tengu_global_search_select", {
        result_count: matches.length,
        opened_editor: opened
      });
      onDone();
    };
    $[7] = matches.length;
    $[8] = onDone;
    $[9] = t7;
  } else {
    t7 = $[9];
  }
  const handleOpen = t7;
  let t8;
  if ($[10] !== matches.length || $[11] !== onDone || $[12] !== onInsert) {
    t8 = (m_4, mention) => {
      onInsert(mention ? `@${m_4.file}#L${m_4.line} ` : `${m_4.file}:${m_4.line} `);
      logEvent("tengu_global_search_insert", {
        result_count: matches.length,
        mention
      });
      onDone();
    };
    $[10] = matches.length;
    $[11] = onDone;
    $[12] = onInsert;
    $[13] = t8;
  } else {
    t8 = $[13];
  }
  const handleInsert = t8;
  const matchLabel = matches.length > 0 ? `${matches.length}${truncated ? "+" : ""} matches${isSearching ? "\u2026" : ""}` : " ";
  const t9 = previewOnRight ? "right" : "bottom";
  let t10;
  if ($[14] !== handleInsert) {
    t10 = {
      action: "mention",
      handler: m_5 => handleInsert(m_5, true)
    };
    $[14] = handleInsert;
    $[15] = t10;
  } else {
    t10 = $[15];
  }
  let t11;
  if ($[16] !== handleInsert) {
    t11 = {
      action: "insert path",
      handler: m_6 => handleInsert(m_6, false)
    };
    $[16] = handleInsert;
    $[17] = t11;
  } else {
    t11 = $[17];
  }
  let t12;
  if ($[18] !== isSearching) {
    t12 = q_0 => isSearching ? "Searching\u2026" : q_0 ? "No matches" : "Type to search\u2026";
    $[18] = isSearching;
    $[19] = t12;
  } else {
    t12 = $[19];
  }
  let t13;
  if ($[20] !== maxPathWidth || $[21] !== maxTextWidth || $[22] !== query) {
    t13 = (m_7, isFocused) => <Text color={isFocused ? "suggestion" : undefined}><Text dimColor={true}>{truncatePathMiddle(m_7.file, maxPathWidth)}:{m_7.line}</Text>{" "}{highlightMatch(truncateToWidth(m_7.text.trimStart(), maxTextWidth), query)}</Text>;
    $[20] = maxPathWidth;
    $[21] = maxTextWidth;
    $[22] = query;
    $[23] = t13;
  } else {
    t13 = $[23];
  }
  let t14;
  if ($[24] !== preview || $[25] !== previewWidth || $[26] !== query) {
    t14 = m_8 => preview?.file === m_8.file && preview.line === m_8.line ? <><Text dimColor={true}>{truncatePathMiddle(m_8.file, previewWidth)}:{m_8.line}</Text>{preview.content.split("\n").map((line_0, i) => <Text key={i}>{highlightMatch(truncateToWidth(line_0, previewWidth), query)}</Text>)}</> : <LoadingState message={"Loading\u2026"} dimColor={true} />;
    $[24] = preview;
    $[25] = previewWidth;
    $[26] = query;
    $[27] = t14;
  } else {
    t14 = $[27];
  }
  let t15;
  if ($[28] !== handleOpen || $[29] !== matchLabel || $[30] !== matches || $[31] !== onDone || $[32] !== t10 || $[33] !== t11 || $[34] !== t12 || $[35] !== t13 || $[36] !== t14 || $[37] !== t9 || $[38] !== visibleResults) {
    t15 = <FuzzyPicker title="Global Search" placeholder={"Type to search\u2026"} items={matches} getKey={matchKey} visibleCount={visibleResults} direction="up" previewPosition={t9} onQueryChange={handleQueryChange} onFocus={setFocused} onSelect={handleOpen} onTab={t10} onShiftTab={t11} onCancel={onDone} emptyMessage={t12} matchLabel={matchLabel} selectAction="open in editor" renderItem={t13} renderPreview={t14} />;
    $[28] = handleOpen;
    $[29] = matchLabel;
    $[30] = matches;
    $[31] = onDone;
    $[32] = t10;
    $[33] = t11;
    $[34] = t12;
    $[35] = t13;
    $[36] = t14;
    $[37] = t9;
    $[38] = visibleResults;
    $[39] = t15;
  } else {
    t15 = $[39];
  }
  return t15;
}
function _temp4(query_0, controller_1, setMatches_0, setTruncated_0, setIsSearching_0) {
  const cwd = getCwd();
  let collected = 0;
  ripGrepStream(["-n", "--no-heading", "-i", "-m", String(MAX_MATCHES_PER_FILE), "-F", "-e", query_0], cwd, controller_1.signal, lines => {
    if (controller_1.signal.aborted) {
      return;
    }
    const parsed = [];
    for (const line of lines) {
      const m_1 = parseRipgrepLine(line);
      if (!m_1) {
        continue;
      }
      const rel = relativePath(cwd, m_1.file);
      parsed.push({
        ...m_1,
        file: rel.startsWith("..") ? m_1.file : rel
      });
    }
    if (!parsed.length) {
      return;
    }
    collected = collected + parsed.length;
    collected;
    setMatches_0(prev => {
      const seen = new Set(prev.map(matchKey));
      const fresh = parsed.filter(p => !seen.has(matchKey(p)));
      if (!fresh.length) {
        return prev;
      }
      const next = prev.concat(fresh);
      return next.length > MAX_TOTAL_MATCHES ? next.slice(0, MAX_TOTAL_MATCHES) : next;
    });
    if (collected >= MAX_TOTAL_MATCHES) {
      controller_1.abort();
      setTruncated_0(true);
      setIsSearching_0(false);
    }
  }).catch(_temp2).finally(() => {
    if (controller_1.signal.aborted) {
      return;
    }
    if (collected === 0) {
      setMatches_0(_temp3);
    }
    setIsSearching_0(false);
  });
}
function _temp3(m_2) {
  return m_2.length ? [] : m_2;
}
function _temp2() {}
function _temp(m) {
  return m.length ? [] : m;
}
function matchKey(m: Match): string {
  return `${m.file}:${m.line}`;
}

/**
 * Parse a ripgrep -n --no-heading output line: "path:line:text".
 * Windows paths may contain a drive letter ("C:\..."), so a simple split on
 * the first colon would mangle the path — use a regex that captures up to
 * the first :<digits>: instead.
 * @internal exported for testing
 */
export function parseRipgrepLine(line: string): Match | null {
  const m = /^(.*?):(\d+):(.*)$/.exec(line);
  if (!m) return null;
  const [, file, lineStr, text] = m;
  const lineNum = Number(lineStr);
  if (!file || !Number.isFinite(lineNum)) return null;
  return {
    file,
    line: lineNum,
    text: text ?? ''
  };
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJyZXNvbHZlIiwicmVzb2x2ZVBhdGgiLCJSZWFjdCIsInVzZUVmZmVjdCIsInVzZVJlZiIsInVzZVN0YXRlIiwidXNlUmVnaXN0Z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m5cbiAgICAgICAgc2V0UHJldmlldyh7XG4gICAgICAgICAgZmlsZTogZm9jdXNlZC5maWxlLFxuICAgICAgICAgIGxpbmU6IGZvY3VzZWQubGluZSxcbiAgICAgICAgICBjb250ZW50OiByLmNvbnRlbnQsXG4gICAgICAgIH0pXG4gICAgICB9KVxuICAgICAgLmNhdGNoKCgpID0+IHtcbiAgICAgICAgaWYgKGNvbnRyb2xsZXIuc2lnbmFsLmFib3J0ZWQpIHJldHVyblxuICAgICAgICBzZXRQcmV2aWV3KHtcbiAgICAgICAgICBmaWxlOiBmb2N1c2VkLmZpbGUsXG4gICAgICAgICAgbGluZTogZm9jdXNlZC5saW5lLFxuICAgICAgICAgIGNvbnRlbnQ6ICcocHJldmlldyB1bmF2YWlsYWJsZSknLFxuICAgICAgICB9KVxuICAgICAgfSlcbiAgICByZXR1cm4gKCkgPT4gY29udHJvbGxlci5hYm9ydCgpXG4gIH0sIFtmb2N1c2VkXSlcblxuICBjb25zdCBoYW5kbGVRdWVyeUNoYW5nZSA9IChxOiBzdHJpbmcpID0+IHtcbiAgICBzZXRRdWVyeShxKVxuICAgIGlmICh0aW1lb3V0UmVmLmN1cnJlbnQpIGNsZWFyVGltZW91dCh0aW1lb3V0UmVmLmN1cnJlbnQpXG4gICAgYWJvcnRSZWYuY3VycmVudD8uYWJvcnQoKVxuXG4gICAgaWYgKCFxLnRyaW0oKSkge1xuICAgICAgc2V0TWF0Y2hlcyhtID0+IChtLmxlbmd0aCA/IFtdIDogbSkpXG4gICAgICBzZXRJc1NlYXJjaGluZyhmYWxzZSlcbiAgICAgIHNldFRydW5jYXRlZChmYWxzZSlcbiAgICAgIHJldHVyblxuICAgIH1cbiAgICBjb25zdCBjb250cm9sbGVyID0gbmV3IEFib3J0Q29udHJvbGxlcigpXG4gICAgYWJvcnRSZWYuY3VycmVudCA9IGNvbnRyb2xsZXJcbiAgICBzZXRJc1NlYXJjaGluZyh0cnVlKVxuICAgIHNldFRydW5jYXRlZChmYWxzZSlc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4gICAgICAgICAgLy8gc2FtZSBwcmVjYXV0aW9uLlxuICAgICAgICAgIFtcbiAgICAgICAgICAgICctbicsXG4gICAgICAgICAgICAnLS1uby1oZWFkaW5nJyxcbiAgICAgICAgICAgICctaScsXG4gICAgICAgICAgICAnLW0nLFxuICAgICAgICAgICAgU3RyaW5nKE1BWF9NQVRDSEVTX1BFUl9GSUxFKSxcbiAgICAgICAgICAgICctRicsXG4gICAgICAgICAgICAnLWUnLFxuICAgICAgICAgICAgcXVlcnksXG4gICAgICAgICAgXSxcbiAgICAgICAgICBjd2QsXG4gICAgICAgICAgY29udHJvbGxlci5zaWduYWwsXG4gICAgICAgICAgbGluZXMgPT4ge1xuICAgICAgICAgICAgaWYgKGNvbnRyb2xsZXIuc2lnbmFsLmFib3J0ZWQpIHJldHVyblxuICAgICAgICAgICAgY29uc3QgcGFyc2VkOiBNYXRjaFtdID0gW11cbiAgICAgICAgICAgIGZvciAoY29uc3QgbGluZSBvZiBsaW5lcykge1xuICAgICAgICAgICAgICBjb25zdCBtID0gcGFyc2VSaXBncmVwTGluZShsaW5lKVxuICAgICAgICAgICAgICBpZiAoIW0pIGNvbnRpbnVlXG4gICAgICAgICAgICAgIGNvbnN0IHJlbCA9IHJlbGF0aXZlUGF0aChjd2QsIG0uZmlsZSlcbiAgICAgICAgICAgICAgcGFyc2VkLnB1c2goeyAuLi5tLCBmaWxlOiByZWwuc3RhcnRzV2l0aCgnLi4nKSA/IG0uZmlsZSA6IHJlbCB9KVxuICAgICAgICAgICAgfVxuICAgICAgICAgICAgaWYgKCFwYXJzZWQubGVuZ3RoKSByZXR1cm5cbiAgICAgICAgICAgIGNvbGxlY3RlZCArPSBwYXJzZWQubGVuZ3RoXG4gICAgICAgICAgICBzZXRNYXRjaGVzKHByZXYgPT4ge1xuICAgICAgICAgICAgICAvLyBBcHBlbmQrZGVkdXBlIGluc3RlYWQgb2YgcmVwbGFjZTogcHJldiBtYXkgaG9sZCBjbGllbnQtXG4gICAgICAgICAgICA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gICAgICA8VGV4dCBkaW1Db2xvcj5cbiAgICAgICAgICAgIHt0cnVuY2F0ZVBhdGhNaWRkbGUobS5maWxlLCBtYXhQYXRoV2lkdGgpfTp7bS5saW5lfVxuICAgICAgICAgIDwvVGV4dD57JyAnfVxuICAgICAgICAgIHtoaWdobGlnaHRNYXRjaChcbiAgICAgICAgICAgIHRydW5jYXRlVG9XaWR0aChtLnRleHQudHJpbVN0YXJ0KCksIG1heFRleHRXaWR0aCksXG4gICAgICAgICAgICBxdWVyeSxcbiAgICAgICAgICApfVxuICAgICAgICA8L1RleHQ+XG4gICAgICApfVxuICAgICAgcmVuZGVyUHJldmlldz17bSA9PlxuICAgICAgICBwcmV2aWV3Py5maWxlID09PSBtLmZpbGUgJiYgcHJldmlldy5saW5lID09PSBtLmxpbmUgPyAoXG4gICAgICAgICAgPD5cbiAgICAgICAgICAgIDxUZXh0IGRpbUNvbG9yPlxuICAgICAgICAgICAgICB7dHJ1bmNhdGVQYXRoTWlkZGxlKG0uZmlsZSwgcHJldmlld1dpZHRoKX06e20ubGluZX1cbiAgICAgICAgICAgIDwvVGV4dD5cbiAgICAgICAgICAgIHtwcmV2aWV3LmNvbnRlbnQuc3BsaXQoJ1xcbicpLm1hcCgobGluZSwgaSkgPT4gKFxuICAgICAgICAgICAgICA8VGV4dCBrZXk9e2l9PlxuICAgICAgICAgICAgICAgIHtoaWdobGlnaHRNYXRjaCh0cnVuY2F0ZVRvV2lkdGgobGluZSwgcHJldmlld1dpZHRoKSwgcXVlcnkpfVxuICAgICAgICAgICAgICA8L1RleHQ+XG4gICAgICAgICAgICApKX1cbiAgICAgICAgICA8Lz5cbiAgICAgICAgKSA6IChcbiAgICAgICAgICA8TG9hZGluZ1N0YXRlIG1lc3NhZ2U9XCJMb2FkaW5n4oCmXCIgZGltQ29sb3IgLz5cbiAgICAgICAgKVxuICAgICAgfVxuICAgIC8+XG4gIClcbn1cblxuZnVuY3Rpb24gbWF0Y2hLZXkobTogTWF0Y2gpOiBzd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