"use client";
import { cn } from "../../lib/utils.js";
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "../ui/collapsible.js";
import { c } from "react/compiler-runtime";
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { BookIcon, ChevronDownIcon } from "lucide-react";
const Sources = (i) => {
	let a = c(8), o, s;
	a[0] === i ? (o = a[1], s = a[2]) : ({className: o, ...s} = i, a[0] = i, a[1] = o, a[2] = s);
	let l;
	a[3] === o ? l = a[4] : (l = cn("not-prose text-primary mb-4 text-xs", o), a[3] = o, a[4] = l);
	let u;
	return a[5] !== s || a[6] !== l ? (u = /* @__PURE__ */ jsx(Collapsible, {
		className: l,
		...s
	}), a[5] = s, a[6] = l, a[7] = u) : u = a[7], u;
}, SourcesTrigger = (r) => {
	let i = c(14), l, d, f, p;
	i[0] === r ? (l = i[1], d = i[2], f = i[3], p = i[4]) : ({className: d, count: f, children: l, ...p} = r, i[0] = r, i[1] = l, i[2] = d, i[3] = f, i[4] = p);
	let m;
	i[5] === d ? m = i[6] : (m = cn("flex items-center gap-2", d), i[5] = d, i[6] = m);
	let h;
	i[7] !== l || i[8] !== f ? (h = l ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("p", {
		className: "font-medium",
		children: [
			"Used ",
			f,
			" sources"
		]
	}), /* @__PURE__ */ jsx(ChevronDownIcon, { className: "h-4 w-4" })] }), i[7] = l, i[8] = f, i[9] = h) : h = i[9];
	let g;
	return i[10] !== p || i[11] !== m || i[12] !== h ? (g = /* @__PURE__ */ jsx(CollapsibleTrigger, {
		className: m,
		...p,
		children: h
	}), i[10] = p, i[11] = m, i[12] = h, i[13] = g) : g = i[13], g;
}, SourcesContent = (r) => {
	let a = c(8), o, s;
	a[0] === r ? (o = a[1], s = a[2]) : ({className: o, ...s} = r, a[0] = r, a[1] = o, a[2] = s);
	let l;
	a[3] === o ? l = a[4] : (l = cn("mt-3 flex w-fit flex-col gap-2", "data-[state=closed]:fade-out-0 data-[state=closed]:slide-out-to-top-2 data-[state=open]:slide-in-from-top-2 data-[state=closed]:animate-out data-[state=open]:animate-in outline-none", o), a[3] = o, a[4] = l);
	let u;
	return a[5] !== s || a[6] !== l ? (u = /* @__PURE__ */ jsx(CollapsibleContent, {
		className: l,
		...s
	}), a[5] = s, a[6] = l, a[7] = u) : u = a[7], u;
}, Source = (e) => {
	let r = c(12), i, a, u, d;
	r[0] === e ? (i = r[1], a = r[2], u = r[3], d = r[4]) : ({href: a, title: d, children: i, ...u} = e, r[0] = e, r[1] = i, r[2] = a, r[3] = u, r[4] = d);
	let f;
	r[5] !== i || r[6] !== d ? (f = i ?? /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(BookIcon, { className: "h-4 w-4" }), /* @__PURE__ */ jsx("span", {
		className: "block font-medium",
		children: d
	})] }), r[5] = i, r[6] = d, r[7] = f) : f = r[7];
	let p;
	return r[8] !== a || r[9] !== u || r[10] !== f ? (p = /* @__PURE__ */ jsx("a", {
		className: "flex items-center gap-2",
		href: a,
		rel: "noreferrer",
		target: "_blank",
		...u,
		children: f
	}), r[8] = a, r[9] = u, r[10] = f, r[11] = p) : p = r[11], p;
};
export { Source, Sources, SourcesContent, SourcesTrigger };
