import{a as e}from"./rolldown-runtime-B0Z9INg1.js";import{$ as t,Q as n}from"./vendor-charts-iXlq6Rne.js";import{t as r}from"./createLucideIcon-CPi6oOk3.js";import{_ as i}from"./vendor-flow-IzlrcDx6.js";import{rn as a}from"./index-HkVQGc9M.js";import{n as o}from"./format-DOnLYpxL.js";var s=r(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),c=e(t(),1),l=e(n(),1),u=i();function d({actions:e}){let[t,n]=(0,c.useState)(!1),[r,i]=(0,c.useState)({top:0,left:0}),o=(0,c.useRef)(null),d=(0,c.useRef)(null),f=(0,c.useCallback)(()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect();i({top:t.bottom+4,left:Math.max(8,t.right-184)})},[]);return(0,c.useEffect)(()=>{if(!t)return;let e=e=>{d.current&&!d.current.contains(e.target)&&o.current&&!o.current.contains(e.target)&&n(!1)},r=()=>n(!1);return document.addEventListener(`mousedown`,e),window.addEventListener(`scroll`,r,!0),window.addEventListener(`resize`,r),()=>{document.removeEventListener(`mousedown`,e),window.removeEventListener(`scroll`,r,!0),window.removeEventListener(`resize`,r)}},[t]),e.length===0?null:(0,u.jsxs)(`div`,{className:`flex justify-end`,children:[(0,u.jsx)(`button`,{ref:o,type:`button`,"aria-label":`Row actions`,onClick:e=>{e.stopPropagation(),f(),n(e=>!e)},className:`p-1.5 rounded-lg text-[var(--color-text-muted)] hover:bg-[var(--color-accent-soft)] hover:text-[var(--color-accent-ink)] transition-colors`,children:(0,u.jsx)(s,{className:`h-4 w-4`})}),t&&(0,l.createPortal)((0,u.jsx)(`div`,{ref:d,className:`fixed z-[9999] w-[184px] overflow-hidden rounded-lg border border-[var(--color-border)] bg-[var(--color-surface)] py-1 shadow-[var(--shadow-lg)]`,style:{top:r.top,left:r.left},children:e.map(e=>{let t=e.icon;return(0,u.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:t=>{t.stopPropagation(),n(!1),e.onClick()},className:a(`flex w-full items-center gap-2.5 px-3 py-2 text-left text-[13px] transition-colors disabled:cursor-not-allowed disabled:opacity-40`,e.tone===`danger`?`text-[var(--color-error)] hover:bg-red-50 dark:hover:bg-red-950/40`:`text-[var(--color-text-secondary)] hover:bg-[var(--color-accent-soft)] hover:text-[var(--color-accent-ink)]`),children:[(0,u.jsx)(t,{className:`h-3.5 w-3.5 flex-shrink-0`}),e.label]},e.label)})}),document.body)]})}function f({from:e,to:t}){return(0,u.jsxs)(`span`,{className:`text-[12px] text-[var(--color-text-secondary)]`,children:[o(e),(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:` → `}),t?o(t):(0,u.jsx)(`span`,{className:`text-[var(--color-text-muted)]`,children:`no end`})]})}function p({value:e}){return(0,u.jsx)(`span`,{className:`inline-flex h-5 min-w-[24px] items-center justify-center rounded-full border border-[var(--color-border)] bg-[var(--color-background)] px-1.5 text-[11px] font-bold tabular-nums text-[var(--color-text-secondary)]`,children:e})}export{f as n,d as r,p as t};