function HoldToConfirm({label:n,hint:t,onConfirm:e,kind:a="red",icon:s="play_arrow",durationMs:o=3e3}){const[i,r]=useState(!1),[d,u]=useState(0),m=useRef(0),c=useRef(0),l=useRef(!1);return useEffect(()=>{if(!i){u(0),l.current=!1,cancelAnimationFrame(c.current);return}m.current=performance.now();function p(w){const f=Math.min(1,(w-m.current)/o);if(u(f),f>=1){l.current||(l.current=!0,e&&e()),r(!1);return}c.current=requestAnimationFrame(p)}return c.current=requestAnimationFrame(p),()=>cancelAnimationFrame(c.current)},[i,o,e]),React.createElement("div",{className:"htc-wrap"},React.createElement("button",{className:`btn btn-${a} htc`,onMouseDown:()=>r(!0),onMouseUp:()=>r(!1),onMouseLeave:()=>r(!1),onTouchStart:()=>r(!0),onTouchEnd:()=>r(!1),type:"button"},React.createElement("span",{className:"htc-fill",style:{width:d*100+"%"}}),React.createElement(MIcon,{name:s,size:16}),React.createElement("span",{className:"htc-label"},n)),t&&React.createElement("div",{className:"htc-hint mono ink-faint"},t))}function CostPill({cost:n,hint:t}){return n?React.createElement("span",{className:"cost-pill mono",title:t||""},React.createElement(MIcon,{name:"payments",size:11}),React.createElement("span",null,"~",n)):null}function EntityLink({to:n,label:t}){if(!n)return null;function e(a){if(a.stopPropagation(),a.preventDefault(),!window.NAV)return;const[s,o]=String(n).split(".");window.NAV.go(s,o||null)}return React.createElement("a",{className:"ent-link mono",onClick:e,href:`#${n}`,title:`Open ${n}`},React.createElement("span",null,t||n),React.createElement(MIcon,{name:"arrow_outward",size:12}))}function ReplayButton({onClick:n,cost:t,label:e="Replay",size:a="sm"}){return React.createElement("button",{className:`replay-btn replay-${a}`,onClick:s=>{s.stopPropagation(),n&&n()}},React.createElement(MIcon,{name:"replay",size:a==="sm"?12:14}),React.createElement("span",null,e),t&&React.createElement("span",{className:"mono ink-faint replay-cost"},"\xB7 ~",t))}function StateBox({kind:n="empty",message:t,hint:e,ctaLabel:a,onCta:s}){const o={empty:{icon:"pending",tone:"idle"},loading:{icon:"sync",tone:"cy"},error:{icon:"error",tone:"fail"}},i=o[n]||o.empty;return React.createElement("div",{className:`state-box state-${n}`},React.createElement("div",{className:`state-icon st-${i.tone}`},React.createElement(MIcon,{name:i.icon,size:24})),React.createElement("div",{className:"state-msg mono"},t||`No ${n} state copy.`),e&&React.createElement("div",{className:"state-hint mono"},e),a&&s&&React.createElement("button",{className:"btn btn-secondary state-cta",onClick:s},a))}window.HoldToConfirm=HoldToConfirm,window.CostPill=CostPill,window.EntityLink=EntityLink,window.ReplayButton=ReplayButton,window.StateBox=StateBox;
