1import{r as p,j as e}from"./index-BeLN1cAh.js";const o=Object.freeze({BIG_BLIND:"big-blind-ante",PER_PLAYER:"per-player-ante"}),f=Object.freeze({stack:2e4,smallBlind:500,bigBlind:1e3,ante:1e3,players:8,anteFormat:o.BIG_BLIND}),b=1e12,u=n=>typeof n=="string"&&n.trim()===""?Number.NaN:typeof n=="number"?n:Number(n),v=n=>{const t={stack:u(n.stack),smallBlind:u(n.smallBlind),bigBlind:u(n.bigBlind),ante:u(n.ante),players:u(n.players),anteFormat:n.anteFormat},i={};if((!Number.isFinite(t.stack)||t.stack<1||t.stack>b)&&(i.stack="Enter a stack from 1 to 1 trillion chips."),(!Number.isFinite(t.smallBlind)||t.smallBlind<0||t.smallBlind>b)&&(i.smallBlind="Enter a small blind from 0 to 1 trillion chips."),(!Number.isFinite(t.bigBlind)||t.bigBlind<1||t.bigBlind>b)&&(i.bigBlind="Enter a big blind from 1 to 1 trillion chips."),(!Number.isFinite(t.ante)||t.ante<0||t.ante>b)&&(i.ante="Enter an ante from 0 to 1 trillion chips."),(!Number.isInteger(t.players)||t.players<2||t.players>10)&&(i.players="Use 2 to 10 players."),Object.values(o).includes(t.anteFormat)||(i.anteFormat="Choose a supported ante format."),Object.keys(i).length>0)return{valid:!1,errors:i,inputs:t};const c=t.anteFormat===o.BIG_BLIND?t.ante:t.ante*t.players,a=t.smallBlind+t.bigBlind+c,d=t.stack/t.bigBlind,h=a/t.bigBlind,B=t.ante/t.bigBlind,m=t.bigBlind+t.ante,g=t.stack>=m,r=Math.max(0,t.stack-m);if(![c,a,d,h,B,m,r].every(Number.isFinite))return{valid:!1,errors:{calculation:"These inputs are too large to calculate safely."},inputs:t};const x=t.anteFormat===o.BIG_BLIND?{liveBigBlindPosted:Math.min(t.stack,t.bigBlind),antePosted:Math.min(Math.max(0,t.stack-t.bigBlind),t.ante)}:null;return{valid:!0,errors:{},inputs:t,stackBb:d,anteBb:B,totalAntes:c,totalAntesBb:c/t.bigBlind,orbitCost:a,orbitCostBb:h,mRatio:t.stack/a,equivalentPerPlayerAnte:c/t.players,equivalentPerPlayerAnteBb:c/t.players/t.bigBlind,canCoverNextBigBlind:g,chipsBehindNextBigBlind:r,chipsBehindNextBigBlindBb:r/t.bigBlind,bigBlindFirst:x}},j=n=>Object.fromEntries(Object.entries(n).map(([t,i])=>[t,typeof i=="number"?String(i):i])),s=new Intl.NumberFormat("en-US",{maximumFractionDigits:2}),l=new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),N=()=>{const[n,t]=p.useState(!1),[i,c]=p.useState(()=>j(f)),a=p.useMemo(()=>v(i),[i]);p.useEffect(()=>{globalThis.__GTO_PRERENDERING__||t(!0)},[]);const d=(r,x)=>{c(y=>({...y,[r]:x}))},h=()=>{var r;c(j(f)),(r=document.getElementById("bba-m-calculator-title"))==null||r.focus()},B=i.anteFormat===o.BIG_BLIND?"Big-blind ante (chips)":"Ante per player, per hand (chips)",m=i.anteFormat===o.BIG_BLIND?"Players (comparison only)":"Players posting an ante",g=a.valid&&i.anteFormat===o.BIG_BLIND&&Math.abs(a.inputs.smallBlind/a.inputs.bigBlind-.5)<1e-12&&Math.abs(a.anteBb-1)<1e-12;return e.jsxs("section",{className:"bba-calculator","aria-labelledby":"bba-m-calculator-title","data-bba-m-calculator":!0,children:[e.jsxs("div",{className:"bba-calculator__header",children:[e.jsx("p",{className:"bba-calculator__eyebrow",children:"Interactive · direct formula · local only"}),e.jsx("h2",{id:"bba-m-calculator-title",tabIndex:"-1",children:"Big-Blind Ante and M Calculator"}),e.jsx("p",{children:"Enter the stack before this handâs forced bets. Choose the actual ante format from the tournament structure."}),!n&&e.jsx("p",{className:"bba-calculator__loading",role:"status",children:"JavaScript is required to enable the controls. The reference tables below remain available."})]}),e.jsxs("form",{onSubmit:r=>r.preventDefault(),children:[e.jsxs("fieldset",{disabled:!n,children:[e.jsx("legend",{className:"bba-calculator__sr-only",children:"Tournament stack inputs"}),e.jsxs("div",{className:"bba-calculator__fields",children:[e.jsxs("label",{children:[e.jsx("span",{children:"Stack before forced bets"}),e.jsx("input",{type:"number",min:"1",max:b,step:"any",inputMode:"decimal",name:n?"stack":void 0,value:i.stack,onChange:r=>d("stack",r.target.value),"aria-describedby":a.errors.stack?"bba-error-stack":void 0,"aria-invalid":!!a.errors.stack}),a.errors.stack&&e.jsx("small",{id:"bba-error-stack",children:a.errors.stack})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Small blind"}),e.jsx("input",{type:"number",min:"0",max:b,step:"any",inputMode:"decimal",name:n?"smallBlind":void 0,value:i.smallBlind,onChange:r=>d("smallBlind",r.target.value),"aria-describedby":a.errors.smallBlind?"bba-error-small-blind":void 0,"aria-invalid":!!a.errors.smallBlind}),a.errors.smallBlind&&e.jsx("small",{id:"bba-error-small-blind",children:a.errors.smallBlind})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Big blind"}),e.jsx("input",{type:"number",min:"1",max:b,step:"any",inputMode:"decimal",name:n?"bigBlind":void 0,value:i.bigBlind,onChange:r=>
1d("bigBlind",r.target.value),"aria-describedby":a.errors.bigBlind?"bba-error-big-blind":void 0,"aria-invalid":!!a.errors.bigBlind}),a.errors.bigBlind&&e.jsx("small",{id:"bba-error-big-blind",children:a.errors.bigBlind})]}),e.jsxs("label",{children:[e.jsx("span",{children:"Ante format"}),e.jsxs("select",{name:n?"anteFormat":void 0,value:i.anteFormat,onChange:r=>d("anteFormat",r.target.value),"aria-invalid":!!a.errors.anteFormat,children:[e.jsx("option",{value:o.BIG_BLIND,children:"Single-payer big-blind ante"}),e.jsx("option",{value:o.PER_PLAYER,children:"Each player antes"})]})]}),e.jsxs("label",{children:[e.jsx("span",{children:B}),e.jsx("input",{type:"number",min:"0",max:b,step:"any",inputMode:"decimal",name:n?"ante":void 0,value:i.ante,onChange:r=>d("ante",r.target.value),"aria-describedby":a.errors.ante?"bba-error-ante":void 0,"aria-invalid":!!a.errors.ante}),a.errors.ante&&e.jsx("small",{id:"bba-error-ante",children:a.errors.ante})]}),e.jsxs("label",{children:[e.jsx("span",{children:m}),e.jsx("input",{type:"number",min:"2",max:"10",step:"1",inputMode:"numeric",name:n?"players":void 0,value:i.players,onChange:r=>d("players",r.target.value),"aria-describedby":a.errors.players?"bba-error-players":void 0,"aria-invalid":!!a.errors.players}),a.errors.players&&e.jsx("small",{id:"bba-error-players",children:a.errors.players})]})]})]}),e.jsx("button",{className:"bba-calculator__reset",type:"button",disabled:!n,onClick:h,children:"Reset example"})]}),e.jsx("p",{className:"bba-calculator__sr-only",role:"status","aria-live":"polite","aria-atomic":"true",children:a.valid?`Calculated M ${l.format(a.mRatio)}, stack ${l.format(a.stackBb)} big blinds, orbit cost ${l.format(a.orbitCostBb)} big blinds.`:"Calculation unavailable. Correct the highlighted inputs."}),a.valid?e.jsxs("div",{className:"bba-calculator__results",children:[e.jsxs("p",{className:"bba-calculator__answer",children:[e.jsxs("strong",{children:[l.format(a.stackBb)," BB stays ",l.format(a.stackBb)," BB."]})," ","The ante changes the full-orbit cost to ",l.format(a.orbitCostBb)," BB, so M is ",l.format(a.mRatio),"."]}),e.jsx("p",{className:"bba-calculator__equation",children:e.jsx("code",{children:i.anteFormat===o.BIG_BLIND?`${s.format(a.inputs.stack)} / (${s.format(a.inputs.smallBlind)} + ${s.format(a.inputs.bigBlind)} + ${s.format(a.inputs.ante)}) = ${l.format(a.mRatio)}`:`${s.format(a.inputs.stack)} / (${s.format(a.inputs.smallBlind)} + ${s.format(a.inputs.bigBlind)} + ${a.inputs.players} Ã ${s.format(a.inputs.ante)}) = ${l.format(a.mRatio)}`})}),e.jsxs("dl",{children:[e.jsxs("div",{children:[e.jsx("dt",{children:"Stack depth"}),e.jsx("dd",{children:e.jsxs("output",{children:[l.format(a.stackBb)," BB"]})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Full-orbit forced cost"}),e.jsx("dd",{children:e.jsxs("output",{children:[l.format(a.orbitCostBb)," BB"]})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"M ratio"}),e.jsx("dd",{children:e.jsx("output",{children:l.format(a.mRatio)})})]}),e.jsxs("div",{children:[e.jsx("dt",{children:"Behind after next BB + ante"}),e.jsx("dd",{children:e.jsxs("output",{children:[l.format(a.chipsBehindNextBigBlindBb)," BB"]})})]})]}),e.jsx("p",{children:i.anteFormat===o.BIG_BLIND?`Across ${a.inputs.players} unchanged hands, this ${s.format(a.inputs.ante)}-chip BBA has the same total ante cost as ${s.format(a.equivalentPerPlayerAnte)} chips per player per hand.`:`${a.inputs.players} players contribute ${s.format(a.totalAntes)} chips in antes each hand, so table size changes the orbit cost.`}),i.anteFormat===o.BIG_BLIND&&!g&&e.jsxs("p",{className:"bba-calculator__shortcut-note",children:["The ",e.jsx("code",{children:"stack BB / 2.5"})," shortcut does not apply to these blind and ante ratios. The expanded equation above uses the entered structure."]}),!a.canCoverNextBigBlind&&a.bigBlindFirst&&e.jsxs("p",{className:"bba-calculator__warning",children:["This stack cannot cover both next-hand obligations. Under Poker TDAâs recommended big-blind-first calculation, ",s.format(a.bigBlindFirst.liveBigBlindPosted)," chips go to the live big blind and ",s.format(a.bigBl
1indFirst.antePosted)," to the ante. Confirm the eventâs rule."]}),!a.canCoverNextBigBlind&&!a.bigBlindFirst&&e.jsx("p",{className:"bba-calculator__warning",children:"This stack cannot cover both next-hand obligations. Posting priority for a short stack is rule-specific; confirm the eventâs procedure."})]}):e.jsx("p",{className:"bba-calculator__invalid",children:"Correct the highlighted input values to calculate BB depth and M."}),e.jsx("p",{className:"bba-calculator__note",children:"M assumes the blinds, ante, table size, and your seatâs obligations stay unchanged for a complete orbit. It is not an action recommendation or a literal hand-by-hand countdown."})]})};export{N as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.