/* VENDORED from LearningLeagues-Lib @ 46272792c05818b91111218e946e8f6d2acef0e4 (dist/ll-lib.jsx).
 * GENERATED twice over: by `pnpm dist:build`, then pinned here by
 * `node scripts/vendor-dist.ts --write`. Never edit in this repository:
 * bump the pin by re-running the vendoring at a new lib commit. */

/* GENERATED by `pnpm dist:build` (scripts/generate-dist.ts): the real
 * component sources, types stripped, JSX preserved (esbuild), exposed as
 * window.LL globals for a buildless host (React UMD + Babel standalone).
 * Do not edit; edit the component .tsx sources and regenerate. */

// ── Button (button) ──
function Button({
  variant = "primary",
  href,
  type = "button",
  current = false,
  onClick,
  children
}) {
  const className = `ll-button ll-button--${variant}`;
  const ariaCurrent = current ? "page" : void 0;
  if (href !== void 0) {
    return <a className={className} href={href} aria-current={ariaCurrent} onClick={onClick}>
        {children}
      </a>;
  }
  return <button className={className} type={type} aria-current={ariaCurrent} onClick={onClick}>
      {children}
    </button>;
}

// ── Callout (callout) ──
const LABELS = {
  key: "Key concept",
  pro: "Pro tip",
  trap: "Trap"
};
function Callout({ type, title, children }) {
  return <article className={`ll-callout ll-callout--${type}`}>
      <span className="ll-callout-tag">
        <i className="ll-callout-glyph" aria-hidden="true" />
        {LABELS[type]}
      </span>
      {title ? <h3 className="ll-callout-title">{title}</h3> : null}
      <div className="ll-callout-body">{children}</div>
    </article>;
}

// ── Eyebrow (eyebrow) ──
function Eyebrow({ tone = "dim", children }) {
  return <span className={`ll-eyebrow ll-eyebrow--${tone}`}>{children}</span>;
}

// ── MetaStrip (meta-strip) ──
function MetaStrip({ items, tone = "dim" }) {
  if (items.length === 0) return null;
  return <ul className="ll-meta-strip" role="list">
      {items.map((item, i) => {
    const hasValue = item.value !== void 0 && item.value !== null;
    return (
      // The facts are static content in reading order, never reordered:
      // the index is a stable key.
      <li className="ll-meta-strip-item" key={i}>
            <Eyebrow tone={tone}>{item.label}</Eyebrow>
            {hasValue ? " " : null}
            {hasValue ? <span className="ll-meta-strip-value">{item.value}</span> : null}
          </li>
    );
  })}
    </ul>;
}

// ── ProgressBar (progress-bar) ──
function ProgressBar({ value, max, valueText, label, labelledBy }) {
  const total = Number.isFinite(max) && max > 0 ? max : 0;
  const now = total > 0 && Number.isFinite(value) ? Math.min(Math.max(value, 0), total) : 0;
  const percent = total > 0 ? now * 100 / total : 0;
  return <div
    className="ll-progress-bar"
    role="progressbar"
    aria-label={label}
    aria-labelledby={labelledBy}
    aria-valuemin={0}
    aria-valuemax={total}
    aria-valuenow={now}
    aria-valuetext={valueText}
  >
      <svg aria-hidden="true">
        <rect className="ll-progress-bar-fill" width={`${percent}%`} height="100%" />
      </svg>
    </div>;
}

// ── SectionHead (section-head) ──
function SectionHead({ num, title, lede, id }) {
  return <div className="ll-section-head">
      <span className="ll-section-head-num" aria-hidden="true">
        {num}
      </span>
      <div className="ll-section-head-body">
        <h2 className="ll-section-head-title" id={id}>
          {title}
        </h2>
        {lede !== void 0 && lede !== null && lede !== false && lede !== "" ? <p className="ll-section-head-lede">{lede}</p> : null}
      </div>
    </div>;
}

// ── Sigil (sigil) ──
function Sigil({ children }) {
  return <div className="ll-sigil" aria-hidden="true">
      <div className="ll-sigil-art">{children}</div>
    </div>;
}

window.LL = Object.assign(window.LL || {}, { Button, Callout, Eyebrow, MetaStrip, ProgressBar, SectionHead, Sigil });
