@betorigami/game-calculations 3.0.1 → 3.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var ur=Object.create;var{getPrototypeOf:Wr,defineProperty:w,getOwnPropertyNames:er,getOwnPropertyDescriptor:sr}=Object,tr=Object.prototype.hasOwnProperty;var D=(r,o,i)=>{i=r!=null?ur(Wr(r)):{};let E=o||!r||!r.__esModule?w(i,"default",{value:r,enumerable:!0}):i;for(let A of er(r))if(!tr.call(E,A))w(E,A,{get:()=>r[A],enumerable:!0});return E},nr=new WeakMap,br=(r)=>{var o=nr.get(r),i;if(o)return o;if(o=w({},"__esModule",{value:!0}),r&&typeof r==="object"||typeof r==="function")er(r).map((E)=>!tr.call(o,E)&&w(o,E,{get:()=>r[E],enumerable:!(i=sr(r,E))||i.enumerable}));return nr.set(r,o),o};var mr=(r,o)=>{for(var i in o)w(r,i,{get:o[i],enumerable:!0,configurable:!0,set:(E)=>o[i]=()=>E})};var wo={};mr(wo,{validateRouletteGameInputs:()=>Ko,validateAdvancedDiceInputs:()=>Ao,plinkoMultipliers:()=>kr,diamondsMultipliers:()=>Zr,calculateRouletteBetAmount:()=>Zo,calculateBaccaratBetAmount:()=>pr,WheelSegments:()=>M,WheelRiskLevel:()=>N,Wheel:()=>Qr,VALID_SUITS:()=>Lr,VALID_RANKS:()=>Sr,VALID_EUROPEAN_STREETS:()=>rr,VALID_EUROPEAN_STRAIGHTS:()=>$,VALID_EUROPEAN_SPLITS:()=>m,VALID_EUROPEAN_DOUBLE_STREETS:()=>Ar,VALID_EUROPEAN_CORNERS:()=>ir,VALID_AMERICAN_STREETS:()=>or,VALID_AMERICAN_STRAIGHTS:()=>b,VALID_AMERICAN_SPLITS:()=>g,VALID_AMERICAN_DOUBLE_STREETS:()=>cr,VALID_AMERICAN_CORNERS:()=>Er,RouletteType:()=>z,Roulette:()=>$r,RollType:()=>dr,RANDOM_MIN_VALUE:()=>F,RANDOM_MAX_VALUE:()=>Y,PlinkoRiskLevel:()=>Hr,Plinko:()=>Pr,Parity:()=>G,OrigamiGame:()=>T,Mines:()=>vr,MIN_WIN_CHANCE:()=>Rr,MAX_WIN_CHANCE:()=>Or,Limbo:()=>Vr,KenoRiskLevel:()=>ar,Keno:()=>Nr,Half:()=>Z,GameErrorCode:()=>fr,GameError:()=>t,Game:()=>O,EFFECTIVE_RANGE:()=>u,Dozen:()=>_,DiceDirection:()=>_r,Dice:()=>Dr,DiamondsResultType:()=>Cr,Diamonds:()=>Kr,Column:()=>K,Color:()=>C,BaccaratOutcome:()=>xr,BaccaratBetType:()=>lr,Baccarat:()=>yr,AdvancedDice:()=>Tr,AMERICAN_BASKET:()=>q});module.exports=br(wo);var T;((f)=>{f.DICE="DICE";f.MINES="MINES";f.KENO="KENO";f.LIMBO="LIMBO";f.ADVANCED_DICE="ADVANCED_DICE";f.BACCARAT="BACCARAT";f.DIAMONDS="DIAMONDS";f.PLINKO="PLINKO";f.ROULETTE="ROULETTE";f.WHEEL="WHEEL"})(T||={});class O{gameId;constructor(r){this.gameId=r}getGameResult(r){return this.determineGameResult(r)}}var U=require("big.js");var fr;((o)=>o.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR")(fr||={});class t extends Error{static createValidationError(r){return new t("INPUT_VALIDATION_ERROR",r)}static isGameError(r){return r instanceof t}errorCode;constructor(r,o){super(o);this.errorCode=r}}var F=0,Y=1e4,u=10001,Rr=0.01,Or=98,gr=(r)=>{if(r<F)throw t.createValidationError(`Lower bound ${r} is below minimum allowed value ${F}`)},ro=(r)=>{if(r>Y)throw t.createValidationError(`Upper bound ${r} is above maximum allowed value ${Y}`)},P=(r)=>{if(gr(r.lower),ro(r.upper),r.lower>=r.upper)throw t.createValidationError(`Lower bound ${r.lower} must be less than ${r.upper}`)},oo=(r,o)=>{let[i,E]=r.lower<=o.lower?[r,o]:[o,r];if(i.upper>E.lower)throw t.createValidationError("Bounds must not overlap")},io=(r,o)=>o>=r.lower&&o<=r.upper,Eo=(r)=>r.upper-r.lower+1,X=(r,o)=>o>r.lower&&o<r.upper,I=(r)=>r.upper-r.lower-1,dr;((E)=>{E.ROLL_BETWEEN="ROLL_BETWEEN";E.ROLL_OUTSIDE="ROLL_OUTSIDE";E.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(dr||={});var Br=(r)=>{let i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return P(r.bounds),I(r.bounds);case"ROLL_OUTSIDE":return P(r.bounds),u-Eo(r.bounds);case"ROLL_BETWEEN_TWO":return P(r.firstBounds),P(r.secondBounds),oo(r.firstBounds,r.secondBounds),I(r.firstBounds)+I(r.secondBounds)}})(),E=U.Big(i).div(u).mul(100);if(E.lt(Rr))throw t.createValidationError("Win chance too low");if(E.gt(Or))throw t.createValidationError("Win chance too high");return E},Ao=(r)=>{Br(r)};class Tr extends O{constructor(){super("ADVANCED_DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=Br(i),A=r.getRandomInt({min:F,max:Y}),c=A.value;return{isFinished:!0,payoutMultiplier:(()=>{switch(i.mode){case"ROLL_BETWEEN":return X(i.bounds,c);case"ROLL_OUTSIDE":return!io(i.bounds,c);case"ROLL_BETWEEN_TWO":return X(i.firstBounds,c)||X(i.secondBounds,c)}})()?new U.Big(100-o).div(E):new U.Big(0),outputs:{result:A.values},randomValues:A}}}var a=D(require("big.js"));var Lr=["Clubs","Diamonds","Hearts","Spades"],Sr=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],xr;((E)=>{E.PLAYER_WIN="PLAYER_WIN";E.TIE="TIE";E.BANKER_WIN="BANKER_WIN"})(xr||={});var lr;((E)=>{E.PLAYER="PLAYER";E.TIE="TIE";E.BANKER="BANKER"})(lr||={});var co={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:8},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},pr=(r)=>{return new a.default(0).add(r.bets.reduce((i,E)=>i.add(E.amount),new a.default(0)))};class yr extends O{constructor(){super("BACCARAT")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(i!==1)throw new Error("Baccarat is only available at 1% edge.");this.validateGameInputs(o);let E=r.getRandomIntsWithReplacement({min:0,max:51,count:6}),A=E.values,c=A.slice(0,3),e=A.slice(3,6),d=[],R=0;for(let L of c.slice(0,2)){let x=this.mapRandomValueToCard(L),k=this.mapRandomValueToCardValue(L);d.push(x),R=(R+k)%10}let B=[],f=0;for(let L of e.slice(0,2)){let x=this.mapRandomValueToCard(L),k=this.mapRandomValueToCardValue(L);B.push(x),f=(f+k)%10}if(!this.isNaturalWin(R,f)){let L=this.shouldDrawThirdPlayerCard(R),x=null;if(L)x=this.mapRandomValueToCardValue(c[2]),d.push(this.mapRandomValueToCard(c[2])),R=(R+x)%10;if(this.shouldDrawThirdBankerCard(f,x))B.push(this.mapRandomValueToCard(e[2])),f=(f+this.mapRandomValueToCardValue(e[2]))%10}let S;if(R===f)S="TIE";else S=R>f?"PLAYER_WIN":"BANKER_WIN";let l=pr(o),{betType:H,multiplier:Xr}=co[S],Ir=new a.default(0).add(o.bets.filter((L)=>L.type===H).reduce((L,x)=>L.add(x.amount.mul(Xr)),new a.default(0)));return{isFinished:!0,payoutMultiplier:l.gt(0)?Ir.div(l):new a.default(0),outputs:{playerCards:d,playerHandValue:R,bankerCards:B,bankerHandValue:f,gameOutcome:S,result:E.values},randomValues:E}}validateGameInputs(r){if(r.bets.length===0)throw new Error("Must place at least a single bet.");if(!r.bets.every((o)=>o.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(r){let o=Lr[Math.floor(r/13)],i=Sr[r%13];return{suit:o,rank:i}}isNaturalWin(r,o){let i=[8,9];return i.includes(r)||i.includes(o)}mapRandomValueToCardValue(r){let o=r%13;if(o===0)return 1;if(o>=10)return 10;return o+1}shouldDrawThirdPlayerCard(r){return r<=5}shouldDrawThirdBankerCard(r,o){if(o===null)return r<=5;if(r<=2)return!0;if(r===3)return o!==8;if(r===4)return[2,3,4,5,6,7].includes(o);if(r===5)return[4,5,6,7].includes(o);if(r===6)return[6,7].includes(o);return!1}}var Gr=D(require("big.js"));class p{multipliers;constructor(r){this.multipliers=r}getMultipliers(r){let o=this.multipliers.get(r);if(o===void 0)throw new Error(`Multipliers for ${r} not found`);return o}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([r,o])=>({edge:r,multipliers:o}))}}var Cr;((e)=>{e.PAIR="PAIR";e.TWO_PAIR="TWO_PAIR";e.THREE_OF_A_KIND="THREE_OF_A_KIND";e.FULL_HOUSE="FULL_HOUSE";e.FOUR_OF_A_KIND="FOUR_OF_A_KIND";e.FIVE_OF_A_KIND="FIVE_OF_A_KIND"})(Cr||={});var no={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50},eo={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50},to={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50},fo={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50},Ro={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50},Zr=new p(new Map([[1,no],[2,eo],[3,to],[4,fo],[8,Ro]])),Oo={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class Kr extends O{constructor(){super("DIAMONDS")}determineGameResult({generator:r,edge:o}){let i=r.getRandomIntsWithReplacement({min:0,max:6,count:5}),E=Zr.getMultipliers(o),A=i.values,c=this.calculatePayoutMultiplier(E,A);return{isFinished:!0,payoutMultiplier:Gr.default(c),outputs:{result:i.values},randomValues:i}}calculatePayoutMultiplier(r,o){let i=new Map;for(let c of o){let e=i.get(c)||0;i.set(c,e+1)}let E=[...i.values()].filter((c)=>c>1),A=this.classifyResult(E);return A===null?0:r[A]}classifyResult(r){if(r.length>2)throw new Error(`Unexpected number of repeats ${r.length}`);let[o,i]=r;if(o===void 0)return null;if(i===void 0){let E=Oo[o];if(E===void 0)throw new Error(`Unexpected single diamond repeat count: ${o}`);return E}return o===3||i===3?"FULL_HOUSE":"TWO_PAIR"}}var j=D(require("big.js"));var _r;((i)=>{i.ABOVE="ABOVE";i.BELOW="BELOW"})(_r||={});class Dr extends O{constructor(){super("DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:0,max:1e4}),A=E.min,d=E.max-A+1-1,R=i.direction==="ABOVE"?d-i.selectedValue:i.selectedValue,B=new j.default(R).div(d).mul(100);return{isFinished:!0,payoutMultiplier:(i.direction==="ABOVE"?E.value>i.selectedValue:E.value<i.selectedValue)?new j.default(100-o).div(B):new j.default(0),outputs:{result:E.values},randomValues:E}}}var W=D(require("big.js"));var ar;((A)=>{A.CLASSIC="CLASSIC";A.LOW_RISK="LOW_RISK";A.MEDIUM_RISK="MEDIUM_RISK";A.HIGH_RISK="HIGH_RISK"})(ar||={});var Bo={[1]:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]},[2]:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]},[3]:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]},[4]:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]},[5]:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]},[6]:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]},[7]:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]},[8]:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]},[9]:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]},[10]:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}};class Nr extends O{multiplierOverrides;get multipliers(){return this.multiplierOverrides??Bo}constructor(r){super("KENO");this.multiplierOverrides=r;if(r)this.validateMultiplierOverrides(r)}determineGameResult({generator:r,edge:o,gameInputs:i}){if(o!==1&&!this.multiplierOverrides)throw new Error("Multiplier overrides must be specified if an edge of 1% is not desirable");if(i.selectedNumbers.length===0)throw new Error("No numbers selected");if(i.selectedNumbers.length>10)throw new Error("Maximum of 10 numbers can be selected");for(let e of i.selectedNumbers){if(e%1!==0)throw new Error("Only integers can be selected");if(e<0||e>39)throw new Error("Invalid number selected")}let E=r.getUniqueRandomInts({min:0,max:39,count:10}),A=i.selectedNumbers.filter((e)=>E.values.includes(e));return{isFinished:!0,payoutMultiplier:A.length>0?new W.default(this.multipliers[i.selectedNumbers.length][i.riskLevel][A.length]??0):new W.default(0),outputs:{result:E.values},randomValues:E}}validateMultiplierOverrides(r){for(let[o,i]of Object.entries(r)){let E=Number(o);for(let[A,c]of Object.entries(i))if(c.length!==E+1)throw new Error(`Invalid count of multipliers for tiles ${E} and risk level ${A}. Expected ${E+1}, but got ${c.length}`)}}}var y=D(require("big.js"));var Mr=(r,o)=>{return r.gt(o)?r:o};var wr=(r,o)=>{return r.lt(o)?r:o};class Vr extends O{constructor(){super("LIMBO")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:1,max:4294967295}),A=E.max,c=new y.default(16777216),e=new y.default(1),d=new y.default(1e6),R=E.value,B=new y.default(R-1).div(A),f=(100-o)/100,S=c.div(B.mul(c).plus(1)).mul(f),l=Mr(e,wr(S,d));return{isFinished:!0,payoutMultiplier:l.gte(i.targetMultiplier)?new y.default(i.targetMultiplier):new y.default(0),outputs:{randomMultiplier:l,result:E.values},randomValues:E}}}var V=D(require("big.js"));var s=(r,o)=>{if(o<0||r<0||o>r)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(o>r-o)o=r-o;let i=1;for(let E=1;E<=o;E++)i=i*(r-E+1)/E;return i};class vr extends O{constructor(){super("MINES")}determineGameResult({generator:r,edge:o,gameInputs:i}){if(i.minesCount<=0||i.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(i.selectedTiles.length>25-i.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let e=r.getUniqueRandomInts({min:1,max:25,count:i.minesCount}),d=e.values.some((H)=>i.selectedTiles.includes(H)),R=i.hasCashedOut||d,B=(100-o)/100,f=new V.default(s(25-i.minesCount,i.selectedTiles.length)).div(new V.default(s(25,i.selectedTiles.length))),l=i.hasCashedOut&&!d?new V.default(B).div(f):new V.default(0);return{isFinished:R,payoutMultiplier:l,outputs:{result:e.values},randomValues:e}}}var hr=require("big.js");var Hr;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(Hr||={});var To=[{rows:8,payout:{["LOW_RISK"]:[5.6,2.1,1.1,1,0.5,1,1.1,2.1,5.6],["MEDIUM_RISK"]:[13,3,1.3,0.7,0.4,0.7,1.3,3,13],["HIGH_RISK"]:[29,4,1.5,0.3,0.2,0.3,1.5,4,29]}},{rows:9,payout:{["LOW_RISK"]:[5.6,2,1.6,1,0.7,0.7,1,1.6,2,5.6],["MEDIUM_RISK"]:[18,4,1.7,0.9,0.5,0.5,0.9,1.7,4,18],["HIGH_RISK"]:[43,7,2,0.6,0.2,0.2,0.6,2,7,43]}},{rows:10,payout:{["LOW_RISK"]:[8.9,3,1.4,1.1,1,0.5,1,1.1,1.4,3,8.9],["MEDIUM_RISK"]:[22,5,2,1.4,0.6,0.4,0.6,1.4,2,5,22],["HIGH_RISK"]:[76,10,3,0.9,0.3,0.2,0.3,0.9,3,10,76]}},{rows:11,payout:{["LOW_RISK"]:[8.4,3,1.9,1.3,1,0.7,0.7,1,1.3,1.9,3,8.4],["MEDIUM_RISK"]:[24,6,3,1.8,0.7,0.5,0.5,0.7,1.8,3,6,24],["HIGH_RISK"]:[120,14,5.2,1.4,0.4,0.2,0.2,0.4,1.4,5.2,14,120]}},{rows:12,payout:{["LOW_RISK"]:[10,3,1.6,1.4,1.1,1,0.5,1,1.1,1.4,1.6,3,10],["MEDIUM_RISK"]:[33,11,4,2,1.1,0.6,0.3,0.6,1.1,2,4,11,33],["HIGH_RISK"]:[170,24,8.1,2,0.7,0.2,0.2,0.2,0.7,2,8.1,24,170]}},{rows:13,payout:{["LOW_RISK"]:[8.1,4,3,1.9,1.2,0.9,0.7,0.7,0.9,1.2,1.9,3,4,8.1],["MEDIUM_RISK"]:[43,13,6,3,1.3,0.7,0.4,0.4,0.7,1.3,3,6,13,43],["HIGH_RISK"]:[260,37,11,4,1,0.2,0.2,0.2,0.2,1,4,11,37,260]}},{rows:14,payout:{["LOW_RISK"]:[7.1,4,1.9,1.4,1.3,1.1,1,0.5,1,1.1,1.3,1.4,1.9,4,7.1],["MEDIUM_RISK"]:[58,15,7,4,1.9,1,0.5,0.2,0.5,1,1.9,4,7,15,58],["HIGH_RISK"]:[420,56,18,5,1.9,0.3,0.2,0.2,0.2,0.3,1.9,5,18,56,420]}},{rows:15,payout:{["LOW_RISK"]:[15,8,3,2,1.5,1.1,1,0.7,0.7,1,1.1,1.5,2,3,8,15],["MEDIUM_RISK"]:[88,18,11,5,3,1.3,0.5,0.3,0.3,0.5,1.3,3,5,11,18,88],["HIGH_RISK"]:[620,83,27,8,3,0.5,0.2,0.2,0.2,0.2,0.5,3,8,27,83,620]}},{rows:16,payout:{["LOW_RISK"]:[16,9,2,1.4,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,1.4,2,9,16],["MEDIUM_RISK"]:[110,41,10,5,3,1.5,1,0.5,0.3,0.5,1,1.5,3,5,10,41,110],["HIGH_RISK"]:[1000,130,26,9,4,2,0.2,0.2,0.2,0.2,0.2,2,4,9,26,130,1000]}}],kr=new p(new Map([[1,To]]));class Pr extends O{constructor(){super("PLINKO")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(o.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(o.numberOfRows<8||o.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let E=kr.getMultipliers(i),A=r.getRandomIntsWithReplacement({min:0,max:1,count:o.numberOfRows}),e=A.values.reduce((R,B)=>R+B,0);return{isFinished:!0,payoutMultiplier:new hr.Big(E.find((R)=>R.rows===o.numberOfRows)?.payout[o.riskLevel][e]??0),outputs:{result:A.values},randomValues:A}}}var n=require("big.js");var $=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],b=[37,...$],m=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],g=[[0,1],[0,3],[0,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],rr=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],or=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],ir=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],Er=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],q=[0,1,2,3,37],Ar=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],cr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],G;((i)=>{i.EVEN="EVEN";i.ODD="ODD"})(G||={});var C;((i)=>{i.RED="RED";i.BLACK="BLACK"})(C||={});var Z;((i)=>{i.LOW="LOW";i.HIGH="HIGH"})(Z||={});var K;((E)=>{E.TOP="TOP";E.MIDDLE="MIDDLE";E.BOTTOM="BOTTOM"})(K||={});var _;((E)=>{E.FIRST="FIRST";E.SECOND="SECOND";E.THIRD="THIRD"})(_||={});var z;((i)=>{i.AMERICAN="AMERICAN";i.EUROPEAN="EUROPEAN"})(z||={});var J=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw t.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&v(o.value)))throw t.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&Lo(o.values)))throw t.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&So(o.values)))throw t.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&xo(o.values)))throw t.createValidationError("Invalid corner bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&lo(o.values)))throw t.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(G).includes(o.parity)))throw t.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(C).includes(o.color)))throw t.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw t.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.column)))throw t.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.dozen)))throw t.createValidationError("Invalid dozen bet.")},v=(r)=>{return $.includes(r)},Lo=(r)=>{if(r.length!==2)return!1;if(!r.every(v))return!1;return m.some(([o,i])=>o===r[0]&&i===r[1])},So=(r)=>{if(r.length!==3)return!1;if(!r.every(v))return!1;return rr.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},xo=(r)=>{if(r.length!==4)return!1;if(!r.every(v))return!1;return ir.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},lo=(r)=>{if(r.length!==6)return!1;if(!r.every(v))return!1;return Ar.some(([o,i,E,A,c,e])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&e===r[5])};var Q=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.basketBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw t.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&h(o.value)))throw t.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&po(o.values)))throw t.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&yo(o.values)))throw t.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&Go(o.values)))throw t.createValidationError("Invalid corner bet.");if(!r.basketBets.every((o)=>o.amount.gte(0)))throw t.createValidationError("Invalid basket bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&Co(o.values)))throw t.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(G).includes(o.parity)))throw t.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(C).includes(o.color)))throw t.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw t.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.column)))throw t.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.dozen)))throw t.createValidationError("Invalid dozen bet.")},h=(r)=>{return b.includes(r)};function po(r){if(r.length!==2)return!1;if(!r.every(h))return!1;return g.some(([o,i])=>o===r[0]&&i===r[1])}var yo=(r)=>{if(r.length!==3)return!1;if(!r.every(h))return!1;return or.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},Go=(r)=>{if(r.length!==4)return!1;if(!r.every(h))return!1;return Er.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},Co=(r)=>{if(r.length!==6)return!1;if(!r.every(h))return!1;return cr.some(([o,i,E,A,c,e])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&e===r[5])};var Ur=(r)=>{return new n.Big(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0)))},Fr=(r)=>{return new n.Big(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.basketBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0)))},Zo=(r)=>{return r.type==="EUROPEAN"?Ur(r.inputs):Fr(r.inputs)};class Yr extends O{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){J(o);let i=r.getRandomInt({min:0,max:36}),E=i.value,A=this.determineBetOutcomes(o,E),c=Ur(o),e=this.calculateTotalPayoutAmount(A),d=c.gt(0)?e.div(c):new n.Big(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:d,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n.Big(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n.Big(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n.Big(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n.Big(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n.Big(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n.Big(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0)))}}class jr extends O{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){Q(o);let i=r.getRandomInt({min:0,max:37}),E=i.value,A=this.determineBetOutcomes(o,E),c=Fr(o),e=this.calculateTotalPayoutAmount(A),d=c.gt(0)?e.div(c):new n.Big(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:d,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>!q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0||o===37)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n.Big(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n.Big(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n.Big(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n.Big(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n.Big(0))).add(r.winningBets.basketBets.reduce((o,i)=>o.plus(i.amount.mul(7)),new n.Big(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n.Big(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0)))}}class $r extends O{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new Yr,this.americanGame=new jr}determineGameResult(r){let{gameInputs:o,...i}=r;if(r.edge===2.7&&o.type==="EUROPEAN"){let E=this.europeanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"european",betOutcomes:A,result:E.outputs.result}}}if(r.edge===5.3&&o.type==="AMERICAN"){let E=this.americanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"american",betOutcomes:A,result:E.outputs.result}}}throw new Error("Only European & American Roulette games are supported")}}var Ko=(r)=>{if(r.type==="EUROPEAN")J(r.inputs);else Q(r.inputs)};var Jr=require("big.js");var N;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(N||={});var M;((c)=>{c[c.TEN=10]="TEN";c[c.TWENTY=20]="TWENTY";c[c.THIRTY=30]="THIRTY";c[c.FORTY=40]="FORTY";c[c.FIFTY=50]="FIFTY"})(M||={});var _o={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}},Do={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}},ao={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}},No={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}},Mo={LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}},qr=new p(new Map([[1,_o],[2,Do],[3,ao],[4,No],[8,Mo]]));var zr={LOW_RISK:{10:["B","A","A","A","ZERO","A","A","A","A","ZERO"],20:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],30:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],40:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],50:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"]},MEDIUM_RISK:{10:["ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","D"],20:["A","ZERO","C","ZERO","B","ZERO","C","ZERO","C","ZERO","A","ZERO","C","ZERO","C","ZERO","D","ZERO","C","ZERO"],30:["A","ZERO","C","ZERO","A","ZERO","C","ZERO","D","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","E","ZERO","A","ZERO","C","ZERO"],40:["C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO"],50:["A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","A","ZERO","B","ZERO","A","ZERO"]},HIGH_RISK:{10:[...Array(9).fill("ZERO"),"A"],20:[...Array(19).fill("ZERO"),"A"],30:[...Array(29).fill("ZERO"),"A"],40:[...Array(39).fill("ZERO"),"A"],50:[...Array(49).fill("ZERO"),"A"]}};class Qr extends O{constructor(){super("WHEEL")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(!Object.values(M).includes(o.segments))throw new Error("Invalid segments value");if(!Object.values(N).includes(o.riskLevel))throw new Error("Invalid risk level");let A=qr.getMultipliers(i)[o.riskLevel];if(A===void 0)throw new Error(`No multipliers found for risk level ${o.riskLevel}`);let c=A[o.segments];if(c===void 0)throw new Error(`No multipliers found for segment ${o.segments}`);let e=zr[o.riskLevel];if(e===void 0)throw new Error(`No patterns found for risk level ${o.riskLevel}`);let d=e[o.segments];if(d===void 0)throw new Error(`No patterns found for segment ${o.segments}`);let R=r.getRandomInt({min:0,max:d.length-1}),B=d[R.value];if(B===void 0)throw new Error(`No pattern found for segment ${o.segments} and value ${R.value}`);let f=c[B];if(f===void 0)throw new Error(`No payout found for picked segment ${B}`);return{isFinished:!0,payoutMultiplier:new Jr.Big(f),outputs:{result:R.values},randomValues:R}}}
|
|
1
|
+
var Wr=Object.create;var{getPrototypeOf:ur,defineProperty:w,getOwnPropertyNames:fr,getOwnPropertyDescriptor:br}=Object,Or=Object.prototype.hasOwnProperty;var N=(r,o,i)=>{i=r!=null?Wr(ur(r)):{};let E=o||!r||!r.__esModule?w(i,"default",{value:r,enumerable:!0}):i;for(let A of fr(r))if(!Or.call(E,A))w(E,A,{get:()=>r[A],enumerable:!0});return E},er=new WeakMap,sr=(r)=>{var o=er.get(r),i;if(o)return o;if(o=w({},"__esModule",{value:!0}),r&&typeof r==="object"||typeof r==="function")fr(r).map((E)=>!Or.call(o,E)&&w(o,E,{get:()=>r[E],enumerable:!(i=br(r,E))||i.enumerable}));return er.set(r,o),o};var mr=(r,o)=>{for(var i in o)w(r,i,{get:o[i],enumerable:!0,configurable:!0,set:(E)=>o[i]=()=>E})};var Uo={};mr(Uo,{validateRouletteGameInputs:()=>Mo,validateAdvancedDiceInputs:()=>Ao,plinkoMultipliers:()=>m,diamondsMultipliers:()=>Dr,calculateRouletteBetAmount:()=>lo,calculateBaccaratBetAmount:()=>Kr,WheelSegments:()=>M,WheelRiskLevel:()=>l,Wheel:()=>Jr,VALID_SUITS:()=>Gr,VALID_RANKS:()=>Lr,VALID_EUROPEAN_STREETS:()=>ir,VALID_EUROPEAN_STRAIGHTS:()=>j,VALID_EUROPEAN_SPLITS:()=>rr,VALID_EUROPEAN_DOUBLE_STREETS:()=>nr,VALID_EUROPEAN_CORNERS:()=>Ar,VALID_AMERICAN_STREETS:()=>Er,VALID_AMERICAN_STRAIGHTS:()=>g,VALID_AMERICAN_SPLITS:()=>or,VALID_AMERICAN_DOUBLE_STREETS:()=>tr,VALID_AMERICAN_CORNERS:()=>cr,RouletteType:()=>z,Roulette:()=>jr,RollType:()=>Sr,RANDOM_MIN_VALUE:()=>Y,RANDOM_MAX_VALUE:()=>k,PlinkoRiskLevel:()=>s,Plinko:()=>Pr,Parity:()=>K,PLINKO_ROW_COUNTS:()=>So,OrigamiGame:()=>S,Mines:()=>vr,MIN_WIN_CHANCE:()=>dr,MAX_WIN_CHANCE:()=>Br,Limbo:()=>hr,KenoRiskLevel:()=>Mr,Keno:()=>wr,Half:()=>Z,GameErrorCode:()=>Rr,GameError:()=>e,Game:()=>R,EFFECTIVE_RANGE:()=>W,Dozen:()=>D,DiceDirection:()=>ar,Dice:()=>lr,DiamondsResultType:()=>_r,Diamonds:()=>Nr,Column:()=>_,Color:()=>p,BaccaratOutcome:()=>yr,BaccaratBetType:()=>Cr,Baccarat:()=>pr,AdvancedDice:()=>xr,AMERICAN_BASKET:()=>q});module.exports=sr(Uo);var S;((f)=>{f.DICE="DICE";f.MINES="MINES";f.KENO="KENO";f.LIMBO="LIMBO";f.ADVANCED_DICE="ADVANCED_DICE";f.BACCARAT="BACCARAT";f.DIAMONDS="DIAMONDS";f.PLINKO="PLINKO";f.ROULETTE="ROULETTE";f.WHEEL="WHEEL"})(S||={});class R{gameId;constructor(r){this.gameId=r}getGameResult(r){return this.determineGameResult(r)}}var F=require("big.js");var Rr;((o)=>o.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR")(Rr||={});class e extends Error{static createValidationError(r){return new e("INPUT_VALIDATION_ERROR",r)}static isGameError(r){return r instanceof e}errorCode;constructor(r,o){super(o);this.errorCode=r}}var Y=0,k=1e4,W=10001,dr=0.01,Br=98,gr=(r)=>{if(r<Y)throw e.createValidationError(`Lower bound ${r} is below minimum allowed value ${Y}`)},ro=(r)=>{if(r>k)throw e.createValidationError(`Upper bound ${r} is above maximum allowed value ${k}`)},P=(r)=>{if(gr(r.lower),ro(r.upper),r.lower>=r.upper)throw e.createValidationError(`Lower bound ${r.lower} must be less than ${r.upper}`)},oo=(r,o)=>{let[i,E]=r.lower<=o.lower?[r,o]:[o,r];if(i.upper>E.lower)throw e.createValidationError("Bounds must not overlap")},io=(r,o)=>o>=r.lower&&o<=r.upper,Eo=(r)=>r.upper-r.lower+1,Q=(r,o)=>o>r.lower&&o<r.upper,X=(r)=>r.upper-r.lower-1,Sr;((E)=>{E.ROLL_BETWEEN="ROLL_BETWEEN";E.ROLL_OUTSIDE="ROLL_OUTSIDE";E.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(Sr||={});var Tr=(r)=>{let i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return P(r.bounds),X(r.bounds);case"ROLL_OUTSIDE":return P(r.bounds),W-Eo(r.bounds);case"ROLL_BETWEEN_TWO":return P(r.firstBounds),P(r.secondBounds),oo(r.firstBounds,r.secondBounds),X(r.firstBounds)+X(r.secondBounds)}})(),E=F.Big(i).div(W).mul(100);if(E.lt(dr))throw e.createValidationError("Win chance too low");if(E.gt(Br))throw e.createValidationError("Win chance too high");return E},Ao=(r)=>{Tr(r)};class xr extends R{constructor(){super("ADVANCED_DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=Tr(i),A=r.getRandomInt({min:Y,max:k}),c=A.value;return{isFinished:!0,payoutMultiplier:(()=>{switch(i.mode){case"ROLL_BETWEEN":return Q(i.bounds,c);case"ROLL_OUTSIDE":return!io(i.bounds,c);case"ROLL_BETWEEN_TWO":return Q(i.firstBounds,c)||Q(i.secondBounds,c)}})()?new F.Big(100-o).div(E):new F.Big(0),outputs:{result:A.values},randomValues:A}}}var a=N(require("big.js"));var Gr=["Clubs","Diamonds","Hearts","Spades"],Lr=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],yr;((E)=>{E.PLAYER_WIN="PLAYER_WIN";E.TIE="TIE";E.BANKER_WIN="BANKER_WIN"})(yr||={});var Cr;((E)=>{E.PLAYER="PLAYER";E.TIE="TIE";E.BANKER="BANKER"})(Cr||={});var co={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:8},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},Kr=(r)=>{return new a.default(0).add(r.bets.reduce((i,E)=>i.add(E.amount),new a.default(0)))};class pr extends R{constructor(){super("BACCARAT")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(i!==1)throw new Error("Baccarat is only available at 1% edge.");this.validateGameInputs(o);let E=r.getRandomIntsWithReplacement({min:0,max:51,count:6}),A=E.values,c=A.slice(0,3),t=A.slice(3,6),O=[],d=0;for(let x of c.slice(0,2)){let L=this.mapRandomValueToCard(x),U=this.mapRandomValueToCardValue(x);O.push(L),d=(d+U)%10}let B=[],f=0;for(let x of t.slice(0,2)){let L=this.mapRandomValueToCard(x),U=this.mapRandomValueToCardValue(x);B.push(L),f=(f+U)%10}if(!this.isNaturalWin(d,f)){let x=this.shouldDrawThirdPlayerCard(d),L=null;if(x)L=this.mapRandomValueToCardValue(c[2]),O.push(this.mapRandomValueToCard(c[2])),d=(d+L)%10;if(this.shouldDrawThirdBankerCard(f,L))B.push(this.mapRandomValueToCard(t[2])),f=(f+this.mapRandomValueToCardValue(t[2]))%10}let T;if(d===f)T="TIE";else T=d>f?"PLAYER_WIN":"BANKER_WIN";let G=Kr(o),{betType:v,multiplier:Qr}=co[T],Xr=new a.default(0).add(o.bets.filter((x)=>x.type===v).reduce((x,L)=>x.add(L.amount.mul(Qr)),new a.default(0)));return{isFinished:!0,payoutMultiplier:G.gt(0)?Xr.div(G):new a.default(0),outputs:{playerCards:O,playerHandValue:d,bankerCards:B,bankerHandValue:f,gameOutcome:T,result:E.values},randomValues:E}}validateGameInputs(r){if(r.bets.length===0)throw new Error("Must place at least a single bet.");if(!r.bets.every((o)=>o.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(r){let o=Gr[Math.floor(r/13)],i=Lr[r%13];return{suit:o,rank:i}}isNaturalWin(r,o){let i=[8,9];return i.includes(r)||i.includes(o)}mapRandomValueToCardValue(r){let o=r%13;if(o===0)return 1;if(o>=10)return 10;return o+1}shouldDrawThirdPlayerCard(r){return r<=5}shouldDrawThirdBankerCard(r,o){if(o===null)return r<=5;if(r<=2)return!0;if(r===3)return o!==8;if(r===4)return[2,3,4,5,6,7].includes(o);if(r===5)return[4,5,6,7].includes(o);if(r===6)return[6,7].includes(o);return!1}}var Zr=N(require("big.js"));class y{multipliers;constructor(r){this.multipliers=r}getMultipliers(r){let o=this.multipliers.get(r);if(o===void 0)throw new Error(`Multipliers for ${r} not found`);return o}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([r,o])=>({edge:r,multipliers:o}))}}var _r;((t)=>{t.PAIR="PAIR";t.TWO_PAIR="TWO_PAIR";t.THREE_OF_A_KIND="THREE_OF_A_KIND";t.FULL_HOUSE="FULL_HOUSE";t.FOUR_OF_A_KIND="FOUR_OF_A_KIND";t.FIVE_OF_A_KIND="FIVE_OF_A_KIND"})(_r||={});var no={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50},to={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50},eo={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50},fo={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50},Oo={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50},Dr=new y(new Map([[1,no],[2,to],[3,eo],[4,fo],[8,Oo]])),Ro={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class Nr extends R{constructor(){super("DIAMONDS")}determineGameResult({generator:r,edge:o}){let i=r.getRandomIntsWithReplacement({min:0,max:6,count:5}),E=Dr.getMultipliers(o),A=i.values,c=this.calculatePayoutMultiplier(E,A);return{isFinished:!0,payoutMultiplier:Zr.default(c),outputs:{result:i.values},randomValues:i}}calculatePayoutMultiplier(r,o){let i=new Map;for(let c of o){let t=i.get(c)||0;i.set(c,t+1)}let E=[...i.values()].filter((c)=>c>1),A=this.classifyResult(E);return A===null?0:r[A]}classifyResult(r){if(r.length>2)throw new Error(`Unexpected number of repeats ${r.length}`);let[o,i]=r;if(o===void 0)return null;if(i===void 0){let E=Ro[o];if(E===void 0)throw new Error(`Unexpected single diamond repeat count: ${o}`);return E}return o===3||i===3?"FULL_HOUSE":"TWO_PAIR"}}var $=N(require("big.js"));var ar;((i)=>{i.ABOVE="ABOVE";i.BELOW="BELOW"})(ar||={});class lr extends R{constructor(){super("DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:0,max:1e4}),A=E.min,O=E.max-A+1-1,d=i.direction==="ABOVE"?O-i.selectedValue:i.selectedValue,B=new $.default(d).div(O).mul(100);return{isFinished:!0,payoutMultiplier:(i.direction==="ABOVE"?E.value>i.selectedValue:E.value<i.selectedValue)?new $.default(100-o).div(B):new $.default(0),outputs:{result:E.values},randomValues:E}}}var u=N(require("big.js"));var Mr;((A)=>{A.CLASSIC="CLASSIC";A.LOW_RISK="LOW_RISK";A.MEDIUM_RISK="MEDIUM_RISK";A.HIGH_RISK="HIGH_RISK"})(Mr||={});var Bo={[1]:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]},[2]:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]},[3]:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]},[4]:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]},[5]:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]},[6]:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]},[7]:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]},[8]:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]},[9]:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]},[10]:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}};class wr extends R{multiplierOverrides;get multipliers(){return this.multiplierOverrides??Bo}constructor(r){super("KENO");this.multiplierOverrides=r;if(r)this.validateMultiplierOverrides(r)}determineGameResult({generator:r,edge:o,gameInputs:i}){if(o!==1&&!this.multiplierOverrides)throw new Error("Multiplier overrides must be specified if an edge of 1% is not desirable");if(i.selectedNumbers.length===0)throw new Error("No numbers selected");if(i.selectedNumbers.length>10)throw new Error("Maximum of 10 numbers can be selected");for(let t of i.selectedNumbers){if(t%1!==0)throw new Error("Only integers can be selected");if(t<0||t>39)throw new Error("Invalid number selected")}let E=r.getUniqueRandomInts({min:0,max:39,count:10}),A=i.selectedNumbers.filter((t)=>E.values.includes(t));return{isFinished:!0,payoutMultiplier:A.length>0?new u.default(this.multipliers[i.selectedNumbers.length][i.riskLevel][A.length]??0):new u.default(0),outputs:{result:E.values},randomValues:E}}validateMultiplierOverrides(r){for(let[o,i]of Object.entries(r)){let E=Number(o);for(let[A,c]of Object.entries(i))if(c.length!==E+1)throw new Error(`Invalid count of multipliers for tiles ${E} and risk level ${A}. Expected ${E+1}, but got ${c.length}`)}}}var C=N(require("big.js"));var Vr=(r,o)=>{return r.gt(o)?r:o};var Hr=(r,o)=>{return r.lt(o)?r:o};class hr extends R{constructor(){super("LIMBO")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:1,max:4294967295}),A=E.max,c=new C.default(16777216),t=new C.default(1),O=new C.default(1e6),d=E.value,B=new C.default(d-1).div(A),f=(100-o)/100,T=c.div(B.mul(c).plus(1)).mul(f),G=Vr(t,Hr(T,O));return{isFinished:!0,payoutMultiplier:G.gte(i.targetMultiplier)?new C.default(i.targetMultiplier):new C.default(0),outputs:{randomMultiplier:G,result:E.values},randomValues:E}}}var V=N(require("big.js"));var b=(r,o)=>{if(o<0||r<0||o>r)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(o>r-o)o=r-o;let i=1;for(let E=1;E<=o;E++)i=i*(r-E+1)/E;return i};class vr extends R{constructor(){super("MINES")}determineGameResult({generator:r,edge:o,gameInputs:i}){if(i.minesCount<=0||i.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(i.selectedTiles.length>25-i.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let t=r.getUniqueRandomInts({min:1,max:25,count:i.minesCount}),O=t.values.some((v)=>i.selectedTiles.includes(v)),d=i.hasCashedOut||O,B=(100-o)/100,f=new V.default(b(25-i.minesCount,i.selectedTiles.length)).div(new V.default(b(25,i.selectedTiles.length))),G=i.hasCashedOut&&!O?new V.default(B).div(f):new V.default(0);return{isFinished:d,payoutMultiplier:G,outputs:{result:t.values},randomValues:t}}}var Ur=require("big.js");var s;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(s||={});var So=[8,9,10,11,12,13,14,15,16],To={LOW_RISK:{8:[6,2.1,1.1,1,0.5,1,1.1,2.1,6],9:[6,2,1.6,1,0.7,0.7,1,1.6,2,6],10:[9,3,1.4,1.1,1,0.5,1,1.1,1.4,3,9],11:[8,3,1.9,1.3,1,0.7,0.7,1,1.3,1.9,3,8],12:[10,3,1.6,1.4,1.1,1,0.5,1,1.1,1.4,1.6,3,10],13:[8,4,3,1.9,1.2,0.9,0.7,0.7,0.9,1.2,1.9,3,4,8],14:[7,4,1.9,1.4,1.3,1.1,1,0.5,1,1.1,1.3,1.4,1.9,4,7],15:[15,8,3,2,1.5,1.1,1,0.7,0.7,1,1.1,1.5,2,3,8,15],16:[16,9,2,1.4,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,1.4,2,9,16]},MEDIUM_RISK:{8:[13,3,1.3,0.7,0.4,0.7,1.3,3,13],9:[18,4,1.7,0.9,0.5,0.5,0.9,1.7,4,18],10:[22,5,2,1.4,0.6,0.4,0.6,1.4,2,5,22],11:[24,6,3,1.8,0.7,0.5,0.5,0.7,1.8,3,6,24],12:[33,11,4,2,1.1,0.6,0.3,0.6,1.1,2,4,11,33],13:[43,13,6,3,1.3,0.7,0.4,0.4,0.7,1.3,3,6,13,43],14:[58,15,7,4,1.9,1,0.5,0.2,0.5,1,1.9,4,7,15,58],15:[88,18,11,5,3,1.3,0.5,0.3,0.3,0.5,1.3,3,5,11,18,88],16:[110,41.1,10,5,3,1.5,1,0.5,0.3,0.5,1,1.5,3,5,10,41.1,110]},HIGH_RISK:{8:[29,4,1.5,0.3,0.2,0.3,1.5,4,29],9:[43,7,2,0.6,0.2,0.2,0.6,2,7,43],10:[76,10,3,0.9,0.3,0.2,0.3,0.9,3,10,76],11:[120,13.9,5.2,1.4,0.4,0.2,0.2,0.4,1.4,5.2,13.9,120],12:[170,23.8,8.1,2,0.7,0.2,0.2,0.2,0.7,2,8.1,23.8,170],13:[260,36.7,11,4,1,0.2,0.2,0.2,0.2,1,4,11,36.7,260],14:[420,56.1,18,5,1.9,0.3,0.2,0.2,0.2,0.3,1.9,5,18,56.1,420],15:[620,82.8,27,8,3,0.5,0.2,0.2,0.2,0.2,0.5,3,8,27,82.8,620],16:[1000,129.9,26.1,9,4,2,0.2,0.2,0.2,0.2,0.2,2,4,9,26.1,129.9,1000]}},xo={LOW_RISK:{8:[6,1.9,1.1,1,0.5,1,1.1,1.9,6],9:[6,1.7,1.6,1,0.7,0.7,1,1.6,1.7,6],10:[9,2.5,1.4,1.1,1,0.5,1,1.1,1.4,2.5,9],11:[9,2.5,1.8,1.3,1,0.7,0.7,1,1.3,1.8,2.5,9],12:[10,3.2,1.6,1.3,1.1,1,0.5,1,1.1,1.3,1.6,3.2,10],13:[8,3.7,2.9,1.8,1.2,0.9,0.7,0.7,0.9,1.2,1.8,2.9,3.7,8],14:[7,4,1.8,1.2,1.3,1.1,1,0.5,1,1.1,1.3,1.2,1.8,4,7],15:[15,7.6,2.8,2,1.4,1.1,1,0.7,0.7,1,1.1,1.4,2,2.8,7.6,15],16:[16,9,1.7,1.2,1.3,1.2,1.1,1,0.5,1,1.1,1.2,1.3,1.2,1.7,9,16]},MEDIUM_RISK:{8:[13,3.2,1.4,0.6,0.4,0.6,1.4,3.2,13],9:[18,3.7,1.7,0.9,0.5,0.5,0.9,1.7,3.7,18],10:[22,5,1.9,1.4,0.6,0.4,0.6,1.4,1.9,5,22],11:[24,6,2.8,1.8,0.7,0.5,0.5,0.7,1.8,2.8,6,24],12:[33,11.1,4,1.9,1.1,0.6,0.3,0.6,1.1,1.9,4,11.1,33],13:[43,13.7,6.1,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,6.1,13.7,43],14:[58,13.7,6.7,3.9,1.9,1,0.5,0.2,0.5,1,1.9,3.9,6.7,13.7,58],15:[88,17.7,10.8,5,2.9,1.3,0.5,0.3,0.3,0.5,1.3,2.9,5,10.8,17.7,88],16:[110,40.5,9.8,4.8,2.9,1.5,1,0.5,0.3,0.5,1,1.5,2.9,4.8,9.8,40.5,110]},HIGH_RISK:{8:[29,3.8,1.5,0.3,0.2,0.3,1.5,3.8,29],9:[43,7.1,1.9,0.6,0.2,0.2,0.6,1.9,7.1,43],10:[76,9.9,2.9,0.9,0.3,0.2,0.3,0.9,2.9,9.9,76],11:[120,13.4,5.1,1.4,0.4,0.2,0.2,0.4,1.4,5.1,13.4,120],12:[170,23.2,7.9,2,0.7,0.2,0.2,0.2,0.7,2,7.9,23.2,170],13:[260,36.6,10.5,4,1,0.2,0.2,0.2,0.2,1,4,10.5,36.6,260],14:[420,55.5,17.6,4.9,1.9,0.3,0.2,0.2,0.2,0.3,1.9,4.9,17.6,55.5,420],15:[620,82.3,26.8,7.7,3,0.5,0.2,0.2,0.2,0.2,0.5,3,7.7,26.8,82.3,620],16:[1000,129.8,25.2,8.6,4,2,0.2,0.2,0.2,0.2,0.2,2,4,8.6,25.2,129.8,1000]}},Go={LOW_RISK:{8:[6,2.2,1.1,1,0.4,1,1.1,2.2,6],9:[6,1.8,1.5,1,0.7,0.7,1,1.5,1.8,6],10:[9,2.4,1.3,1.1,1,0.5,1,1.1,1.3,2.4,9],11:[8,2.7,1.9,1.2,1,0.7,0.7,1,1.2,1.9,2.7,8],12:[10,3.3,1.6,1.2,1.1,1,0.5,1,1.1,1.2,1.6,3.3,10],13:[8,3.8,2.9,1.9,1.1,0.9,0.7,0.7,0.9,1.1,1.9,2.9,3.8,8],14:[7,3.9,2,1.4,1.3,1.1,1,0.4,1,1.1,1.3,1.4,2,3.9,7],15:[15,7.9,2.5,2,1.3,1.1,1,0.7,0.7,1,1.1,1.3,2,2.5,7.9,15],16:[16,8.9,1.9,1.4,1.4,1.2,1.1,1,0.4,1,1.1,1.2,1.4,1.4,1.9,8.9,16]},MEDIUM_RISK:{8:[13,3.5,1.2,0.7,0.3,0.7,1.2,3.5,13],9:[18,3.8,1.6,0.9,0.5,0.5,0.9,1.6,3.8,18],10:[22,5.2,2,1.3,0.6,0.4,0.6,1.3,2,5.2,22],11:[24,5.6,2.7,1.8,0.7,0.5,0.5,0.7,1.8,2.7,5.6,24],12:[33,11.3,4,1.8,1.1,0.6,0.3,0.6,1.1,1.8,4,11.3,33],13:[43,12.9,5.7,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,5.7,12.9,43],14:[58,13.7,6.9,3.9,1.8,1,0.5,0.2,0.5,1,1.8,3.9,6.9,13.7,58],15:[88,18,10.9,4.9,2.8,1.3,0.5,0.3,0.3,0.5,1.3,2.8,4.9,10.9,18,88],16:[110,39.9,9.9,5,2.9,1.4,1,0.5,0.3,0.5,1,1.4,2.9,5,9.9,39.9,110]},HIGH_RISK:{8:[29,4,1.4,0.3,0.2,0.3,1.4,4,29],9:[43,7.3,2,0.5,0.2,0.2,0.5,2,7.3,43],10:[76,9.8,2.8,0.9,0.3,0.2,0.3,0.9,2.8,9.8,76],11:[120,13.5,4.9,1.4,0.4,0.2,0.2,0.4,1.4,4.9,13.5,120],12:[170,23.3,7.9,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.9,23.3,170],13:[260,36.2,10.4,3.9,1,0.2,0.2,0.2,0.2,1,3.9,10.4,36.2,260],14:[420,54.8,17.9,4.9,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.9,17.9,54.8,420],15:[620,81.9,26.6,7.7,2.9,0.5,0.2,0.2,0.2,0.2,0.5,2.9,7.7,26.6,81.9,620],16:[1000,130,24.9,8.4,3.9,2,0.2,0.2,0.2,0.2,0.2,2,3.9,8.4,24.9,130,1000]}},Lo={LOW_RISK:{8:[6,2,1.1,1,0.4,1,1.1,2,6],9:[6,1.9,1.4,1,0.7,0.7,1,1.4,1.9,6],10:[9,2.8,1.1,1.1,1,0.5,1,1.1,1.1,2.8,9],11:[8,2.7,1.7,1.2,1,0.7,0.7,1,1.2,1.7,2.7,8],12:[10,2.7,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,2.7,10],13:[8,3.5,2.8,1.9,1.3,0.9,0.6,0.6,0.9,1.3,1.9,2.8,3.5,8],14:[7,3.3,1.6,1.3,1.3,1.1,1,0.4,1,1.1,1.3,1.3,1.6,3.3,7],15:[15,8,2.9,2,1.4,1.2,1,0.6,0.6,1,1.2,1.4,2,2.9,8,15],16:[16,9.1,2.2,1.4,1.2,1.2,1.1,1,0.4,1,1.1,1.2,1.2,1.4,2.2,9.1,16]},MEDIUM_RISK:{8:[13,2.9,1.2,0.7,0.4,0.7,1.2,2.9,13],9:[18,3.5,1.6,0.9,0.5,0.5,0.9,1.6,3.5,18],10:[22,4.7,2,1.3,0.6,0.4,0.6,1.3,2,4.7,22],11:[24,5.7,2.5,1.8,0.7,0.5,0.5,0.7,1.8,2.5,5.7,24],12:[33,10.7,3.8,1.8,1.1,0.6,0.3,0.6,1.1,1.8,3.8,10.7,33],13:[43,12.6,5.6,2.7,1.3,0.7,0.4,0.4,0.7,1.3,2.7,5.6,12.6,43],14:[58,13.7,6.4,3.8,1.8,1,0.5,0.2,0.5,1,1.8,3.8,6.4,13.7,58],15:[88,17.7,10.7,4.9,2.7,1.3,0.5,0.3,0.3,0.5,1.3,2.7,4.9,10.7,17.7,88],16:[110,39.7,9.6,4.8,2.8,1.4,1,0.5,0.3,0.5,1,1.4,2.8,4.8,9.6,39.7,110]},HIGH_RISK:{8:[29,3.9,1.4,0.3,0.2,0.3,1.4,3.9,29],9:[43,6.9,1.8,0.6,0.2,0.2,0.6,1.8,6.9,43],10:[76,9.8,2.7,0.9,0.3,0.2,0.3,0.9,2.7,9.8,76],11:[120,13.1,5.1,1.3,0.4,0.2,0.2,0.4,1.3,5.1,13.1,120],12:[170,22.7,7.7,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.7,22.7,170],13:[260,35.9,10.3,3.8,1,0.2,0.2,0.2,0.2,1,3.8,10.3,35.9,260],14:[420,54.2,17.5,4.8,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.8,17.5,54.2,420],15:[620,80.6,26.1,7.8,2.8,0.5,0.2,0.2,0.2,0.2,0.5,2.8,7.8,26.1,80.6,620],16:[1000,129.7,24.7,8.2,3.8,2,0.2,0.2,0.2,0.2,0.2,2,3.8,8.2,24.7,129.7,1000]}},yo={LOW_RISK:{8:[5,1.8,1,1,0.4,1,1,1.8,5],9:[5,1.7,1.2,1,0.7,0.7,1,1.2,1.7,5],10:[9,2.8,1.2,1,1,0.4,1,1,1.2,2.8,9],11:[8,2.5,1.6,1,1,0.7,0.7,1,1,1.6,2.5,8],12:[10,2.5,1.3,1.3,1,1,0.4,1,1,1.3,1.3,2.5,10],13:[8,4.1,2.8,1.8,1.1,0.9,0.6,0.6,0.9,1.1,1.8,2.8,4.1,8],14:[7,3.3,1.7,1.2,1.2,1,1,0.4,1,1,1.2,1.2,1.7,3.3,7],15:[15,7.3,2.9,1.9,1.4,1,1,0.6,0.6,1,1,1.4,1.9,2.9,7.3,15],16:[16,8.7,2,1.5,1.3,1,1.1,1,0.3,1,1.1,1,1.3,1.5,2,8.7,16]},MEDIUM_RISK:{8:[13,2.6,1.1,0.7,0.4,0.7,1.1,2.6,13],9:[17,3.3,1.4,0.9,0.5,0.5,0.9,1.4,3.3,17],10:[21,4.1,1.7,1.3,0.6,0.4,0.6,1.3,1.7,4.1,21],11:[23,5.6,2.4,1.6,0.7,0.5,0.5,0.7,1.6,2.4,5.6,23],12:[32,10.2,3.7,1.7,1.1,0.6,0.2,0.6,1.1,1.7,3.7,10.2,32],13:[42,11.7,5.3,2.5,1.2,0.7,0.4,0.4,0.7,1.2,2.5,5.3,11.7,42],14:[56,13.2,5.9,3.6,1.6,1,0.5,0.2,0.5,1,1.6,3.6,5.9,13.2,56],15:[86,17.3,10,4.6,2.6,1.2,0.5,0.3,0.3,0.5,1.2,2.6,4.6,10,17.3,86],16:[107,39,9.9,4.5,2.4,1.3,1,0.5,0.3,0.5,1,1.3,2.4,4.5,9.9,39,107]},HIGH_RISK:{8:[28,3.3,1.4,0.3,0.2,0.3,1.4,3.3,28],9:[42,6.7,1.6,0.6,0.2,0.2,0.6,1.6,6.7,42],10:[74,9.6,2.6,0.9,0.3,0.1,0.3,0.9,2.6,9.6,74],11:[116,12.7,4.8,1.2,0.4,0.2,0.2,0.4,1.2,4.8,12.7,116],12:[165,20.9,7.2,1.8,0.7,0.2,0.2,0.2,0.7,1.8,7.2,20.9,165],13:[252,33.9,10.1,3.4,1,0.2,0.2,0.2,0.2,1,3.4,10.1,33.9,252],14:[407,51.9,16.3,4.6,1.7,0.3,0.2,0.2,0.2,0.3,1.7,4.6,16.3,51.9,407],15:[600,76.9,24.9,7.4,2.6,0.5,0.2,0.2,0.2,0.2,0.5,2.6,7.4,24.9,76.9,600],16:[1000,122,24.5,8,3.7,1.8,0.2,0.2,0.2,0.2,0.2,1.8,3.7,8,24.5,122,1000]}},m=new y(new Map([[1,To],[2,xo],[3,Go],[4,Lo],[8,yo]]));class Pr extends R{constructor(){super("PLINKO")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(o.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(o.numberOfRows<8||o.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let E=o.numberOfRows,t=m.getMultipliers(i)[o.riskLevel][E],O=r.getRandomIntsWithReplacement({min:0,max:1,count:o.numberOfRows}),B=O.values.reduce((T,G)=>T+G,0),f=t[B];if(f===void 0)throw new Error(`No payout found for end position ${B}`);return{isFinished:!0,payoutMultiplier:Ur.Big(f),outputs:{result:O.values},randomValues:O}}}var n=require("big.js");var j=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],g=[37,...j],rr=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],or=[[0,1],[0,3],[0,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],ir=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],Er=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],Ar=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],cr=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],q=[0,1,2,3,37],nr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],tr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],K;((i)=>{i.EVEN="EVEN";i.ODD="ODD"})(K||={});var p;((i)=>{i.RED="RED";i.BLACK="BLACK"})(p||={});var Z;((i)=>{i.LOW="LOW";i.HIGH="HIGH"})(Z||={});var _;((E)=>{E.TOP="TOP";E.MIDDLE="MIDDLE";E.BOTTOM="BOTTOM"})(_||={});var D;((E)=>{E.FIRST="FIRST";E.SECOND="SECOND";E.THIRD="THIRD"})(D||={});var z;((i)=>{i.AMERICAN="AMERICAN";i.EUROPEAN="EUROPEAN"})(z||={});var I=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw e.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&H(o.value)))throw e.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&Co(o.values)))throw e.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&Ko(o.values)))throw e.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&po(o.values)))throw e.createValidationError("Invalid corner bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&Zo(o.values)))throw e.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.parity)))throw e.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(p).includes(o.color)))throw e.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw e.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.column)))throw e.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(D).includes(o.dozen)))throw e.createValidationError("Invalid dozen bet.")},H=(r)=>{return j.includes(r)},Co=(r)=>{if(r.length!==2)return!1;if(!r.every(H))return!1;return rr.some(([o,i])=>o===r[0]&&i===r[1])},Ko=(r)=>{if(r.length!==3)return!1;if(!r.every(H))return!1;return ir.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},po=(r)=>{if(r.length!==4)return!1;if(!r.every(H))return!1;return Ar.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},Zo=(r)=>{if(r.length!==6)return!1;if(!r.every(H))return!1;return nr.some(([o,i,E,A,c,t])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&t===r[5])};var J=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.basketBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw e.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&h(o.value)))throw e.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&_o(o.values)))throw e.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&Do(o.values)))throw e.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&No(o.values)))throw e.createValidationError("Invalid corner bet.");if(!r.basketBets.every((o)=>o.amount.gte(0)))throw e.createValidationError("Invalid basket bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&ao(o.values)))throw e.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.parity)))throw e.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(p).includes(o.color)))throw e.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw e.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.column)))throw e.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(D).includes(o.dozen)))throw e.createValidationError("Invalid dozen bet.")},h=(r)=>{return g.includes(r)};function _o(r){if(r.length!==2)return!1;if(!r.every(h))return!1;return or.some(([o,i])=>o===r[0]&&i===r[1])}var Do=(r)=>{if(r.length!==3)return!1;if(!r.every(h))return!1;return Er.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},No=(r)=>{if(r.length!==4)return!1;if(!r.every(h))return!1;return cr.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},ao=(r)=>{if(r.length!==6)return!1;if(!r.every(h))return!1;return tr.some(([o,i,E,A,c,t])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&t===r[5])};var Fr=(r)=>{return new n.Big(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0)))},Yr=(r)=>{return new n.Big(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.basketBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n.Big(0)))},lo=(r)=>{return r.type==="EUROPEAN"?Fr(r.inputs):Yr(r.inputs)};class kr extends R{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){I(o);let i=r.getRandomInt({min:0,max:36}),E=i.value,A=this.determineBetOutcomes(o,E),c=Fr(o),t=this.calculateTotalPayoutAmount(A),O=c.gt(0)?t.div(c):new n.Big(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:O,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n.Big(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n.Big(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n.Big(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n.Big(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n.Big(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n.Big(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0)))}}class $r extends R{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){J(o);let i=r.getRandomInt({min:0,max:37}),E=i.value,A=this.determineBetOutcomes(o,E),c=Yr(o),t=this.calculateTotalPayoutAmount(A),O=c.gt(0)?t.div(c):new n.Big(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:O,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>!q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0||o===37)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n.Big(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n.Big(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n.Big(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n.Big(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n.Big(0))).add(r.winningBets.basketBets.reduce((o,i)=>o.plus(i.amount.mul(7)),new n.Big(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n.Big(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n.Big(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n.Big(0)))}}class jr extends R{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new kr,this.americanGame=new $r}determineGameResult(r){let{gameInputs:o,...i}=r;if(r.edge===2.7&&o.type==="EUROPEAN"){let E=this.europeanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"european",betOutcomes:A,result:E.outputs.result}}}if(r.edge===5.3&&o.type==="AMERICAN"){let E=this.americanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"american",betOutcomes:A,result:E.outputs.result}}}throw new Error("Only European & American Roulette games are supported")}}var Mo=(r)=>{if(r.type==="EUROPEAN")I(r.inputs);else J(r.inputs)};var Ir=require("big.js");var l;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(l||={});var M;((c)=>{c[c.TEN=10]="TEN";c[c.TWENTY=20]="TWENTY";c[c.THIRTY=30]="THIRTY";c[c.FORTY=40]="FORTY";c[c.FIFTY=50]="FIFTY"})(M||={});var wo={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}},Vo={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}},Ho={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}},ho={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}},vo={LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}},qr=new y(new Map([[1,wo],[2,Vo],[3,Ho],[4,ho],[8,vo]]));var zr={LOW_RISK:{10:["B","A","A","A","ZERO","A","A","A","A","ZERO"],20:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],30:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],40:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],50:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"]},MEDIUM_RISK:{10:["ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","D"],20:["A","ZERO","C","ZERO","B","ZERO","C","ZERO","C","ZERO","A","ZERO","C","ZERO","C","ZERO","D","ZERO","C","ZERO"],30:["A","ZERO","C","ZERO","A","ZERO","C","ZERO","D","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","E","ZERO","A","ZERO","C","ZERO"],40:["C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO"],50:["A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","A","ZERO","B","ZERO","A","ZERO"]},HIGH_RISK:{10:[...Array(9).fill("ZERO"),"A"],20:[...Array(19).fill("ZERO"),"A"],30:[...Array(29).fill("ZERO"),"A"],40:[...Array(39).fill("ZERO"),"A"],50:[...Array(49).fill("ZERO"),"A"]}};class Jr extends R{constructor(){super("WHEEL")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(!Object.values(M).includes(o.segments))throw new Error("Invalid segments value");if(!Object.values(l).includes(o.riskLevel))throw new Error("Invalid risk level");let A=qr.getMultipliers(i)[o.riskLevel];if(A===void 0)throw new Error(`No multipliers found for risk level ${o.riskLevel}`);let c=A[o.segments];if(c===void 0)throw new Error(`No multipliers found for segment ${o.segments}`);let t=zr[o.riskLevel];if(t===void 0)throw new Error(`No patterns found for risk level ${o.riskLevel}`);let O=t[o.segments];if(O===void 0)throw new Error(`No patterns found for segment ${o.segments}`);let d=r.getRandomInt({min:0,max:O.length-1}),B=O[d.value];if(B===void 0)throw new Error(`No pattern found for segment ${o.segments} and value ${d.value}`);let f=c[B];if(f===void 0)throw new Error(`No payout found for picked segment ${B}`);return{isFinished:!0,payoutMultiplier:new Ir.Big(f),outputs:{result:d.values},randomValues:d}}}
|
package/dist/index.d.ts
CHANGED
|
@@ -249,15 +249,25 @@ export interface PlinkoGameInputs {
|
|
|
249
249
|
numberOfRows: number;
|
|
250
250
|
riskLevel: PlinkoRiskLevel;
|
|
251
251
|
}
|
|
252
|
-
export interface PlinkoMultipliers {
|
|
253
|
-
rows: number;
|
|
254
|
-
payout: Record<PlinkoRiskLevel, number[]>;
|
|
255
|
-
}
|
|
256
|
-
export declare const plinkoMultipliers: MultiplierContainer<PlinkoMultipliers[]>;
|
|
257
252
|
export declare class Plinko extends Game<PlinkoGameInputs> {
|
|
258
253
|
constructor();
|
|
259
254
|
protected determineGameResult({ generator, gameInputs, edge }: GetGameResultRequest<PlinkoGameInputs>): GameResult;
|
|
260
255
|
}
|
|
256
|
+
export declare const PLINKO_ROW_COUNTS: readonly [
|
|
257
|
+
8,
|
|
258
|
+
9,
|
|
259
|
+
10,
|
|
260
|
+
11,
|
|
261
|
+
12,
|
|
262
|
+
13,
|
|
263
|
+
14,
|
|
264
|
+
15,
|
|
265
|
+
16
|
|
266
|
+
];
|
|
267
|
+
export type PlinkoRowCount = (typeof PLINKO_ROW_COUNTS)[number];
|
|
268
|
+
export type PlinkoMultiplierSet = Record<PlinkoRowCount, number[]>;
|
|
269
|
+
export type PlinkoMultipliers = Record<PlinkoRiskLevel, PlinkoMultiplierSet>;
|
|
270
|
+
export declare const plinkoMultipliers: MultiplierContainer<PlinkoMultipliers>;
|
|
261
271
|
export declare const VALID_EUROPEAN_STRAIGHTS: readonly [
|
|
262
272
|
0,
|
|
263
273
|
1,
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var L;((f)=>{f.DICE="DICE";f.MINES="MINES";f.KENO="KENO";f.LIMBO="LIMBO";f.ADVANCED_DICE="ADVANCED_DICE";f.BACCARAT="BACCARAT";f.DIAMONDS="DIAMONDS";f.PLINKO="PLINKO";f.ROULETTE="ROULETTE";f.WHEEL="WHEEL"})(L||={});class O{gameId;constructor(r){this.gameId=r}getGameResult(r){return this.determineGameResult(r)}}import{Big as Y}from"big.js";var Lr;((o)=>o.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR")(Lr||={});class t extends Error{static createValidationError(r){return new t("INPUT_VALIDATION_ERROR",r)}static isGameError(r){return r instanceof t}errorCode;constructor(r,o){super(o);this.errorCode=r}}var j=0,$=1e4,I=10001,Sr=0.01,xr=98,lr=(r)=>{if(r<j)throw t.createValidationError(`Lower bound ${r} is below minimum allowed value ${j}`)},pr=(r)=>{if(r>$)throw t.createValidationError(`Upper bound ${r} is above maximum allowed value ${$}`)},h=(r)=>{if(lr(r.lower),pr(r.upper),r.lower>=r.upper)throw t.createValidationError(`Lower bound ${r.lower} must be less than ${r.upper}`)},yr=(r,o)=>{let[i,E]=r.lower<=o.lower?[r,o]:[o,r];if(i.upper>E.lower)throw t.createValidationError("Bounds must not overlap")},Gr=(r,o)=>o>=r.lower&&o<=r.upper,Cr=(r)=>r.upper-r.lower+1,U=(r,o)=>o>r.lower&&o<r.upper,F=(r)=>r.upper-r.lower-1,Zr;((E)=>{E.ROLL_BETWEEN="ROLL_BETWEEN";E.ROLL_OUTSIDE="ROLL_OUTSIDE";E.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(Zr||={});var u=(r)=>{let i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return h(r.bounds),F(r.bounds);case"ROLL_OUTSIDE":return h(r.bounds),I-Cr(r.bounds);case"ROLL_BETWEEN_TWO":return h(r.firstBounds),h(r.secondBounds),yr(r.firstBounds,r.secondBounds),F(r.firstBounds)+F(r.secondBounds)}})(),E=Y(i).div(I).mul(100);if(E.lt(Sr))throw t.createValidationError("Win chance too low");if(E.gt(xr))throw t.createValidationError("Win chance too high");return E},_o=(r)=>{u(r)};class Kr extends O{constructor(){super("ADVANCED_DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=u(i),A=r.getRandomInt({min:j,max:$}),c=A.value;return{isFinished:!0,payoutMultiplier:(()=>{switch(i.mode){case"ROLL_BETWEEN":return U(i.bounds,c);case"ROLL_OUTSIDE":return!Gr(i.bounds,c);case"ROLL_BETWEEN_TWO":return U(i.firstBounds,c)||U(i.secondBounds,c)}})()?new Y(100-o).div(E):new Y(0),outputs:{result:A.values},randomValues:A}}}import D from"big.js";var _r=["Clubs","Diamonds","Hearts","Spades"],Dr=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],ar;((E)=>{E.PLAYER_WIN="PLAYER_WIN";E.TIE="TIE";E.BANKER_WIN="BANKER_WIN"})(ar||={});var Nr;((E)=>{E.PLAYER="PLAYER";E.TIE="TIE";E.BANKER="BANKER"})(Nr||={});var Mr={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:8},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},wr=(r)=>{return new D(0).add(r.bets.reduce((i,E)=>i.add(E.amount),new D(0)))};class Vr extends O{constructor(){super("BACCARAT")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(i!==1)throw new Error("Baccarat is only available at 1% edge.");this.validateGameInputs(o);let E=r.getRandomIntsWithReplacement({min:0,max:51,count:6}),A=E.values,c=A.slice(0,3),e=A.slice(3,6),d=[],R=0;for(let T of c.slice(0,2)){let x=this.mapRandomValueToCard(T),v=this.mapRandomValueToCardValue(T);d.push(x),R=(R+v)%10}let B=[],f=0;for(let T of e.slice(0,2)){let x=this.mapRandomValueToCard(T),v=this.mapRandomValueToCardValue(T);B.push(x),f=(f+v)%10}if(!this.isNaturalWin(R,f)){let T=this.shouldDrawThirdPlayerCard(R),x=null;if(T)x=this.mapRandomValueToCardValue(c[2]),d.push(this.mapRandomValueToCard(c[2])),R=(R+x)%10;if(this.shouldDrawThirdBankerCard(f,x))B.push(this.mapRandomValueToCard(e[2])),f=(f+this.mapRandomValueToCardValue(e[2]))%10}let S;if(R===f)S="TIE";else S=R>f?"PLAYER_WIN":"BANKER_WIN";let l=wr(o),{betType:V,multiplier:Br}=Mr[S],Tr=new D(0).add(o.bets.filter((T)=>T.type===V).reduce((T,x)=>T.add(x.amount.mul(Br)),new D(0)));return{isFinished:!0,payoutMultiplier:l.gt(0)?Tr.div(l):new D(0),outputs:{playerCards:d,playerHandValue:R,bankerCards:B,bankerHandValue:f,gameOutcome:S,result:E.values},randomValues:E}}validateGameInputs(r){if(r.bets.length===0)throw new Error("Must place at least a single bet.");if(!r.bets.every((o)=>o.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(r){let o=_r[Math.floor(r/13)],i=Dr[r%13];return{suit:o,rank:i}}isNaturalWin(r,o){let i=[8,9];return i.includes(r)||i.includes(o)}mapRandomValueToCardValue(r){let o=r%13;if(o===0)return 1;if(o>=10)return 10;return o+1}shouldDrawThirdPlayerCard(r){return r<=5}shouldDrawThirdBankerCard(r,o){if(o===null)return r<=5;if(r<=2)return!0;if(r===3)return o!==8;if(r===4)return[2,3,4,5,6,7].includes(o);if(r===5)return[4,5,6,7].includes(o);if(r===6)return[6,7].includes(o);return!1}}import vr from"big.js";class p{multipliers;constructor(r){this.multipliers=r}getMultipliers(r){let o=this.multipliers.get(r);if(o===void 0)throw new Error(`Multipliers for ${r} not found`);return o}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([r,o])=>({edge:r,multipliers:o}))}}var hr;((e)=>{e.PAIR="PAIR";e.TWO_PAIR="TWO_PAIR";e.THREE_OF_A_KIND="THREE_OF_A_KIND";e.FULL_HOUSE="FULL_HOUSE";e.FOUR_OF_A_KIND="FOUR_OF_A_KIND";e.FIVE_OF_A_KIND="FIVE_OF_A_KIND"})(hr||={});var Hr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50},kr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50},Pr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50},Ur={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50},Fr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50},Yr=new p(new Map([[1,Hr],[2,kr],[3,Pr],[4,Ur],[8,Fr]])),jr={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class $r extends O{constructor(){super("DIAMONDS")}determineGameResult({generator:r,edge:o}){let i=r.getRandomIntsWithReplacement({min:0,max:6,count:5}),E=Yr.getMultipliers(o),A=i.values,c=this.calculatePayoutMultiplier(E,A);return{isFinished:!0,payoutMultiplier:vr(c),outputs:{result:i.values},randomValues:i}}calculatePayoutMultiplier(r,o){let i=new Map;for(let c of o){let e=i.get(c)||0;i.set(c,e+1)}let E=[...i.values()].filter((c)=>c>1),A=this.classifyResult(E);return A===null?0:r[A]}classifyResult(r){if(r.length>2)throw new Error(`Unexpected number of repeats ${r.length}`);let[o,i]=r;if(o===void 0)return null;if(i===void 0){let E=jr[o];if(E===void 0)throw new Error(`Unexpected single diamond repeat count: ${o}`);return E}return o===3||i===3?"FULL_HOUSE":"TWO_PAIR"}}import q from"big.js";var qr;((i)=>{i.ABOVE="ABOVE";i.BELOW="BELOW"})(qr||={});class zr extends O{constructor(){super("DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:0,max:1e4}),A=E.min,d=E.max-A+1-1,R=i.direction==="ABOVE"?d-i.selectedValue:i.selectedValue,B=new q(R).div(d).mul(100);return{isFinished:!0,payoutMultiplier:(i.direction==="ABOVE"?E.value>i.selectedValue:E.value<i.selectedValue)?new q(100-o).div(B):new q(0),outputs:{result:E.values},randomValues:E}}}import W from"big.js";var Jr;((A)=>{A.CLASSIC="CLASSIC";A.LOW_RISK="LOW_RISK";A.MEDIUM_RISK="MEDIUM_RISK";A.HIGH_RISK="HIGH_RISK"})(Jr||={});var Qr={[1]:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]},[2]:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]},[3]:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]},[4]:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]},[5]:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]},[6]:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]},[7]:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]},[8]:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]},[9]:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]},[10]:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}};class Xr extends O{multiplierOverrides;get multipliers(){return this.multiplierOverrides??Qr}constructor(r){super("KENO");this.multiplierOverrides=r;if(r)this.validateMultiplierOverrides(r)}determineGameResult({generator:r,edge:o,gameInputs:i}){if(o!==1&&!this.multiplierOverrides)throw new Error("Multiplier overrides must be specified if an edge of 1% is not desirable");if(i.selectedNumbers.length===0)throw new Error("No numbers selected");if(i.selectedNumbers.length>10)throw new Error("Maximum of 10 numbers can be selected");for(let e of i.selectedNumbers){if(e%1!==0)throw new Error("Only integers can be selected");if(e<0||e>39)throw new Error("Invalid number selected")}let E=r.getUniqueRandomInts({min:0,max:39,count:10}),A=i.selectedNumbers.filter((e)=>E.values.includes(e));return{isFinished:!0,payoutMultiplier:A.length>0?new W(this.multipliers[i.selectedNumbers.length][i.riskLevel][A.length]??0):new W(0),outputs:{result:E.values},randomValues:E}}validateMultiplierOverrides(r){for(let[o,i]of Object.entries(r)){let E=Number(o);for(let[A,c]of Object.entries(i))if(c.length!==E+1)throw new Error(`Invalid count of multipliers for tiles ${E} and risk level ${A}. Expected ${E+1}, but got ${c.length}`)}}}import y from"big.js";var s=(r,o)=>{return r.gt(o)?r:o};var b=(r,o)=>{return r.lt(o)?r:o};class Ir extends O{constructor(){super("LIMBO")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:1,max:4294967295}),A=E.max,c=new y(16777216),e=new y(1),d=new y(1e6),R=E.value,B=new y(R-1).div(A),f=(100-o)/100,S=c.div(B.mul(c).plus(1)).mul(f),l=s(e,b(S,d));return{isFinished:!0,payoutMultiplier:l.gte(i.targetMultiplier)?new y(i.targetMultiplier):new y(0),outputs:{randomMultiplier:l,result:E.values},randomValues:E}}}import H from"big.js";var z=(r,o)=>{if(o<0||r<0||o>r)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(o>r-o)o=r-o;let i=1;for(let E=1;E<=o;E++)i=i*(r-E+1)/E;return i};class ur extends O{constructor(){super("MINES")}determineGameResult({generator:r,edge:o,gameInputs:i}){if(i.minesCount<=0||i.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(i.selectedTiles.length>25-i.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let e=r.getUniqueRandomInts({min:1,max:25,count:i.minesCount}),d=e.values.some((V)=>i.selectedTiles.includes(V)),R=i.hasCashedOut||d,B=(100-o)/100,f=new H(z(25-i.minesCount,i.selectedTiles.length)).div(new H(z(25,i.selectedTiles.length))),l=i.hasCashedOut&&!d?new H(B).div(f):new H(0);return{isFinished:R,payoutMultiplier:l,outputs:{result:e.values},randomValues:e}}}import{Big as Wr}from"big.js";var sr;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(sr||={});var br=[{rows:8,payout:{["LOW_RISK"]:[5.6,2.1,1.1,1,0.5,1,1.1,2.1,5.6],["MEDIUM_RISK"]:[13,3,1.3,0.7,0.4,0.7,1.3,3,13],["HIGH_RISK"]:[29,4,1.5,0.3,0.2,0.3,1.5,4,29]}},{rows:9,payout:{["LOW_RISK"]:[5.6,2,1.6,1,0.7,0.7,1,1.6,2,5.6],["MEDIUM_RISK"]:[18,4,1.7,0.9,0.5,0.5,0.9,1.7,4,18],["HIGH_RISK"]:[43,7,2,0.6,0.2,0.2,0.6,2,7,43]}},{rows:10,payout:{["LOW_RISK"]:[8.9,3,1.4,1.1,1,0.5,1,1.1,1.4,3,8.9],["MEDIUM_RISK"]:[22,5,2,1.4,0.6,0.4,0.6,1.4,2,5,22],["HIGH_RISK"]:[76,10,3,0.9,0.3,0.2,0.3,0.9,3,10,76]}},{rows:11,payout:{["LOW_RISK"]:[8.4,3,1.9,1.3,1,0.7,0.7,1,1.3,1.9,3,8.4],["MEDIUM_RISK"]:[24,6,3,1.8,0.7,0.5,0.5,0.7,1.8,3,6,24],["HIGH_RISK"]:[120,14,5.2,1.4,0.4,0.2,0.2,0.4,1.4,5.2,14,120]}},{rows:12,payout:{["LOW_RISK"]:[10,3,1.6,1.4,1.1,1,0.5,1,1.1,1.4,1.6,3,10],["MEDIUM_RISK"]:[33,11,4,2,1.1,0.6,0.3,0.6,1.1,2,4,11,33],["HIGH_RISK"]:[170,24,8.1,2,0.7,0.2,0.2,0.2,0.7,2,8.1,24,170]}},{rows:13,payout:{["LOW_RISK"]:[8.1,4,3,1.9,1.2,0.9,0.7,0.7,0.9,1.2,1.9,3,4,8.1],["MEDIUM_RISK"]:[43,13,6,3,1.3,0.7,0.4,0.4,0.7,1.3,3,6,13,43],["HIGH_RISK"]:[260,37,11,4,1,0.2,0.2,0.2,0.2,1,4,11,37,260]}},{rows:14,payout:{["LOW_RISK"]:[7.1,4,1.9,1.4,1.3,1.1,1,0.5,1,1.1,1.3,1.4,1.9,4,7.1],["MEDIUM_RISK"]:[58,15,7,4,1.9,1,0.5,0.2,0.5,1,1.9,4,7,15,58],["HIGH_RISK"]:[420,56,18,5,1.9,0.3,0.2,0.2,0.2,0.3,1.9,5,18,56,420]}},{rows:15,payout:{["LOW_RISK"]:[15,8,3,2,1.5,1.1,1,0.7,0.7,1,1.1,1.5,2,3,8,15],["MEDIUM_RISK"]:[88,18,11,5,3,1.3,0.5,0.3,0.3,0.5,1.3,3,5,11,18,88],["HIGH_RISK"]:[620,83,27,8,3,0.5,0.2,0.2,0.2,0.2,0.5,3,8,27,83,620]}},{rows:16,payout:{["LOW_RISK"]:[16,9,2,1.4,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,1.4,2,9,16],["MEDIUM_RISK"]:[110,41,10,5,3,1.5,1,0.5,0.3,0.5,1,1.5,3,5,10,41,110],["HIGH_RISK"]:[1000,130,26,9,4,2,0.2,0.2,0.2,0.2,0.2,2,4,9,26,130,1000]}}],mr=new p(new Map([[1,br]]));class gr extends O{constructor(){super("PLINKO")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(o.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(o.numberOfRows<8||o.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let E=mr.getMultipliers(i),A=r.getRandomIntsWithReplacement({min:0,max:1,count:o.numberOfRows}),e=A.values.reduce((R,B)=>R+B,0);return{isFinished:!0,payoutMultiplier:new Wr(E.find((R)=>R.rows===o.numberOfRows)?.payout[o.riskLevel][e]??0),outputs:{result:A.values},randomValues:A}}}import{Big as n}from"big.js";var J=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],m=[37,...J],g=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],rr=[[0,1],[0,3],[0,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],or=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],ir=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],Er=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],Ar=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],Q=[0,1,2,3,37],cr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],nr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],G;((i)=>{i.EVEN="EVEN";i.ODD="ODD"})(G||={});var C;((i)=>{i.RED="RED";i.BLACK="BLACK"})(C||={});var Z;((i)=>{i.LOW="LOW";i.HIGH="HIGH"})(Z||={});var K;((E)=>{E.TOP="TOP";E.MIDDLE="MIDDLE";E.BOTTOM="BOTTOM"})(K||={});var _;((E)=>{E.FIRST="FIRST";E.SECOND="SECOND";E.THIRD="THIRD"})(_||={});var X;((i)=>{i.AMERICAN="AMERICAN";i.EUROPEAN="EUROPEAN"})(X||={});var k=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw t.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&a(o.value)))throw t.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&ro(o.values)))throw t.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&oo(o.values)))throw t.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&io(o.values)))throw t.createValidationError("Invalid corner bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&Eo(o.values)))throw t.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(G).includes(o.parity)))throw t.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(C).includes(o.color)))throw t.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw t.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.column)))throw t.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.dozen)))throw t.createValidationError("Invalid dozen bet.")},a=(r)=>{return J.includes(r)},ro=(r)=>{if(r.length!==2)return!1;if(!r.every(a))return!1;return g.some(([o,i])=>o===r[0]&&i===r[1])},oo=(r)=>{if(r.length!==3)return!1;if(!r.every(a))return!1;return or.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},io=(r)=>{if(r.length!==4)return!1;if(!r.every(a))return!1;return Er.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},Eo=(r)=>{if(r.length!==6)return!1;if(!r.every(a))return!1;return cr.some(([o,i,E,A,c,e])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&e===r[5])};var P=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.basketBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw t.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&N(o.value)))throw t.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&Ao(o.values)))throw t.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&co(o.values)))throw t.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&no(o.values)))throw t.createValidationError("Invalid corner bet.");if(!r.basketBets.every((o)=>o.amount.gte(0)))throw t.createValidationError("Invalid basket bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&eo(o.values)))throw t.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(G).includes(o.parity)))throw t.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(C).includes(o.color)))throw t.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw t.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.column)))throw t.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.dozen)))throw t.createValidationError("Invalid dozen bet.")},N=(r)=>{return m.includes(r)};function Ao(r){if(r.length!==2)return!1;if(!r.every(N))return!1;return rr.some(([o,i])=>o===r[0]&&i===r[1])}var co=(r)=>{if(r.length!==3)return!1;if(!r.every(N))return!1;return ir.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},no=(r)=>{if(r.length!==4)return!1;if(!r.every(N))return!1;return Ar.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},eo=(r)=>{if(r.length!==6)return!1;if(!r.every(N))return!1;return nr.some(([o,i,E,A,c,e])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&e===r[5])};var er=(r)=>{return new n(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n(0)))},tr=(r)=>{return new n(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.basketBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n(0)))},Li=(r)=>{return r.type==="EUROPEAN"?er(r.inputs):tr(r.inputs)};class fr extends O{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){k(o);let i=r.getRandomInt({min:0,max:36}),E=i.value,A=this.determineBetOutcomes(o,E),c=er(o),e=this.calculateTotalPayoutAmount(A),d=c.gt(0)?e.div(c):new n(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:d,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0)))}}class Rr extends O{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){P(o);let i=r.getRandomInt({min:0,max:37}),E=i.value,A=this.determineBetOutcomes(o,E),c=tr(o),e=this.calculateTotalPayoutAmount(A),d=c.gt(0)?e.div(c):new n(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:d,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>Q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>!Q.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0||o===37)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n(0))).add(r.winningBets.basketBets.reduce((o,i)=>o.plus(i.amount.mul(7)),new n(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0)))}}class to extends O{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new fr,this.americanGame=new Rr}determineGameResult(r){let{gameInputs:o,...i}=r;if(r.edge===2.7&&o.type==="EUROPEAN"){let E=this.europeanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"european",betOutcomes:A,result:E.outputs.result}}}if(r.edge===5.3&&o.type==="AMERICAN"){let E=this.americanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"american",betOutcomes:A,result:E.outputs.result}}}throw new Error("Only European & American Roulette games are supported")}}var yi=(r)=>{if(r.type==="EUROPEAN")k(r.inputs);else P(r.inputs)};import{Big as Lo}from"big.js";var M;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(M||={});var w;((c)=>{c[c.TEN=10]="TEN";c[c.TWENTY=20]="TWENTY";c[c.THIRTY=30]="THIRTY";c[c.FORTY=40]="FORTY";c[c.FIFTY=50]="FIFTY"})(w||={});var fo={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}},Ro={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}},Oo={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}},Bo={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}},To={LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}},Or=new p(new Map([[1,fo],[2,Ro],[3,Oo],[4,Bo],[8,To]]));var dr={LOW_RISK:{10:["B","A","A","A","ZERO","A","A","A","A","ZERO"],20:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],30:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],40:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],50:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"]},MEDIUM_RISK:{10:["ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","D"],20:["A","ZERO","C","ZERO","B","ZERO","C","ZERO","C","ZERO","A","ZERO","C","ZERO","C","ZERO","D","ZERO","C","ZERO"],30:["A","ZERO","C","ZERO","A","ZERO","C","ZERO","D","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","E","ZERO","A","ZERO","C","ZERO"],40:["C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO"],50:["A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","A","ZERO","B","ZERO","A","ZERO"]},HIGH_RISK:{10:[...Array(9).fill("ZERO"),"A"],20:[...Array(19).fill("ZERO"),"A"],30:[...Array(29).fill("ZERO"),"A"],40:[...Array(39).fill("ZERO"),"A"],50:[...Array(49).fill("ZERO"),"A"]}};class So extends O{constructor(){super("WHEEL")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(!Object.values(w).includes(o.segments))throw new Error("Invalid segments value");if(!Object.values(M).includes(o.riskLevel))throw new Error("Invalid risk level");let A=Or.getMultipliers(i)[o.riskLevel];if(A===void 0)throw new Error(`No multipliers found for risk level ${o.riskLevel}`);let c=A[o.segments];if(c===void 0)throw new Error(`No multipliers found for segment ${o.segments}`);let e=dr[o.riskLevel];if(e===void 0)throw new Error(`No patterns found for risk level ${o.riskLevel}`);let d=e[o.segments];if(d===void 0)throw new Error(`No patterns found for segment ${o.segments}`);let R=r.getRandomInt({min:0,max:d.length-1}),B=d[R.value];if(B===void 0)throw new Error(`No pattern found for segment ${o.segments} and value ${R.value}`);let f=c[B];if(f===void 0)throw new Error(`No payout found for picked segment ${B}`);return{isFinished:!0,payoutMultiplier:new Lo(f),outputs:{result:R.values},randomValues:R}}}export{yi as validateRouletteGameInputs,_o as validateAdvancedDiceInputs,mr as plinkoMultipliers,Yr as diamondsMultipliers,Li as calculateRouletteBetAmount,wr as calculateBaccaratBetAmount,w as WheelSegments,M as WheelRiskLevel,So as Wheel,_r as VALID_SUITS,Dr as VALID_RANKS,or as VALID_EUROPEAN_STREETS,J as VALID_EUROPEAN_STRAIGHTS,g as VALID_EUROPEAN_SPLITS,cr as VALID_EUROPEAN_DOUBLE_STREETS,Er as VALID_EUROPEAN_CORNERS,ir as VALID_AMERICAN_STREETS,m as VALID_AMERICAN_STRAIGHTS,rr as VALID_AMERICAN_SPLITS,nr as VALID_AMERICAN_DOUBLE_STREETS,Ar as VALID_AMERICAN_CORNERS,X as RouletteType,to as Roulette,Zr as RollType,j as RANDOM_MIN_VALUE,$ as RANDOM_MAX_VALUE,sr as PlinkoRiskLevel,gr as Plinko,G as Parity,L as OrigamiGame,ur as Mines,Sr as MIN_WIN_CHANCE,xr as MAX_WIN_CHANCE,Ir as Limbo,Jr as KenoRiskLevel,Xr as Keno,Z as Half,Lr as GameErrorCode,t as GameError,O as Game,I as EFFECTIVE_RANGE,_ as Dozen,qr as DiceDirection,zr as Dice,hr as DiamondsResultType,$r as Diamonds,K as Column,C as Color,ar as BaccaratOutcome,Nr as BaccaratBetType,Vr as Baccarat,Kr as AdvancedDice,Q as AMERICAN_BASKET};
|
|
1
|
+
var x;((f)=>{f.DICE="DICE";f.MINES="MINES";f.KENO="KENO";f.LIMBO="LIMBO";f.ADVANCED_DICE="ADVANCED_DICE";f.BACCARAT="BACCARAT";f.DIAMONDS="DIAMONDS";f.PLINKO="PLINKO";f.ROULETTE="ROULETTE";f.WHEEL="WHEEL"})(x||={});class R{gameId;constructor(r){this.gameId=r}getGameResult(r){return this.determineGameResult(r)}}import{Big as k}from"big.js";var Gr;((o)=>o.INPUT_VALIDATION_ERROR="INPUT_VALIDATION_ERROR")(Gr||={});class e extends Error{static createValidationError(r){return new e("INPUT_VALIDATION_ERROR",r)}static isGameError(r){return r instanceof e}errorCode;constructor(r,o){super(o);this.errorCode=r}}var $=0,j=1e4,X=10001,Lr=0.01,yr=98,Cr=(r)=>{if(r<$)throw e.createValidationError(`Lower bound ${r} is below minimum allowed value ${$}`)},Kr=(r)=>{if(r>j)throw e.createValidationError(`Upper bound ${r} is above maximum allowed value ${j}`)},h=(r)=>{if(Cr(r.lower),Kr(r.upper),r.lower>=r.upper)throw e.createValidationError(`Lower bound ${r.lower} must be less than ${r.upper}`)},pr=(r,o)=>{let[i,E]=r.lower<=o.lower?[r,o]:[o,r];if(i.upper>E.lower)throw e.createValidationError("Bounds must not overlap")},Zr=(r,o)=>o>=r.lower&&o<=r.upper,_r=(r)=>r.upper-r.lower+1,F=(r,o)=>o>r.lower&&o<r.upper,Y=(r)=>r.upper-r.lower-1,Dr;((E)=>{E.ROLL_BETWEEN="ROLL_BETWEEN";E.ROLL_OUTSIDE="ROLL_OUTSIDE";E.ROLL_BETWEEN_TWO="ROLL_BETWEEN_TWO"})(Dr||={});var W=(r)=>{let i=(()=>{switch(r.mode){case"ROLL_BETWEEN":return h(r.bounds),Y(r.bounds);case"ROLL_OUTSIDE":return h(r.bounds),X-_r(r.bounds);case"ROLL_BETWEEN_TWO":return h(r.firstBounds),h(r.secondBounds),pr(r.firstBounds,r.secondBounds),Y(r.firstBounds)+Y(r.secondBounds)}})(),E=k(i).div(X).mul(100);if(E.lt(Lr))throw e.createValidationError("Win chance too low");if(E.gt(yr))throw e.createValidationError("Win chance too high");return E},Mo=(r)=>{W(r)};class Nr extends R{constructor(){super("ADVANCED_DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=W(i),A=r.getRandomInt({min:$,max:j}),c=A.value;return{isFinished:!0,payoutMultiplier:(()=>{switch(i.mode){case"ROLL_BETWEEN":return F(i.bounds,c);case"ROLL_OUTSIDE":return!Zr(i.bounds,c);case"ROLL_BETWEEN_TWO":return F(i.firstBounds,c)||F(i.secondBounds,c)}})()?new k(100-o).div(E):new k(0),outputs:{result:A.values},randomValues:A}}}import N from"big.js";var ar=["Clubs","Diamonds","Hearts","Spades"],lr=["Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"],Mr;((E)=>{E.PLAYER_WIN="PLAYER_WIN";E.TIE="TIE";E.BANKER_WIN="BANKER_WIN"})(Mr||={});var wr;((E)=>{E.PLAYER="PLAYER";E.TIE="TIE";E.BANKER="BANKER"})(wr||={});var Vr={["PLAYER_WIN"]:{betType:"PLAYER",multiplier:2},["TIE"]:{betType:"TIE",multiplier:8},["BANKER_WIN"]:{betType:"BANKER",multiplier:1.95}},Hr=(r)=>{return new N(0).add(r.bets.reduce((i,E)=>i.add(E.amount),new N(0)))};class hr extends R{constructor(){super("BACCARAT")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(i!==1)throw new Error("Baccarat is only available at 1% edge.");this.validateGameInputs(o);let E=r.getRandomIntsWithReplacement({min:0,max:51,count:6}),A=E.values,c=A.slice(0,3),t=A.slice(3,6),O=[],d=0;for(let T of c.slice(0,2)){let L=this.mapRandomValueToCard(T),H=this.mapRandomValueToCardValue(T);O.push(L),d=(d+H)%10}let B=[],f=0;for(let T of t.slice(0,2)){let L=this.mapRandomValueToCard(T),H=this.mapRandomValueToCardValue(T);B.push(L),f=(f+H)%10}if(!this.isNaturalWin(d,f)){let T=this.shouldDrawThirdPlayerCard(d),L=null;if(T)L=this.mapRandomValueToCardValue(c[2]),O.push(this.mapRandomValueToCard(c[2])),d=(d+L)%10;if(this.shouldDrawThirdBankerCard(f,L))B.push(this.mapRandomValueToCard(t[2])),f=(f+this.mapRandomValueToCardValue(t[2]))%10}let S;if(d===f)S="TIE";else S=d>f?"PLAYER_WIN":"BANKER_WIN";let G=Hr(o),{betType:V,multiplier:Tr}=Vr[S],xr=new N(0).add(o.bets.filter((T)=>T.type===V).reduce((T,L)=>T.add(L.amount.mul(Tr)),new N(0)));return{isFinished:!0,payoutMultiplier:G.gt(0)?xr.div(G):new N(0),outputs:{playerCards:O,playerHandValue:d,bankerCards:B,bankerHandValue:f,gameOutcome:S,result:E.values},randomValues:E}}validateGameInputs(r){if(r.bets.length===0)throw new Error("Must place at least a single bet.");if(!r.bets.every((o)=>o.amount.gte(0)))throw new Error("Invalid bet.")}mapRandomValueToCard(r){let o=ar[Math.floor(r/13)],i=lr[r%13];return{suit:o,rank:i}}isNaturalWin(r,o){let i=[8,9];return i.includes(r)||i.includes(o)}mapRandomValueToCardValue(r){let o=r%13;if(o===0)return 1;if(o>=10)return 10;return o+1}shouldDrawThirdPlayerCard(r){return r<=5}shouldDrawThirdBankerCard(r,o){if(o===null)return r<=5;if(r<=2)return!0;if(r===3)return o!==8;if(r===4)return[2,3,4,5,6,7].includes(o);if(r===5)return[4,5,6,7].includes(o);if(r===6)return[6,7].includes(o);return!1}}import vr from"big.js";class y{multipliers;constructor(r){this.multipliers=r}getMultipliers(r){let o=this.multipliers.get(r);if(o===void 0)throw new Error(`Multipliers for ${r} not found`);return o}getAllMultipliers(){return Array.from(this.multipliers.entries()).map(([r,o])=>({edge:r,multipliers:o}))}}var Ur;((t)=>{t.PAIR="PAIR";t.TWO_PAIR="TWO_PAIR";t.THREE_OF_A_KIND="THREE_OF_A_KIND";t.FULL_HOUSE="FULL_HOUSE";t.FOUR_OF_A_KIND="FOUR_OF_A_KIND";t.FIVE_OF_A_KIND="FIVE_OF_A_KIND"})(Ur||={});var Pr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4.3,FOUR_OF_A_KIND:5,FIVE_OF_A_KIND:50},Fr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:4,FOUR_OF_A_KIND:4.8,FIVE_OF_A_KIND:50},Yr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.7,FOUR_OF_A_KIND:4.6,FIVE_OF_A_KIND:50},kr={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:3,FULL_HOUSE:3.4,FOUR_OF_A_KIND:4.4,FIVE_OF_A_KIND:50},$r={PAIR:0.1,TWO_PAIR:2,THREE_OF_A_KIND:2.8,FULL_HOUSE:3.2,FOUR_OF_A_KIND:3.6,FIVE_OF_A_KIND:50},jr=new y(new Map([[1,Pr],[2,Fr],[3,Yr],[4,kr],[8,$r]])),qr={2:"PAIR",3:"THREE_OF_A_KIND",4:"FOUR_OF_A_KIND",5:"FIVE_OF_A_KIND"};class zr extends R{constructor(){super("DIAMONDS")}determineGameResult({generator:r,edge:o}){let i=r.getRandomIntsWithReplacement({min:0,max:6,count:5}),E=jr.getMultipliers(o),A=i.values,c=this.calculatePayoutMultiplier(E,A);return{isFinished:!0,payoutMultiplier:vr(c),outputs:{result:i.values},randomValues:i}}calculatePayoutMultiplier(r,o){let i=new Map;for(let c of o){let t=i.get(c)||0;i.set(c,t+1)}let E=[...i.values()].filter((c)=>c>1),A=this.classifyResult(E);return A===null?0:r[A]}classifyResult(r){if(r.length>2)throw new Error(`Unexpected number of repeats ${r.length}`);let[o,i]=r;if(o===void 0)return null;if(i===void 0){let E=qr[o];if(E===void 0)throw new Error(`Unexpected single diamond repeat count: ${o}`);return E}return o===3||i===3?"FULL_HOUSE":"TWO_PAIR"}}import q from"big.js";var Ir;((i)=>{i.ABOVE="ABOVE";i.BELOW="BELOW"})(Ir||={});class Jr extends R{constructor(){super("DICE")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:0,max:1e4}),A=E.min,O=E.max-A+1-1,d=i.direction==="ABOVE"?O-i.selectedValue:i.selectedValue,B=new q(d).div(O).mul(100);return{isFinished:!0,payoutMultiplier:(i.direction==="ABOVE"?E.value>i.selectedValue:E.value<i.selectedValue)?new q(100-o).div(B):new q(0),outputs:{result:E.values},randomValues:E}}}import u from"big.js";var Qr;((A)=>{A.CLASSIC="CLASSIC";A.LOW_RISK="LOW_RISK";A.MEDIUM_RISK="MEDIUM_RISK";A.HIGH_RISK="HIGH_RISK"})(Qr||={});var Xr={[1]:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]},[2]:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]},[3]:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]},[4]:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]},[5]:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]},[6]:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]},[7]:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]},[8]:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]},[9]:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]},[10]:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}};class Wr extends R{multiplierOverrides;get multipliers(){return this.multiplierOverrides??Xr}constructor(r){super("KENO");this.multiplierOverrides=r;if(r)this.validateMultiplierOverrides(r)}determineGameResult({generator:r,edge:o,gameInputs:i}){if(o!==1&&!this.multiplierOverrides)throw new Error("Multiplier overrides must be specified if an edge of 1% is not desirable");if(i.selectedNumbers.length===0)throw new Error("No numbers selected");if(i.selectedNumbers.length>10)throw new Error("Maximum of 10 numbers can be selected");for(let t of i.selectedNumbers){if(t%1!==0)throw new Error("Only integers can be selected");if(t<0||t>39)throw new Error("Invalid number selected")}let E=r.getUniqueRandomInts({min:0,max:39,count:10}),A=i.selectedNumbers.filter((t)=>E.values.includes(t));return{isFinished:!0,payoutMultiplier:A.length>0?new u(this.multipliers[i.selectedNumbers.length][i.riskLevel][A.length]??0):new u(0),outputs:{result:E.values},randomValues:E}}validateMultiplierOverrides(r){for(let[o,i]of Object.entries(r)){let E=Number(o);for(let[A,c]of Object.entries(i))if(c.length!==E+1)throw new Error(`Invalid count of multipliers for tiles ${E} and risk level ${A}. Expected ${E+1}, but got ${c.length}`)}}}import C from"big.js";var b=(r,o)=>{return r.gt(o)?r:o};var s=(r,o)=>{return r.lt(o)?r:o};class ur extends R{constructor(){super("LIMBO")}determineGameResult({generator:r,edge:o,gameInputs:i}){let E=r.getRandomInt({min:1,max:4294967295}),A=E.max,c=new C(16777216),t=new C(1),O=new C(1e6),d=E.value,B=new C(d-1).div(A),f=(100-o)/100,S=c.div(B.mul(c).plus(1)).mul(f),G=b(t,s(S,O));return{isFinished:!0,payoutMultiplier:G.gte(i.targetMultiplier)?new C(i.targetMultiplier):new C(0),outputs:{randomMultiplier:G,result:E.values},randomValues:E}}}import v from"big.js";var z=(r,o)=>{if(o<0||r<0||o>r)throw new Error("Invalid input: ensure 0 ≤ r ≤ n and n ≥ 0.");if(o>r-o)o=r-o;let i=1;for(let E=1;E<=o;E++)i=i*(r-E+1)/E;return i};class br extends R{constructor(){super("MINES")}determineGameResult({generator:r,edge:o,gameInputs:i}){if(i.minesCount<=0||i.minesCount>24)throw new Error("Must select between 1 and 24 mines.");if(i.selectedTiles.length>25-i.minesCount)throw new Error("Cannot select more tiles than available safe tiles (total tiles minus mines).");let t=r.getUniqueRandomInts({min:1,max:25,count:i.minesCount}),O=t.values.some((V)=>i.selectedTiles.includes(V)),d=i.hasCashedOut||O,B=(100-o)/100,f=new v(z(25-i.minesCount,i.selectedTiles.length)).div(new v(z(25,i.selectedTiles.length))),G=i.hasCashedOut&&!O?new v(B).div(f):new v(0);return{isFinished:d,payoutMultiplier:G,outputs:{result:t.values},randomValues:t}}}import{Big as io}from"big.js";var m;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(m||={});var ni=[8,9,10,11,12,13,14,15,16],sr={LOW_RISK:{8:[6,2.1,1.1,1,0.5,1,1.1,2.1,6],9:[6,2,1.6,1,0.7,0.7,1,1.6,2,6],10:[9,3,1.4,1.1,1,0.5,1,1.1,1.4,3,9],11:[8,3,1.9,1.3,1,0.7,0.7,1,1.3,1.9,3,8],12:[10,3,1.6,1.4,1.1,1,0.5,1,1.1,1.4,1.6,3,10],13:[8,4,3,1.9,1.2,0.9,0.7,0.7,0.9,1.2,1.9,3,4,8],14:[7,4,1.9,1.4,1.3,1.1,1,0.5,1,1.1,1.3,1.4,1.9,4,7],15:[15,8,3,2,1.5,1.1,1,0.7,0.7,1,1.1,1.5,2,3,8,15],16:[16,9,2,1.4,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,1.4,2,9,16]},MEDIUM_RISK:{8:[13,3,1.3,0.7,0.4,0.7,1.3,3,13],9:[18,4,1.7,0.9,0.5,0.5,0.9,1.7,4,18],10:[22,5,2,1.4,0.6,0.4,0.6,1.4,2,5,22],11:[24,6,3,1.8,0.7,0.5,0.5,0.7,1.8,3,6,24],12:[33,11,4,2,1.1,0.6,0.3,0.6,1.1,2,4,11,33],13:[43,13,6,3,1.3,0.7,0.4,0.4,0.7,1.3,3,6,13,43],14:[58,15,7,4,1.9,1,0.5,0.2,0.5,1,1.9,4,7,15,58],15:[88,18,11,5,3,1.3,0.5,0.3,0.3,0.5,1.3,3,5,11,18,88],16:[110,41.1,10,5,3,1.5,1,0.5,0.3,0.5,1,1.5,3,5,10,41.1,110]},HIGH_RISK:{8:[29,4,1.5,0.3,0.2,0.3,1.5,4,29],9:[43,7,2,0.6,0.2,0.2,0.6,2,7,43],10:[76,10,3,0.9,0.3,0.2,0.3,0.9,3,10,76],11:[120,13.9,5.2,1.4,0.4,0.2,0.2,0.4,1.4,5.2,13.9,120],12:[170,23.8,8.1,2,0.7,0.2,0.2,0.2,0.7,2,8.1,23.8,170],13:[260,36.7,11,4,1,0.2,0.2,0.2,0.2,1,4,11,36.7,260],14:[420,56.1,18,5,1.9,0.3,0.2,0.2,0.2,0.3,1.9,5,18,56.1,420],15:[620,82.8,27,8,3,0.5,0.2,0.2,0.2,0.2,0.5,3,8,27,82.8,620],16:[1000,129.9,26.1,9,4,2,0.2,0.2,0.2,0.2,0.2,2,4,9,26.1,129.9,1000]}},mr={LOW_RISK:{8:[6,1.9,1.1,1,0.5,1,1.1,1.9,6],9:[6,1.7,1.6,1,0.7,0.7,1,1.6,1.7,6],10:[9,2.5,1.4,1.1,1,0.5,1,1.1,1.4,2.5,9],11:[9,2.5,1.8,1.3,1,0.7,0.7,1,1.3,1.8,2.5,9],12:[10,3.2,1.6,1.3,1.1,1,0.5,1,1.1,1.3,1.6,3.2,10],13:[8,3.7,2.9,1.8,1.2,0.9,0.7,0.7,0.9,1.2,1.8,2.9,3.7,8],14:[7,4,1.8,1.2,1.3,1.1,1,0.5,1,1.1,1.3,1.2,1.8,4,7],15:[15,7.6,2.8,2,1.4,1.1,1,0.7,0.7,1,1.1,1.4,2,2.8,7.6,15],16:[16,9,1.7,1.2,1.3,1.2,1.1,1,0.5,1,1.1,1.2,1.3,1.2,1.7,9,16]},MEDIUM_RISK:{8:[13,3.2,1.4,0.6,0.4,0.6,1.4,3.2,13],9:[18,3.7,1.7,0.9,0.5,0.5,0.9,1.7,3.7,18],10:[22,5,1.9,1.4,0.6,0.4,0.6,1.4,1.9,5,22],11:[24,6,2.8,1.8,0.7,0.5,0.5,0.7,1.8,2.8,6,24],12:[33,11.1,4,1.9,1.1,0.6,0.3,0.6,1.1,1.9,4,11.1,33],13:[43,13.7,6.1,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,6.1,13.7,43],14:[58,13.7,6.7,3.9,1.9,1,0.5,0.2,0.5,1,1.9,3.9,6.7,13.7,58],15:[88,17.7,10.8,5,2.9,1.3,0.5,0.3,0.3,0.5,1.3,2.9,5,10.8,17.7,88],16:[110,40.5,9.8,4.8,2.9,1.5,1,0.5,0.3,0.5,1,1.5,2.9,4.8,9.8,40.5,110]},HIGH_RISK:{8:[29,3.8,1.5,0.3,0.2,0.3,1.5,3.8,29],9:[43,7.1,1.9,0.6,0.2,0.2,0.6,1.9,7.1,43],10:[76,9.9,2.9,0.9,0.3,0.2,0.3,0.9,2.9,9.9,76],11:[120,13.4,5.1,1.4,0.4,0.2,0.2,0.4,1.4,5.1,13.4,120],12:[170,23.2,7.9,2,0.7,0.2,0.2,0.2,0.7,2,7.9,23.2,170],13:[260,36.6,10.5,4,1,0.2,0.2,0.2,0.2,1,4,10.5,36.6,260],14:[420,55.5,17.6,4.9,1.9,0.3,0.2,0.2,0.2,0.3,1.9,4.9,17.6,55.5,420],15:[620,82.3,26.8,7.7,3,0.5,0.2,0.2,0.2,0.2,0.5,3,7.7,26.8,82.3,620],16:[1000,129.8,25.2,8.6,4,2,0.2,0.2,0.2,0.2,0.2,2,4,8.6,25.2,129.8,1000]}},gr={LOW_RISK:{8:[6,2.2,1.1,1,0.4,1,1.1,2.2,6],9:[6,1.8,1.5,1,0.7,0.7,1,1.5,1.8,6],10:[9,2.4,1.3,1.1,1,0.5,1,1.1,1.3,2.4,9],11:[8,2.7,1.9,1.2,1,0.7,0.7,1,1.2,1.9,2.7,8],12:[10,3.3,1.6,1.2,1.1,1,0.5,1,1.1,1.2,1.6,3.3,10],13:[8,3.8,2.9,1.9,1.1,0.9,0.7,0.7,0.9,1.1,1.9,2.9,3.8,8],14:[7,3.9,2,1.4,1.3,1.1,1,0.4,1,1.1,1.3,1.4,2,3.9,7],15:[15,7.9,2.5,2,1.3,1.1,1,0.7,0.7,1,1.1,1.3,2,2.5,7.9,15],16:[16,8.9,1.9,1.4,1.4,1.2,1.1,1,0.4,1,1.1,1.2,1.4,1.4,1.9,8.9,16]},MEDIUM_RISK:{8:[13,3.5,1.2,0.7,0.3,0.7,1.2,3.5,13],9:[18,3.8,1.6,0.9,0.5,0.5,0.9,1.6,3.8,18],10:[22,5.2,2,1.3,0.6,0.4,0.6,1.3,2,5.2,22],11:[24,5.6,2.7,1.8,0.7,0.5,0.5,0.7,1.8,2.7,5.6,24],12:[33,11.3,4,1.8,1.1,0.6,0.3,0.6,1.1,1.8,4,11.3,33],13:[43,12.9,5.7,2.8,1.3,0.7,0.4,0.4,0.7,1.3,2.8,5.7,12.9,43],14:[58,13.7,6.9,3.9,1.8,1,0.5,0.2,0.5,1,1.8,3.9,6.9,13.7,58],15:[88,18,10.9,4.9,2.8,1.3,0.5,0.3,0.3,0.5,1.3,2.8,4.9,10.9,18,88],16:[110,39.9,9.9,5,2.9,1.4,1,0.5,0.3,0.5,1,1.4,2.9,5,9.9,39.9,110]},HIGH_RISK:{8:[29,4,1.4,0.3,0.2,0.3,1.4,4,29],9:[43,7.3,2,0.5,0.2,0.2,0.5,2,7.3,43],10:[76,9.8,2.8,0.9,0.3,0.2,0.3,0.9,2.8,9.8,76],11:[120,13.5,4.9,1.4,0.4,0.2,0.2,0.4,1.4,4.9,13.5,120],12:[170,23.3,7.9,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.9,23.3,170],13:[260,36.2,10.4,3.9,1,0.2,0.2,0.2,0.2,1,3.9,10.4,36.2,260],14:[420,54.8,17.9,4.9,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.9,17.9,54.8,420],15:[620,81.9,26.6,7.7,2.9,0.5,0.2,0.2,0.2,0.2,0.5,2.9,7.7,26.6,81.9,620],16:[1000,130,24.9,8.4,3.9,2,0.2,0.2,0.2,0.2,0.2,2,3.9,8.4,24.9,130,1000]}},ro={LOW_RISK:{8:[6,2,1.1,1,0.4,1,1.1,2,6],9:[6,1.9,1.4,1,0.7,0.7,1,1.4,1.9,6],10:[9,2.8,1.1,1.1,1,0.5,1,1.1,1.1,2.8,9],11:[8,2.7,1.7,1.2,1,0.7,0.7,1,1.2,1.7,2.7,8],12:[10,2.7,1.4,1.2,1.1,1,0.5,1,1.1,1.2,1.4,2.7,10],13:[8,3.5,2.8,1.9,1.3,0.9,0.6,0.6,0.9,1.3,1.9,2.8,3.5,8],14:[7,3.3,1.6,1.3,1.3,1.1,1,0.4,1,1.1,1.3,1.3,1.6,3.3,7],15:[15,8,2.9,2,1.4,1.2,1,0.6,0.6,1,1.2,1.4,2,2.9,8,15],16:[16,9.1,2.2,1.4,1.2,1.2,1.1,1,0.4,1,1.1,1.2,1.2,1.4,2.2,9.1,16]},MEDIUM_RISK:{8:[13,2.9,1.2,0.7,0.4,0.7,1.2,2.9,13],9:[18,3.5,1.6,0.9,0.5,0.5,0.9,1.6,3.5,18],10:[22,4.7,2,1.3,0.6,0.4,0.6,1.3,2,4.7,22],11:[24,5.7,2.5,1.8,0.7,0.5,0.5,0.7,1.8,2.5,5.7,24],12:[33,10.7,3.8,1.8,1.1,0.6,0.3,0.6,1.1,1.8,3.8,10.7,33],13:[43,12.6,5.6,2.7,1.3,0.7,0.4,0.4,0.7,1.3,2.7,5.6,12.6,43],14:[58,13.7,6.4,3.8,1.8,1,0.5,0.2,0.5,1,1.8,3.8,6.4,13.7,58],15:[88,17.7,10.7,4.9,2.7,1.3,0.5,0.3,0.3,0.5,1.3,2.7,4.9,10.7,17.7,88],16:[110,39.7,9.6,4.8,2.8,1.4,1,0.5,0.3,0.5,1,1.4,2.8,4.8,9.6,39.7,110]},HIGH_RISK:{8:[29,3.9,1.4,0.3,0.2,0.3,1.4,3.9,29],9:[43,6.9,1.8,0.6,0.2,0.2,0.6,1.8,6.9,43],10:[76,9.8,2.7,0.9,0.3,0.2,0.3,0.9,2.7,9.8,76],11:[120,13.1,5.1,1.3,0.4,0.2,0.2,0.4,1.3,5.1,13.1,120],12:[170,22.7,7.7,1.9,0.7,0.2,0.2,0.2,0.7,1.9,7.7,22.7,170],13:[260,35.9,10.3,3.8,1,0.2,0.2,0.2,0.2,1,3.8,10.3,35.9,260],14:[420,54.2,17.5,4.8,1.8,0.3,0.2,0.2,0.2,0.3,1.8,4.8,17.5,54.2,420],15:[620,80.6,26.1,7.8,2.8,0.5,0.2,0.2,0.2,0.2,0.5,2.8,7.8,26.1,80.6,620],16:[1000,129.7,24.7,8.2,3.8,2,0.2,0.2,0.2,0.2,0.2,2,3.8,8.2,24.7,129.7,1000]}},oo={LOW_RISK:{8:[5,1.8,1,1,0.4,1,1,1.8,5],9:[5,1.7,1.2,1,0.7,0.7,1,1.2,1.7,5],10:[9,2.8,1.2,1,1,0.4,1,1,1.2,2.8,9],11:[8,2.5,1.6,1,1,0.7,0.7,1,1,1.6,2.5,8],12:[10,2.5,1.3,1.3,1,1,0.4,1,1,1.3,1.3,2.5,10],13:[8,4.1,2.8,1.8,1.1,0.9,0.6,0.6,0.9,1.1,1.8,2.8,4.1,8],14:[7,3.3,1.7,1.2,1.2,1,1,0.4,1,1,1.2,1.2,1.7,3.3,7],15:[15,7.3,2.9,1.9,1.4,1,1,0.6,0.6,1,1,1.4,1.9,2.9,7.3,15],16:[16,8.7,2,1.5,1.3,1,1.1,1,0.3,1,1.1,1,1.3,1.5,2,8.7,16]},MEDIUM_RISK:{8:[13,2.6,1.1,0.7,0.4,0.7,1.1,2.6,13],9:[17,3.3,1.4,0.9,0.5,0.5,0.9,1.4,3.3,17],10:[21,4.1,1.7,1.3,0.6,0.4,0.6,1.3,1.7,4.1,21],11:[23,5.6,2.4,1.6,0.7,0.5,0.5,0.7,1.6,2.4,5.6,23],12:[32,10.2,3.7,1.7,1.1,0.6,0.2,0.6,1.1,1.7,3.7,10.2,32],13:[42,11.7,5.3,2.5,1.2,0.7,0.4,0.4,0.7,1.2,2.5,5.3,11.7,42],14:[56,13.2,5.9,3.6,1.6,1,0.5,0.2,0.5,1,1.6,3.6,5.9,13.2,56],15:[86,17.3,10,4.6,2.6,1.2,0.5,0.3,0.3,0.5,1.2,2.6,4.6,10,17.3,86],16:[107,39,9.9,4.5,2.4,1.3,1,0.5,0.3,0.5,1,1.3,2.4,4.5,9.9,39,107]},HIGH_RISK:{8:[28,3.3,1.4,0.3,0.2,0.3,1.4,3.3,28],9:[42,6.7,1.6,0.6,0.2,0.2,0.6,1.6,6.7,42],10:[74,9.6,2.6,0.9,0.3,0.1,0.3,0.9,2.6,9.6,74],11:[116,12.7,4.8,1.2,0.4,0.2,0.2,0.4,1.2,4.8,12.7,116],12:[165,20.9,7.2,1.8,0.7,0.2,0.2,0.2,0.7,1.8,7.2,20.9,165],13:[252,33.9,10.1,3.4,1,0.2,0.2,0.2,0.2,1,3.4,10.1,33.9,252],14:[407,51.9,16.3,4.6,1.7,0.3,0.2,0.2,0.2,0.3,1.7,4.6,16.3,51.9,407],15:[600,76.9,24.9,7.4,2.6,0.5,0.2,0.2,0.2,0.2,0.5,2.6,7.4,24.9,76.9,600],16:[1000,122,24.5,8,3.7,1.8,0.2,0.2,0.2,0.2,0.2,1.8,3.7,8,24.5,122,1000]}},g=new y(new Map([[1,sr],[2,mr],[3,gr],[4,ro],[8,oo]]));class Eo extends R{constructor(){super("PLINKO")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(o.numberOfRows%1>0)throw new Error("Number of rows must be an integer");if(o.numberOfRows<8||o.numberOfRows>16)throw new Error("Number of rows must be between 8 and 16");let E=o.numberOfRows,t=g.getMultipliers(i)[o.riskLevel][E],O=r.getRandomIntsWithReplacement({min:0,max:1,count:o.numberOfRows}),B=O.values.reduce((S,G)=>S+G,0),f=t[B];if(f===void 0)throw new Error(`No payout found for end position ${B}`);return{isFinished:!0,payoutMultiplier:io(f),outputs:{result:O.values},randomValues:O}}}import{Big as n}from"big.js";var I=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],rr=[37,...I],or=[[0,1],[0,2],[0,3],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],ir=[[0,1],[0,3],[0,37],[1,2],[1,4],[2,3],[2,5],[3,6],[4,5],[4,7],[5,6],[5,8],[6,9],[7,8],[7,10],[8,9],[8,11],[9,12],[10,11],[10,13],[11,12],[11,14],[12,15],[13,14],[13,16],[14,15],[14,17],[15,18],[16,17],[16,19],[17,18],[17,20],[18,21],[19,20],[19,22],[20,21],[20,23],[21,24],[22,23],[22,25],[23,24],[23,26],[24,27],[25,26],[25,28],[26,27],[26,29],[27,30],[28,29],[28,31],[29,30],[29,32],[30,33],[31,32],[31,34],[32,33],[32,35],[33,36],[34,35],[35,36]],Er=[[0,1,2],[0,2,3],[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],Ar=[[0,1,2],[0,2,37],[1,2,3],[2,3,37],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18],[19,20,21],[22,23,24],[25,26,27],[28,29,30],[31,32,33],[34,35,36]],cr=[[0,1,2,3],[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],nr=[[1,2,4,5],[2,3,5,6],[4,5,7,8],[5,6,8,9],[7,8,10,11],[8,9,11,12],[10,11,13,14],[11,12,14,15],[13,14,16,17],[14,15,17,18],[16,17,19,20],[17,18,20,21],[19,20,22,23],[20,21,23,24],[22,23,25,26],[23,24,26,27],[25,26,28,29],[26,27,29,30],[28,29,31,32],[29,30,32,33],[31,32,34,35],[32,33,35,36]],J=[0,1,2,3,37],tr=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],er=[[1,2,3,4,5,6],[4,5,6,7,8,9],[7,8,9,10,11,12],[10,11,12,13,14,15],[13,14,15,16,17,18],[16,17,18,19,20,21],[19,20,21,22,23,24],[22,23,24,25,26,27],[25,26,27,28,29,30],[28,29,30,31,32,33],[31,32,33,34,35,36]],K;((i)=>{i.EVEN="EVEN";i.ODD="ODD"})(K||={});var p;((i)=>{i.RED="RED";i.BLACK="BLACK"})(p||={});var Z;((i)=>{i.LOW="LOW";i.HIGH="HIGH"})(Z||={});var _;((E)=>{E.TOP="TOP";E.MIDDLE="MIDDLE";E.BOTTOM="BOTTOM"})(_||={});var D;((E)=>{E.FIRST="FIRST";E.SECOND="SECOND";E.THIRD="THIRD"})(D||={});var Q;((i)=>{i.AMERICAN="AMERICAN";i.EUROPEAN="EUROPEAN"})(Q||={});var U=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw e.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&a(o.value)))throw e.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&Ao(o.values)))throw e.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&co(o.values)))throw e.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&no(o.values)))throw e.createValidationError("Invalid corner bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&to(o.values)))throw e.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.parity)))throw e.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(p).includes(o.color)))throw e.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw e.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.column)))throw e.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(D).includes(o.dozen)))throw e.createValidationError("Invalid dozen bet.")},a=(r)=>{return I.includes(r)},Ao=(r)=>{if(r.length!==2)return!1;if(!r.every(a))return!1;return or.some(([o,i])=>o===r[0]&&i===r[1])},co=(r)=>{if(r.length!==3)return!1;if(!r.every(a))return!1;return Er.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},no=(r)=>{if(r.length!==4)return!1;if(!r.every(a))return!1;return cr.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},to=(r)=>{if(r.length!==6)return!1;if(!r.every(a))return!1;return tr.some(([o,i,E,A,c,t])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&t===r[5])};var P=(r)=>{if(r.straightBets.length===0&&r.splitBets.length===0&&r.streetBets.length===0&&r.cornerBets.length===0&&r.basketBets.length===0&&r.doubleStreetBets.length===0&&r.parityBets.length===0&&r.colorBets.length===0&&r.halfBets.length===0&&r.columnBets.length===0&&r.dozenBets.length===0)throw e.createValidationError("Must place at least a single bet.");if(!r.straightBets.every((o)=>o.amount.gte(0)&&l(o.value)))throw e.createValidationError("Invalid straight bet.");if(!r.splitBets.every((o)=>o.amount.gte(0)&&eo(o.values)))throw e.createValidationError("Invalid split bet.");if(!r.streetBets.every((o)=>o.amount.gte(0)&&fo(o.values)))throw e.createValidationError("Invalid street bet.");if(!r.cornerBets.every((o)=>o.amount.gte(0)&&Oo(o.values)))throw e.createValidationError("Invalid corner bet.");if(!r.basketBets.every((o)=>o.amount.gte(0)))throw e.createValidationError("Invalid basket bet.");if(!r.doubleStreetBets.every((o)=>o.amount.gte(0)&&Ro(o.values)))throw e.createValidationError("Invalid double street bet.");if(!r.parityBets.every((o)=>o.amount.gte(0)&&Object.values(K).includes(o.parity)))throw e.createValidationError("Invalid parity bet.");if(!r.colorBets.every((o)=>o.amount.gte(0)&&Object.values(p).includes(o.color)))throw e.createValidationError("Invalid color bet.");if(!r.halfBets.every((o)=>o.amount.gte(0)&&Object.values(Z).includes(o.half)))throw e.createValidationError("Invalid half bet.");if(!r.columnBets.every((o)=>o.amount.gte(0)&&Object.values(_).includes(o.column)))throw e.createValidationError("Invalid column bet.");if(!r.dozenBets.every((o)=>o.amount.gte(0)&&Object.values(D).includes(o.dozen)))throw e.createValidationError("Invalid dozen bet.")},l=(r)=>{return rr.includes(r)};function eo(r){if(r.length!==2)return!1;if(!r.every(l))return!1;return ir.some(([o,i])=>o===r[0]&&i===r[1])}var fo=(r)=>{if(r.length!==3)return!1;if(!r.every(l))return!1;return Ar.some(([o,i,E])=>o===r[0]&&i===r[1]&&E===r[2])},Oo=(r)=>{if(r.length!==4)return!1;if(!r.every(l))return!1;return nr.some(([o,i,E,A])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3])},Ro=(r)=>{if(r.length!==6)return!1;if(!r.every(l))return!1;return er.some(([o,i,E,A,c,t])=>o===r[0]&&i===r[1]&&E===r[2]&&A===r[3]&&c===r[4]&&t===r[5])};var fr=(r)=>{return new n(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n(0)))},Or=(r)=>{return new n(0).add(r.straightBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.splitBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.streetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.cornerBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.basketBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.doubleStreetBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.parityBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.colorBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.halfBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.columnBets.reduce((o,i)=>o.plus(i.amount),new n(0))).add(r.dozenBets.reduce((o,i)=>o.plus(i.amount),new n(0)))},li=(r)=>{return r.type==="EUROPEAN"?fr(r.inputs):Or(r.inputs)};class Rr extends R{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){U(o);let i=r.getRandomInt({min:0,max:36}),E=i.value,A=this.determineBetOutcomes(o,E),c=fr(o),t=this.calculateTotalPayoutAmount(A),O=c.gt(0)?t.div(c):new n(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:O,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0)))}}class dr extends R{constructor(){super("ROULETTE")}determineGameResult({generator:r,gameInputs:o}){P(o);let i=r.getRandomInt({min:0,max:37}),E=i.value,A=this.determineBetOutcomes(o,E),c=Or(o),t=this.calculateTotalPayoutAmount(A),O=c.gt(0)?t.div(c):new n(0);return{outputs:{betOutcomes:A,result:i.values},payoutMultiplier:O,isFinished:!0,randomValues:i}}determineBetOutcomes(r,o){return{winningBets:{straightBets:r.straightBets.filter((i)=>i.value===o),splitBets:r.splitBets.filter((i)=>i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>J.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>this.isWinningDozenBet(i,o))},losingBets:{straightBets:r.straightBets.filter((i)=>i.value!==o),splitBets:r.splitBets.filter((i)=>!i.values.some((E)=>E===o)),streetBets:r.streetBets.filter((i)=>!i.values.some((E)=>E===o)),cornerBets:r.cornerBets.filter((i)=>!i.values.some((E)=>E===o)),basketBets:r.basketBets.filter((i)=>!J.some((E)=>E===o)),doubleStreetBets:r.doubleStreetBets.filter((i)=>!i.values.some((E)=>E===o)),parityBets:r.parityBets.filter((i)=>!this.isWinningParityBet(i,o)),colorBets:r.colorBets.filter((i)=>!this.isWinningColorBet(i,o)),halfBets:r.halfBets.filter((i)=>!this.isWinningHalfBet(i,o)),columnBets:r.columnBets.filter((i)=>!this.isWinningColumnBet(i,o)),dozenBets:r.dozenBets.filter((i)=>!this.isWinningDozenBet(i,o))}}}isWinningParityBet(r,o){if(o===0||o===37)return!1;let i=o%2===0?"EVEN":"ODD";return r.parity===i}isWinningColorBet(r,o){let i=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],E=[2,4,6,8,10,11,13,15,17,20,22,24,26,28,29,31,33,35];if(i.includes(o)&&r.color==="RED")return!0;if(E.includes(o)&&r.color==="BLACK")return!0;return!1}isWinningHalfBet(r,o){if(o>0&&o<=18&&r.half==="LOW")return!0;if(o>18&&o<=36&&r.half==="HIGH")return!0;return!1}isWinningColumnBet(r,o){let i=[3,6,9,12,15,18,21,24,27,30,33,36],E=[2,5,8,11,14,17,20,23,26,29,32,35],A=[1,4,7,10,13,16,19,22,25,28,31,34];if(i.includes(o)&&r.column==="TOP")return!0;if(E.includes(o)&&r.column==="MIDDLE")return!0;if(A.includes(o)&&r.column==="BOTTOM")return!0;return!1}isWinningDozenBet(r,o){if(o>0&&o<=12&&r.dozen==="FIRST")return!0;if(o>12&&o<=24&&r.dozen==="SECOND")return!0;if(o>24&&o<=36&&r.dozen==="THIRD")return!0;return!1}calculateTotalPayoutAmount(r){return new n(0).add(r.winningBets.straightBets.reduce((o,i)=>o.plus(i.amount.mul(36)),new n(0))).add(r.winningBets.splitBets.reduce((o,i)=>o.plus(i.amount.mul(18)),new n(0))).add(r.winningBets.streetBets.reduce((o,i)=>o.plus(i.amount.mul(12)),new n(0))).add(r.winningBets.cornerBets.reduce((o,i)=>o.plus(i.amount.mul(9)),new n(0))).add(r.winningBets.basketBets.reduce((o,i)=>o.plus(i.amount.mul(7)),new n(0))).add(r.winningBets.doubleStreetBets.reduce((o,i)=>o.plus(i.amount.mul(6)),new n(0))).add(r.winningBets.parityBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.colorBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.halfBets.reduce((o,i)=>o.plus(i.amount.mul(2)),new n(0))).add(r.winningBets.columnBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0))).add(r.winningBets.dozenBets.reduce((o,i)=>o.plus(i.amount.mul(3)),new n(0)))}}class Bo extends R{europeanGame;americanGame;constructor(){super("ROULETTE");this.europeanGame=new Rr,this.americanGame=new dr}determineGameResult(r){let{gameInputs:o,...i}=r;if(r.edge===2.7&&o.type==="EUROPEAN"){let E=this.europeanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"european",betOutcomes:A,result:E.outputs.result}}}if(r.edge===5.3&&o.type==="AMERICAN"){let E=this.americanGame.determineGameResult({...i,gameInputs:o.inputs}),{betOutcomes:A}=E.outputs;return{...E,outputs:{type:"american",betOutcomes:A,result:E.outputs.result}}}throw new Error("Only European & American Roulette games are supported")}}var hi=(r)=>{if(r.type==="EUROPEAN")U(r.inputs);else P(r.inputs)};import{Big as yo}from"big.js";var M;((E)=>{E.LOW_RISK="LOW_RISK";E.MEDIUM_RISK="MEDIUM_RISK";E.HIGH_RISK="HIGH_RISK"})(M||={});var w;((c)=>{c[c.TEN=10]="TEN";c[c.TWENTY=20]="TWENTY";c[c.THIRTY=30]="THIRTY";c[c.FORTY=40]="FORTY";c[c.FIFTY=50]="FIFTY"})(w||={});var So={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.5},20:{ZERO:0,A:1.2,B:1.5},30:{ZERO:0,A:1.2,B:1.5},40:{ZERO:0,A:1.2,B:1.5},50:{ZERO:0,A:1.2,B:1.5}},MEDIUM_RISK:{10:{ZERO:0,A:1.5,B:1.9,C:2,D:3},20:{ZERO:0,A:1.5,B:1.8,C:2,D:3},30:{ZERO:0,A:1.5,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:3},50:{ZERO:0,A:1.5,B:2,C:3,D:5}},HIGH_RISK:{10:{ZERO:0,A:9.9},20:{ZERO:0,A:19.8},30:{ZERO:0,A:29.7},40:{ZERO:0,A:39.6},50:{ZERO:0,A:49.5}}},To={LOW_RISK:{10:{ZERO:0,A:1.2,B:1.4},20:{ZERO:0,A:1.2,B:1.4},30:{ZERO:0,A:1.2,B:1.4},40:{ZERO:0,A:1.2,B:1.4},50:{ZERO:0,A:1.2,B:1.4}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3.1},20:{ZERO:0,A:1.5,B:1.8,C:1.9,D:3.4},30:{ZERO:0,A:1.5,B:1.7,C:1.9,D:3,E:4.3},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.9},50:{ZERO:0,A:1.5,B:2,C:3,D:4.5}},HIGH_RISK:{10:{ZERO:0,A:9.8},20:{ZERO:0,A:19.6},30:{ZERO:0,A:29.4},40:{ZERO:0,A:39.2},50:{ZERO:0,A:49}}},xo={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.65},20:{ZERO:0,A:1.15,B:1.65},30:{ZERO:0,A:1.15,B:1.65},40:{ZERO:0,A:1.15,B:1.65},50:{ZERO:0,A:1.15,B:1.65}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.9,C:2,D:3},20:{ZERO:0,A:1.4,B:1.6,C:2,D:3},30:{ZERO:0,A:1.4,B:1.7,C:2,D:3,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.8},50:{ZERO:0,A:1.5,B:2,C:2.7,D:4.9}},HIGH_RISK:{10:{ZERO:0,A:9.7},20:{ZERO:0,A:19.4},30:{ZERO:0,A:29.1},40:{ZERO:0,A:38.8},50:{ZERO:0,A:48.5}}},Go={LOW_RISK:{10:{ZERO:0,A:1.15,B:1.55},20:{ZERO:0,A:1.15,B:1.55},30:{ZERO:0,A:1.15,B:1.55},40:{ZERO:0,A:1.15,B:1.55},50:{ZERO:0,A:1.15,B:1.55}},MEDIUM_RISK:{10:{ZERO:0,A:1.4,B:1.8,C:2,D:3},20:{ZERO:0,A:1.3,B:1.5,C:2,D:3},30:{ZERO:0,A:1.4,B:1.6,C:2,D:2.9,E:4},40:{ZERO:0,A:1.5,B:1.6,C:2,D:2.7},50:{ZERO:0,A:1.5,B:2,C:2.6,D:4.8}},HIGH_RISK:{10:{ZERO:0,A:9.6},20:{ZERO:0,A:19.2},30:{ZERO:0,A:28.8},40:{ZERO:0,A:38.4},50:{ZERO:0,A:48}}},Lo={LOW_RISK:{10:{ZERO:0,A:1.1,B:1.5},20:{ZERO:0,A:1.1,B:1.5},30:{ZERO:0,A:1.1,B:1.45},40:{ZERO:0,A:1.1,B:1.45},50:{ZERO:0,A:1.1,B:1.45}},MEDIUM_RISK:{10:{ZERO:0,A:1.3,B:1.7,C:1.9,D:3},20:{ZERO:0,A:1.3,B:1.4,C:1.9,D:3},30:{ZERO:0,A:1.3,B:1.7,C:1.9,D:2.8,E:3.8},40:{ZERO:0,A:1.4,B:1.8,C:1.9,D:2.6},50:{ZERO:0,A:1.4,B:1.9,C:2.6,D:4.6}},HIGH_RISK:{10:{ZERO:0,A:9.2},20:{ZERO:0,A:18.4},30:{ZERO:0,A:27.6},40:{ZERO:0,A:36.8},50:{ZERO:0,A:46}}},Br=new y(new Map([[1,So],[2,To],[3,xo],[4,Go],[8,Lo]]));var Sr={LOW_RISK:{10:["B","A","A","A","ZERO","A","A","A","A","ZERO"],20:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],30:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],40:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"],50:["B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO","B","A","A","A","ZERO","A","A","A","A","ZERO"]},MEDIUM_RISK:{10:["ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","D"],20:["A","ZERO","C","ZERO","B","ZERO","C","ZERO","C","ZERO","A","ZERO","C","ZERO","C","ZERO","D","ZERO","C","ZERO"],30:["A","ZERO","C","ZERO","A","ZERO","C","ZERO","D","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","C","ZERO","E","ZERO","A","ZERO","C","ZERO"],40:["C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO","C","ZERO","A","ZERO","D","ZERO","C","ZERO","A","ZERO"],50:["A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","C","ZERO","A","ZERO","B","ZERO","A","ZERO","B","ZERO","A","ZERO","D","ZERO","A","ZERO","B","ZERO","A","ZERO"]},HIGH_RISK:{10:[...Array(9).fill("ZERO"),"A"],20:[...Array(19).fill("ZERO"),"A"],30:[...Array(29).fill("ZERO"),"A"],40:[...Array(39).fill("ZERO"),"A"],50:[...Array(49).fill("ZERO"),"A"]}};class Co extends R{constructor(){super("WHEEL")}determineGameResult({generator:r,gameInputs:o,edge:i}){if(!Object.values(w).includes(o.segments))throw new Error("Invalid segments value");if(!Object.values(M).includes(o.riskLevel))throw new Error("Invalid risk level");let A=Br.getMultipliers(i)[o.riskLevel];if(A===void 0)throw new Error(`No multipliers found for risk level ${o.riskLevel}`);let c=A[o.segments];if(c===void 0)throw new Error(`No multipliers found for segment ${o.segments}`);let t=Sr[o.riskLevel];if(t===void 0)throw new Error(`No patterns found for risk level ${o.riskLevel}`);let O=t[o.segments];if(O===void 0)throw new Error(`No patterns found for segment ${o.segments}`);let d=r.getRandomInt({min:0,max:O.length-1}),B=O[d.value];if(B===void 0)throw new Error(`No pattern found for segment ${o.segments} and value ${d.value}`);let f=c[B];if(f===void 0)throw new Error(`No payout found for picked segment ${B}`);return{isFinished:!0,payoutMultiplier:new yo(f),outputs:{result:d.values},randomValues:d}}}export{hi as validateRouletteGameInputs,Mo as validateAdvancedDiceInputs,g as plinkoMultipliers,jr as diamondsMultipliers,li as calculateRouletteBetAmount,Hr as calculateBaccaratBetAmount,w as WheelSegments,M as WheelRiskLevel,Co as Wheel,ar as VALID_SUITS,lr as VALID_RANKS,Er as VALID_EUROPEAN_STREETS,I as VALID_EUROPEAN_STRAIGHTS,or as VALID_EUROPEAN_SPLITS,tr as VALID_EUROPEAN_DOUBLE_STREETS,cr as VALID_EUROPEAN_CORNERS,Ar as VALID_AMERICAN_STREETS,rr as VALID_AMERICAN_STRAIGHTS,ir as VALID_AMERICAN_SPLITS,er as VALID_AMERICAN_DOUBLE_STREETS,nr as VALID_AMERICAN_CORNERS,Q as RouletteType,Bo as Roulette,Dr as RollType,$ as RANDOM_MIN_VALUE,j as RANDOM_MAX_VALUE,m as PlinkoRiskLevel,Eo as Plinko,K as Parity,ni as PLINKO_ROW_COUNTS,x as OrigamiGame,br as Mines,Lr as MIN_WIN_CHANCE,yr as MAX_WIN_CHANCE,ur as Limbo,Qr as KenoRiskLevel,Wr as Keno,Z as Half,Gr as GameErrorCode,e as GameError,R as Game,X as EFFECTIVE_RANGE,D as Dozen,Ir as DiceDirection,Jr as Dice,Ur as DiamondsResultType,zr as Diamonds,_ as Column,p as Color,Mr as BaccaratOutcome,wr as BaccaratBetType,hr as Baccarat,Nr as AdvancedDice,J as AMERICAN_BASKET};
|