@arcanahq/cardgames 1.0.0 → 1.0.1

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.
@@ -0,0 +1,830 @@
1
+ import * as __import0 from "__unittest_framework_env";
2
+ async function instantiate(module, imports = {}) {
3
+ const __module0 = imports.__unittest_framework_env;
4
+ const adaptedImports = {
5
+ env: Object.assign(Object.create(globalThis), imports.env || {}, {
6
+ abort(message, fileName, lineNumber, columnNumber) {
7
+ // ~lib/builtins/abort(~lib/string/String | null?, ~lib/string/String | null?, u32?, u32?) => void
8
+ message = __liftString(message >>> 0);
9
+ fileName = __liftString(fileName >>> 0);
10
+ lineNumber = lineNumber >>> 0;
11
+ columnNumber = columnNumber >>> 0;
12
+ (() => {
13
+ // @external.js
14
+ throw Error(`${message} in ${fileName}:${lineNumber}:${columnNumber}`);
15
+ })();
16
+ },
17
+ }),
18
+ __unittest_framework_env: Object.assign(Object.create(__module0), {
19
+ collectCheckResult(result, codeInfoIndex, actualValue, expectValue) {
20
+ // ~lib/assemblyscript-unittest-framework/assembly/env/assertResult.collectCheckResult(bool, f64, ~lib/string/String, ~lib/string/String) => void
21
+ result = result != 0;
22
+ actualValue = __liftString(actualValue >>> 0);
23
+ expectValue = __liftString(expectValue >>> 0);
24
+ __module0.collectCheckResult(result, codeInfoIndex, actualValue, expectValue);
25
+ },
26
+ addDescription(description) {
27
+ // ~lib/assemblyscript-unittest-framework/assembly/env/assertResult.addDescription(~lib/string/String) => void
28
+ description = __liftString(description >>> 0);
29
+ __module0.addDescription(description);
30
+ },
31
+ registerTestFunction(index) {
32
+ // ~lib/assemblyscript-unittest-framework/assembly/env/assertResult.registerTestFunction(u32) => void
33
+ index = index >>> 0;
34
+ __module0.registerTestFunction(index);
35
+ },
36
+ }),
37
+ };
38
+ const { exports } = await WebAssembly.instantiate(module, adaptedImports);
39
+ const memory = exports.memory || imports.env.memory;
40
+ const adaptedExports = Object.setPrototypeOf({
41
+ createStandardDeck() {
42
+ // assembly/cardgames/createStandardDeck() => ~lib/array/Array<assembly/cards/Card>
43
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.createStandardDeck() >>> 0);
44
+ },
45
+ shuffleDeck(deck, seed) {
46
+ // assembly/cardgames/shuffleDeck(~lib/array/Array<assembly/cards/Card>, ~lib/@arcanahq/core/assembly/primitives/random/RandomSeed) => ~lib/@arcanahq/core/assembly/primitives/random/RandomSeed
47
+ deck = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull());
48
+ seed = __lowerInternref(seed) || __notnull();
49
+ try {
50
+ return __liftInternref(exports.shuffleDeck(deck, seed) >>> 0);
51
+ } finally {
52
+ __release(deck);
53
+ }
54
+ },
55
+ createShuffledDeck(seed) {
56
+ // assembly/cardgames/createShuffledDeck(~lib/@arcanahq/core/assembly/primitives/random/RandomSeed) => assembly/cardgames/ShuffledDeckResult
57
+ seed = __lowerInternref(seed) || __notnull();
58
+ return __liftInternref(exports.createShuffledDeck(seed) >>> 0);
59
+ },
60
+ dealCard(deck) {
61
+ // assembly/cardgames/dealCard(~lib/array/Array<assembly/cards/Card>) => assembly/cards/Card | null
62
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
63
+ return __liftInternref(exports.dealCard(deck) >>> 0);
64
+ },
65
+ dealCards(deck, count) {
66
+ // assembly/cardgames/dealCards(~lib/array/Array<assembly/cards/Card>, i32) => ~lib/array/Array<assembly/cards/Card>
67
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
68
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.dealCards(deck, count) >>> 0);
69
+ },
70
+ dealCardFromDeck(deck, seed) {
71
+ // assembly/cardgames/dealCardFromDeck(~lib/array/Array<assembly/cards/Card>, ~lib/@arcanahq/core/assembly/primitives/random/RandomSeed) => assembly/cardgames/DealCardResult
72
+ deck = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull());
73
+ seed = __lowerInternref(seed) || __notnull();
74
+ try {
75
+ return __liftInternref(exports.dealCardFromDeck(deck, seed) >>> 0);
76
+ } finally {
77
+ __release(deck);
78
+ }
79
+ },
80
+ getDeckSize(deck) {
81
+ // assembly/cardgames/getDeckSize(~lib/array/Array<assembly/cards/Card>) => i32
82
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
83
+ return exports.getDeckSize(deck);
84
+ },
85
+ isDeckEmpty(deck) {
86
+ // assembly/cardgames/isDeckEmpty(~lib/array/Array<assembly/cards/Card>) => bool
87
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
88
+ return exports.isDeckEmpty(deck) != 0;
89
+ },
90
+ cloneDeck(deck) {
91
+ // assembly/cardgames/cloneDeck(~lib/array/Array<assembly/cards/Card>) => ~lib/array/Array<assembly/cards/Card>
92
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
93
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.cloneDeck(deck) >>> 0);
94
+ },
95
+ cardToInt(card) {
96
+ // assembly/cardgames/cardToInt(assembly/cards/Card) => i32
97
+ card = __lowerInternref(card) || __notnull();
98
+ return exports.cardToInt(card);
99
+ },
100
+ intToCard(value) {
101
+ // assembly/cardgames/intToCard(i32) => assembly/cards/Card | null
102
+ return __liftInternref(exports.intToCard(value) >>> 0);
103
+ },
104
+ deckToIntArray(deck) {
105
+ // assembly/cardgames/deckToIntArray(~lib/array/Array<assembly/cards/Card>) => ~lib/array/Array<i32>
106
+ deck = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, deck) || __notnull();
107
+ return __liftArray(__getI32, 2, exports.deckToIntArray(deck) >>> 0);
108
+ },
109
+ intArrayToDeck(ints) {
110
+ // assembly/cardgames/intArrayToDeck(~lib/array/Array<i32>) => ~lib/array/Array<assembly/cards/Card>
111
+ ints = __lowerArray(__setU32, 11, 2, ints) || __notnull();
112
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.intArrayToDeck(ints) >>> 0);
113
+ },
114
+ evaluateHand(holeCards, community) {
115
+ // assembly/poker/evaluateHand(~lib/array/Array<assembly/cards/Card>, ~lib/array/Array<assembly/cards/Card>) => assembly/cards/HandRank
116
+ holeCards = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, holeCards) || __notnull());
117
+ community = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, community) || __notnull();
118
+ try {
119
+ return __liftInternref(exports.evaluateHand(holeCards, community) >>> 0);
120
+ } finally {
121
+ __release(holeCards);
122
+ }
123
+ },
124
+ compareHands(hand1, hand2) {
125
+ // assembly/poker/compareHands(assembly/cards/HandRank, assembly/cards/HandRank) => i32
126
+ hand1 = __retain(__lowerInternref(hand1) || __notnull());
127
+ hand2 = __lowerInternref(hand2) || __notnull();
128
+ try {
129
+ return exports.compareHands(hand1, hand2);
130
+ } finally {
131
+ __release(hand1);
132
+ }
133
+ },
134
+ getBestFiveCards(holeCards, community) {
135
+ // assembly/poker/getBestFiveCards(~lib/array/Array<assembly/cards/Card>, ~lib/array/Array<assembly/cards/Card>) => ~lib/array/Array<assembly/cards/Card>
136
+ holeCards = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, holeCards) || __notnull());
137
+ community = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, community) || __notnull();
138
+ try {
139
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.getBestFiveCards(holeCards, community) >>> 0);
140
+ } finally {
141
+ __release(holeCards);
142
+ }
143
+ },
144
+ getBlackjackCardValue(card) {
145
+ // assembly/blackjack/blackjack/getBlackjackCardValue(assembly/cards/Card) => i32
146
+ card = __lowerInternref(card) || __notnull();
147
+ return exports.getBlackjackCardValue(card);
148
+ },
149
+ calculateBlackjackHandValue(cards) {
150
+ // assembly/blackjack/blackjack/calculateBlackjackHandValue(~lib/array/Array<assembly/cards/Card>) => i32
151
+ cards = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull();
152
+ return exports.calculateBlackjackHandValue(cards);
153
+ },
154
+ isBlackjack(cards) {
155
+ // assembly/blackjack/blackjack/isBlackjack(~lib/array/Array<assembly/cards/Card>) => bool
156
+ cards = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull();
157
+ return exports.isBlackjack(cards) != 0;
158
+ },
159
+ isBusted(cards) {
160
+ // assembly/blackjack/blackjack/isBusted(~lib/array/Array<assembly/cards/Card>) => bool
161
+ cards = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull();
162
+ return exports.isBusted(cards) != 0;
163
+ },
164
+ canSplitCards(cards) {
165
+ // assembly/blackjack/blackjack/canSplitCards(~lib/array/Array<assembly/cards/Card>) => bool
166
+ cards = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull();
167
+ return exports.canSplitCards(cards) != 0;
168
+ },
169
+ isSoftHand(cards) {
170
+ // assembly/blackjack/blackjack/isSoftHand(~lib/array/Array<assembly/cards/Card>) => bool
171
+ cards = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull();
172
+ return exports.isSoftHand(cards) != 0;
173
+ },
174
+ dealerShouldHit(cards, rules) {
175
+ // assembly/blackjack/blackjack/dealerShouldHit(~lib/array/Array<assembly/cards/Card>, assembly/blackjack/blackjack/BlackjackRules) => bool
176
+ cards = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 6, 2, cards) || __notnull());
177
+ rules = __lowerInternref(rules) || __notnull();
178
+ try {
179
+ return exports.dealerShouldHit(cards, rules) != 0;
180
+ } finally {
181
+ __release(cards);
182
+ }
183
+ },
184
+ evaluatePairPlus(card1, card2) {
185
+ // assembly/blackjack/blackjack/evaluatePairPlus(assembly/cards/Card, assembly/cards/Card) => assembly/blackjack/blackjack/PairPlusResult
186
+ card1 = __retain(__lowerInternref(card1) || __notnull());
187
+ card2 = __lowerInternref(card2) || __notnull();
188
+ try {
189
+ return __liftRecord18(exports.evaluatePairPlus(card1, card2) >>> 0);
190
+ } finally {
191
+ __release(card1);
192
+ }
193
+ },
194
+ evaluateTwentyOnePlusThree(card1, card2, card3) {
195
+ // assembly/blackjack/blackjack/evaluateTwentyOnePlusThree(assembly/cards/Card, assembly/cards/Card, assembly/cards/Card) => assembly/blackjack/blackjack/TwentyOnePlusThreeResult
196
+ card1 = __retain(__lowerInternref(card1) || __notnull());
197
+ card2 = __retain(__lowerInternref(card2) || __notnull());
198
+ card3 = __lowerInternref(card3) || __notnull();
199
+ try {
200
+ return __liftRecord19(exports.evaluateTwentyOnePlusThree(card1, card2, card3) >>> 0);
201
+ } finally {
202
+ __release(card1);
203
+ __release(card2);
204
+ }
205
+ },
206
+ calculateAvailableActions(handCardsLength, handIsFromSplit, handIsSplitAces, handIsStanding, handIsBusted, gamePhase, playerHandsCount, canSplit, rules) {
207
+ // assembly/blackjack/actions/calculateAvailableActions(i32, bool, bool, bool, bool, ~lib/string/String, i32, bool, assembly/blackjack/blackjack/BlackjackRules) => assembly/blackjack/actions/AvailableActions
208
+ handIsFromSplit = handIsFromSplit ? 1 : 0;
209
+ handIsSplitAces = handIsSplitAces ? 1 : 0;
210
+ handIsStanding = handIsStanding ? 1 : 0;
211
+ handIsBusted = handIsBusted ? 1 : 0;
212
+ gamePhase = __retain(__lowerString(gamePhase) || __notnull());
213
+ canSplit = canSplit ? 1 : 0;
214
+ rules = __lowerInternref(rules) || __notnull();
215
+ try {
216
+ return __liftRecord20(exports.calculateAvailableActions(handCardsLength, handIsFromSplit, handIsSplitAces, handIsStanding, handIsBusted, gamePhase, playerHandsCount, canSplit, rules) >>> 0);
217
+ } finally {
218
+ __release(gamePhase);
219
+ }
220
+ },
221
+ shouldDealerHit(handValue, dealerStandValue, hitOnSoft17, isSoftHand) {
222
+ // assembly/blackjack/actions/shouldDealerHit(i32, i32, bool, bool) => bool
223
+ hitOnSoft17 = hitOnSoft17 ? 1 : 0;
224
+ isSoftHand = isSoftHand ? 1 : 0;
225
+ return exports.shouldDealerHit(handValue, dealerStandValue, hitOnSoft17, isSoftHand) != 0;
226
+ },
227
+ validateActionPhase(gamePhase, action, requiredPhase) {
228
+ // assembly/blackjack/actions/validateActionPhase(~lib/string/String, ~lib/string/String, ~lib/string/String) => void
229
+ gamePhase = __retain(__lowerString(gamePhase) || __notnull());
230
+ action = __retain(__lowerString(action) || __notnull());
231
+ requiredPhase = __lowerString(requiredPhase) || __notnull();
232
+ try {
233
+ exports.validateActionPhase(gamePhase, action, requiredPhase);
234
+ } finally {
235
+ __release(gamePhase);
236
+ __release(action);
237
+ }
238
+ },
239
+ validateCanHit(handIsStanding, handIsBusted, handIsSplitAces) {
240
+ // assembly/blackjack/actions/validateCanHit(bool, bool, bool) => void
241
+ handIsStanding = handIsStanding ? 1 : 0;
242
+ handIsBusted = handIsBusted ? 1 : 0;
243
+ handIsSplitAces = handIsSplitAces ? 1 : 0;
244
+ exports.validateCanHit(handIsStanding, handIsBusted, handIsSplitAces);
245
+ },
246
+ validateCanStand(handIsStanding, handIsBusted) {
247
+ // assembly/blackjack/actions/validateCanStand(bool, bool) => void
248
+ handIsStanding = handIsStanding ? 1 : 0;
249
+ handIsBusted = handIsBusted ? 1 : 0;
250
+ exports.validateCanStand(handIsStanding, handIsBusted);
251
+ },
252
+ validateCanDouble(handCardsLength, handIsSplitAces, handIsFromSplit, rules) {
253
+ // assembly/blackjack/actions/validateCanDouble(i32, bool, bool, assembly/blackjack/blackjack/BlackjackRules) => void
254
+ handIsSplitAces = handIsSplitAces ? 1 : 0;
255
+ handIsFromSplit = handIsFromSplit ? 1 : 0;
256
+ rules = __lowerInternref(rules) || __notnull();
257
+ exports.validateCanDouble(handCardsLength, handIsSplitAces, handIsFromSplit, rules);
258
+ },
259
+ validateCanSplit(handCardsLength, playerHandsCount, canSplit, rules) {
260
+ // assembly/blackjack/actions/validateCanSplit(i32, i32, bool, assembly/blackjack/blackjack/BlackjackRules) => void
261
+ canSplit = canSplit ? 1 : 0;
262
+ rules = __lowerInternref(rules) || __notnull();
263
+ exports.validateCanSplit(handCardsLength, playerHandsCount, canSplit, rules);
264
+ },
265
+ validateCanSurrender(handCardsLength, handIsFromSplit, rules) {
266
+ // assembly/blackjack/actions/validateCanSurrender(i32, bool, assembly/blackjack/blackjack/BlackjackRules) => void
267
+ handIsFromSplit = handIsFromSplit ? 1 : 0;
268
+ rules = __lowerInternref(rules) || __notnull();
269
+ exports.validateCanSurrender(handCardsLength, handIsFromSplit, rules);
270
+ },
271
+ shouldOfferInsurance(dealerUpCardRank, rules) {
272
+ // assembly/blackjack/actions/shouldOfferInsurance(~lib/string/String, assembly/blackjack/blackjack/BlackjackRules) => bool
273
+ dealerUpCardRank = __retain(__lowerString(dealerUpCardRank) || __notnull());
274
+ rules = __lowerInternref(rules) || __notnull();
275
+ try {
276
+ return exports.shouldOfferInsurance(dealerUpCardRank, rules) != 0;
277
+ } finally {
278
+ __release(dealerUpCardRank);
279
+ }
280
+ },
281
+ validateBuyInAmount(amount, minBuyIn, maxBuyIn) {
282
+ // assembly/cashgames/cash_game_utils/validateBuyInAmount(~lib/string/String, ~lib/string/String, ~lib/string/String) => bool
283
+ amount = __retain(__lowerString(amount) || __notnull());
284
+ minBuyIn = __retain(__lowerString(minBuyIn) || __notnull());
285
+ maxBuyIn = __lowerString(maxBuyIn) || __notnull();
286
+ try {
287
+ return exports.validateBuyInAmount(amount, minBuyIn, maxBuyIn) != 0;
288
+ } finally {
289
+ __release(amount);
290
+ __release(minBuyIn);
291
+ }
292
+ },
293
+ calculateRake(potAmount, rakePercentage, rakeCap) {
294
+ // assembly/cashgames/cash_game_utils/calculateRake(i64, f64, i64) => i64
295
+ potAmount = potAmount || 0n;
296
+ rakeCap = rakeCap || 0n;
297
+ return exports.calculateRake(potAmount, rakePercentage, rakeCap);
298
+ },
299
+ calculateRakeString(potAmount, rakePercentage, rakeCap) {
300
+ // assembly/cashgames/cash_game_utils/calculateRakeString(~lib/string/String, f64, ~lib/string/String) => ~lib/string/String
301
+ potAmount = __retain(__lowerString(potAmount) || __notnull());
302
+ rakeCap = __lowerString(rakeCap) || __notnull();
303
+ try {
304
+ return __liftString(exports.calculateRakeString(potAmount, rakePercentage, rakeCap) >>> 0);
305
+ } finally {
306
+ __release(potAmount);
307
+ }
308
+ },
309
+ canRebuy(seat, gamePhase, rebuyAllowed, cooldownMs, nowMs) {
310
+ // assembly/cashgames/cash_game_utils/canRebuy(assembly/cashgames/cash_game_types/CashGameSeatBase, ~lib/string/String, bool, i64, i64) => bool
311
+ seat = __retain(__lowerInternref(seat) || __notnull());
312
+ gamePhase = __lowerString(gamePhase) || __notnull();
313
+ rebuyAllowed = rebuyAllowed ? 1 : 0;
314
+ cooldownMs = cooldownMs || 0n;
315
+ nowMs = nowMs || 0n;
316
+ try {
317
+ return exports.canRebuy(seat, gamePhase, rebuyAllowed, cooldownMs, nowMs) != 0;
318
+ } finally {
319
+ __release(seat);
320
+ }
321
+ },
322
+ canTopUp(seat, topUpAmount, maxBuyIn, gamePhase) {
323
+ // assembly/cashgames/cash_game_utils/canTopUp(assembly/cashgames/cash_game_types/CashGameSeatBase, ~lib/string/String, ~lib/string/String, ~lib/string/String) => bool
324
+ seat = __retain(__lowerInternref(seat) || __notnull());
325
+ topUpAmount = __retain(__lowerString(topUpAmount) || __notnull());
326
+ maxBuyIn = __retain(__lowerString(maxBuyIn) || __notnull());
327
+ gamePhase = __lowerString(gamePhase) || __notnull();
328
+ try {
329
+ return exports.canTopUp(seat, topUpAmount, maxBuyIn, gamePhase) != 0;
330
+ } finally {
331
+ __release(seat);
332
+ __release(topUpAmount);
333
+ __release(maxBuyIn);
334
+ }
335
+ },
336
+ initializeCashGameSeats(maxSeats) {
337
+ // assembly/cashgames/cash_game_utils/initializeCashGameSeats(i32) => ~lib/array/Array<assembly/cashgames/cash_game_types/CashGameSeatBase>
338
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.initializeCashGameSeats(maxSeats) >>> 0);
339
+ },
340
+ deterministicShuffleIndices(indices, shuffleId, shuffleSalt, seedIndex) {
341
+ // assembly/deck/deck/deterministicShuffleIndices(~lib/array/Array<i32>, ~lib/string/String, ~lib/string/String, i32) => ~lib/array/Array<i32>
342
+ indices = __retain(__lowerArray(__setU32, 11, 2, indices) || __notnull());
343
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
344
+ shuffleSalt = __lowerString(shuffleSalt) || __notnull();
345
+ try {
346
+ return __liftArray(__getI32, 2, exports.deterministicShuffleIndices(indices, shuffleId, shuffleSalt, seedIndex) >>> 0);
347
+ } finally {
348
+ __release(indices);
349
+ __release(shuffleId);
350
+ }
351
+ },
352
+ dealCardByIndex(shuffleId, shuffleSalt, dealtCardCount, config) {
353
+ // assembly/deck/deck/dealCardByIndex(~lib/string/String, ~lib/string/String, i32, assembly/deck/deck/DeckConfig) => assembly/cards/Card
354
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
355
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
356
+ config = __lowerRecord27(config) || __notnull();
357
+ try {
358
+ return __liftInternref(exports.dealCardByIndex(shuffleId, shuffleSalt, dealtCardCount, config) >>> 0);
359
+ } finally {
360
+ __release(shuffleId);
361
+ __release(shuffleSalt);
362
+ }
363
+ },
364
+ dealCardFromShoe(shuffleId, shuffleSalt, shoePosition, shoeConfig) {
365
+ // assembly/deck/deck/dealCardFromShoe(~lib/string/String, ~lib/string/String, i32, assembly/deck/deck/ShoeConfig) => assembly/cards/Card
366
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
367
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
368
+ shoeConfig = __lowerInternref(shoeConfig) || __notnull();
369
+ try {
370
+ return __liftInternref(exports.dealCardFromShoe(shuffleId, shuffleSalt, shoePosition, shoeConfig) >>> 0);
371
+ } finally {
372
+ __release(shuffleId);
373
+ __release(shuffleSalt);
374
+ }
375
+ },
376
+ getShuffledShoeIndices(shuffleId, shuffleSalt, shoeIteration, shoeConfig) {
377
+ // assembly/deck/deck/getShuffledShoeIndices(~lib/string/String, ~lib/string/String, i32, assembly/deck/deck/ShoeConfig) => ~lib/array/Array<i32>
378
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
379
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
380
+ shoeConfig = __lowerInternref(shoeConfig) || __notnull();
381
+ try {
382
+ return __liftArray(__getI32, 2, exports.getShuffledShoeIndices(shuffleId, shuffleSalt, shoeIteration, shoeConfig) >>> 0);
383
+ } finally {
384
+ __release(shuffleId);
385
+ __release(shuffleSalt);
386
+ }
387
+ },
388
+ dealCardsFromShoe(shuffleId, shuffleSalt, shoePosition, count, shoeConfig) {
389
+ // assembly/deck/deck/dealCardsFromShoe(~lib/string/String, ~lib/string/String, i32, i32, assembly/deck/deck/ShoeConfig) => ~lib/array/Array<assembly/cards/Card>
390
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
391
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
392
+ shoeConfig = __lowerInternref(shoeConfig) || __notnull();
393
+ try {
394
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.dealCardsFromShoe(shuffleId, shuffleSalt, shoePosition, count, shoeConfig) >>> 0);
395
+ } finally {
396
+ __release(shuffleId);
397
+ __release(shuffleSalt);
398
+ }
399
+ },
400
+ createShuffledDeck(shuffleId, shuffleSalt, seedIndex, config) {
401
+ // assembly/deck/deck/createShuffledDeck(~lib/string/String, ~lib/string/String, i32, assembly/deck/deck/DeckConfig) => ~lib/array/Array<assembly/cards/Card>
402
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
403
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
404
+ config = __lowerRecord27(config) || __notnull();
405
+ try {
406
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.createShuffledDeck(shuffleId, shuffleSalt, seedIndex, config) >>> 0);
407
+ } finally {
408
+ __release(shuffleId);
409
+ __release(shuffleSalt);
410
+ }
411
+ },
412
+ getShuffledIndices(shuffleId, shuffleSalt, seedIndex, config) {
413
+ // assembly/deck/deck/getShuffledIndices(~lib/string/String, ~lib/string/String, i32, assembly/deck/deck/DeckConfig) => ~lib/array/Array<i32>
414
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
415
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
416
+ config = __lowerRecord27(config) || __notnull();
417
+ try {
418
+ return __liftArray(__getI32, 2, exports.getShuffledIndices(shuffleId, shuffleSalt, seedIndex, config) >>> 0);
419
+ } finally {
420
+ __release(shuffleId);
421
+ __release(shuffleSalt);
422
+ }
423
+ },
424
+ dealCards(shuffleId, shuffleSalt, dealtCardCount, count, config) {
425
+ // assembly/deck/deck/dealCards(~lib/string/String, ~lib/string/String, i32, i32, assembly/deck/deck/DeckConfig) => ~lib/array/Array<assembly/cards/Card>
426
+ shuffleId = __retain(__lowerString(shuffleId) || __notnull());
427
+ shuffleSalt = __retain(__lowerString(shuffleSalt) || __notnull());
428
+ config = __lowerRecord27(config) || __notnull();
429
+ try {
430
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.dealCards(shuffleId, shuffleSalt, dealtCardCount, count, config) >>> 0);
431
+ } finally {
432
+ __release(shuffleId);
433
+ __release(shuffleSalt);
434
+ }
435
+ },
436
+ createUnshuffledDeck(config) {
437
+ // assembly/deck/deck/createUnshuffledDeck(assembly/deck/deck/DeckConfig) => ~lib/array/Array<assembly/cards/Card>
438
+ config = __lowerRecord27(config) || __notnull();
439
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.createUnshuffledDeck(config) >>> 0);
440
+ },
441
+ calculatePokerRake(potAmount, rakeConfig) {
442
+ // assembly/poker/poker_game_utils/calculatePokerRake(i64, assembly/poker/poker_game_types/PokerRakeConfig) => i64
443
+ potAmount = potAmount || 0n;
444
+ rakeConfig = __lowerInternref(rakeConfig) || __notnull();
445
+ return exports.calculatePokerRake(potAmount, rakeConfig);
446
+ },
447
+ calculateRakeSimple(potAmount, rakePercentage, rakeCap) {
448
+ // assembly/poker/poker_game_utils/calculateRakeSimple(i64, f64, i64) => i64
449
+ potAmount = potAmount || 0n;
450
+ rakeCap = rakeCap || 0n;
451
+ return exports.calculateRakeSimple(potAmount, rakePercentage, rakeCap);
452
+ },
453
+ constructSidePots(contributions, startPotId) {
454
+ // assembly/poker/poker_game_utils/constructSidePots(~lib/map/Map<i32,i64>, i32?) => ~lib/array/Array<assembly/poker/poker_game_types/Pot>
455
+ contributions = __lowerInternref(contributions) || __notnull();
456
+ exports.__setArgumentsLength(arguments.length);
457
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.constructSidePots(contributions, startPotId) >>> 0);
458
+ },
459
+ splitPotForRuns(pot, runCount) {
460
+ // assembly/poker/poker_game_utils/splitPotForRuns(assembly/poker/poker_game_types/Pot, i32) => assembly/poker/poker_game_types/Pot
461
+ pot = __lowerInternref(pot) || __notnull();
462
+ return __liftInternref(exports.splitPotForRuns(pot, runCount) >>> 0);
463
+ },
464
+ splitAllPotsForRuns(pots, runCount) {
465
+ // assembly/poker/poker_game_utils/splitAllPotsForRuns(~lib/array/Array<assembly/poker/poker_game_types/Pot>, i32) => ~lib/array/Array<assembly/poker/poker_game_types/Pot>
466
+ pots = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 33, 2, pots) || __notnull();
467
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.splitAllPotsForRuns(pots, runCount) >>> 0);
468
+ },
469
+ calculateOddChips(amount, numWinners, winners, buttonSeatId) {
470
+ // assembly/poker/poker_game_utils/calculateOddChips(i64, i32, ~lib/array/Array<i32>, i32) => ~lib/array/Array<i64>
471
+ amount = amount || 0n;
472
+ winners = __lowerArray(__setU32, 11, 2, winners) || __notnull();
473
+ return __liftArray(__getI64, 3, exports.calculateOddChips(amount, numWinners, winners, buttonSeatId) >>> 0);
474
+ },
475
+ distributePot(pot, winners, runIndex, buttonSeatId, rakeConfig) {
476
+ // assembly/poker/poker_game_utils/distributePot(assembly/poker/poker_game_types/Pot, ~lib/array/Array<i32>, i32, i32, assembly/poker/poker_game_types/PokerRakeConfig) => assembly/poker/poker_game_types/PotDistributionResult
477
+ pot = __retain(__lowerInternref(pot) || __notnull());
478
+ winners = __retain(__lowerArray(__setU32, 11, 2, winners) || __notnull());
479
+ rakeConfig = __lowerInternref(rakeConfig) || __notnull();
480
+ try {
481
+ return __liftInternref(exports.distributePot(pot, winners, runIndex, buttonSeatId, rakeConfig) >>> 0);
482
+ } finally {
483
+ __release(pot);
484
+ __release(winners);
485
+ }
486
+ },
487
+ distributePotSimple(pot, winners, runIndex, buttonSeatId, rakePercentage, rakeCap) {
488
+ // assembly/poker/poker_game_utils/distributePotSimple(assembly/poker/poker_game_types/Pot, ~lib/array/Array<i32>, i32, i32, f64?, i64?) => assembly/poker/poker_game_types/PotDistributionResult
489
+ pot = __retain(__lowerInternref(pot) || __notnull());
490
+ winners = __lowerArray(__setU32, 11, 2, winners) || __notnull();
491
+ rakeCap = rakeCap || 0n;
492
+ try {
493
+ exports.__setArgumentsLength(arguments.length);
494
+ return __liftInternref(exports.distributePotSimple(pot, winners, runIndex, buttonSeatId, rakePercentage, rakeCap) >>> 0);
495
+ } finally {
496
+ __release(pot);
497
+ }
498
+ },
499
+ lockPots(pots) {
500
+ // assembly/poker/poker_game_utils/lockPots(~lib/array/Array<assembly/poker/poker_game_types/Pot>) => ~lib/array/Array<assembly/poker/poker_game_types/Pot>
501
+ pots = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 33, 2, pots) || __notnull();
502
+ return __liftArray(pointer => __liftInternref(__getU32(pointer)), 2, exports.lockPots(pots) >>> 0);
503
+ },
504
+ getTotalPotAmount(pots) {
505
+ // assembly/poker/poker_game_utils/getTotalPotAmount(~lib/array/Array<assembly/poker/poker_game_types/Pot>) => i64
506
+ pots = __lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 33, 2, pots) || __notnull();
507
+ return exports.getTotalPotAmount(pots);
508
+ },
509
+ calculateAnteAmount(stakes, anteType, antePercentage) {
510
+ // assembly/poker/poker_game_utils/calculateAnteAmount(assembly/poker/poker_game_types/Stakes, ~lib/string/String, f64?) => i64
511
+ stakes = __retain(__lowerInternref(stakes) || __notnull());
512
+ anteType = __lowerString(anteType) || __notnull();
513
+ try {
514
+ exports.__setArgumentsLength(arguments.length);
515
+ return exports.calculateAnteAmount(stakes, anteType, antePercentage);
516
+ } finally {
517
+ __release(stakes);
518
+ }
519
+ },
520
+ postAntes(seats, stakes, anteType, antePercentage, bettingState) {
521
+ // assembly/poker/poker_game_utils/postAntes(~lib/array/Array<assembly/poker/poker_game_types/PokerSeatBase>, assembly/poker/poker_game_types/Stakes, ~lib/string/String, f64, assembly/poker/poker_game_types/BettingRoundState) => assembly/poker/poker_game_utils/PostAntesResult
522
+ seats = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 38, 2, seats) || __notnull());
523
+ stakes = __retain(__lowerInternref(stakes) || __notnull());
524
+ anteType = __retain(__lowerString(anteType) || __notnull());
525
+ bettingState = __lowerInternref(bettingState) || __notnull();
526
+ try {
527
+ return __liftInternref(exports.postAntes(seats, stakes, anteType, antePercentage, bettingState) >>> 0);
528
+ } finally {
529
+ __release(seats);
530
+ __release(stakes);
531
+ __release(anteType);
532
+ }
533
+ },
534
+ postBlinds(seats, stakes, sbSeatId, bbSeatId, bettingState) {
535
+ // assembly/poker/poker_game_utils/postBlinds(~lib/array/Array<assembly/poker/poker_game_types/PokerSeatBase>, assembly/poker/poker_game_types/Stakes, i32, i32, assembly/poker/poker_game_types/BettingRoundState) => assembly/poker/poker_game_utils/PostBlindsResult
536
+ seats = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 38, 2, seats) || __notnull());
537
+ stakes = __retain(__lowerInternref(stakes) || __notnull());
538
+ bettingState = __lowerInternref(bettingState) || __notnull();
539
+ try {
540
+ return __liftInternref(exports.postBlinds(seats, stakes, sbSeatId, bbSeatId, bettingState) >>> 0);
541
+ } finally {
542
+ __release(seats);
543
+ __release(stakes);
544
+ }
545
+ },
546
+ getNextActingSeat(seats, buttonSeatId, isPreflop, bettingState) {
547
+ // assembly/poker/poker_game_utils/getNextActingSeat(~lib/array/Array<assembly/poker/poker_game_types/PokerSeatBase>, i32, bool, assembly/poker/poker_game_types/BettingRoundState) => i32
548
+ seats = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 38, 2, seats) || __notnull());
549
+ isPreflop = isPreflop ? 1 : 0;
550
+ bettingState = __lowerInternref(bettingState) || __notnull();
551
+ try {
552
+ return exports.getNextActingSeat(seats, buttonSeatId, isPreflop, bettingState);
553
+ } finally {
554
+ __release(seats);
555
+ }
556
+ },
557
+ validateBuyIn(buyInAmount, minBuyIn, maxBuyIn) {
558
+ // assembly/poker/poker_game_utils/validateBuyIn(i64, i64, i64) => bool
559
+ buyInAmount = buyInAmount || 0n;
560
+ minBuyIn = minBuyIn || 0n;
561
+ maxBuyIn = maxBuyIn || 0n;
562
+ return exports.validateBuyIn(buyInAmount, minBuyIn, maxBuyIn) != 0;
563
+ },
564
+ processBuyIn(seat, buyInAmount, minBuyIn, maxBuyIn) {
565
+ // assembly/poker/poker_game_utils/processBuyIn(assembly/poker/poker_game_types/PokerSeatBase, i64, i64, i64) => assembly/poker/poker_game_types/PokerSeatBase | null
566
+ seat = __lowerInternref(seat) || __notnull();
567
+ buyInAmount = buyInAmount || 0n;
568
+ minBuyIn = minBuyIn || 0n;
569
+ maxBuyIn = maxBuyIn || 0n;
570
+ return __liftInternref(exports.processBuyIn(seat, buyInAmount, minBuyIn, maxBuyIn) >>> 0);
571
+ },
572
+ isBettingRoundComplete(seats, bettingState) {
573
+ // assembly/poker/poker_game_utils/isBettingRoundComplete(~lib/array/Array<assembly/poker/poker_game_types/PokerSeatBase>, assembly/poker/poker_game_types/BettingRoundState) => bool
574
+ seats = __retain(__lowerArray((pointer, value) => { __setU32(pointer, __lowerInternref(value) || __notnull()); }, 38, 2, seats) || __notnull());
575
+ bettingState = __lowerInternref(bettingState) || __notnull();
576
+ try {
577
+ return exports.isBettingRoundComplete(seats, bettingState) != 0;
578
+ } finally {
579
+ __release(seats);
580
+ }
581
+ },
582
+ }, exports);
583
+ function __liftRecord18(pointer) {
584
+ // assembly/blackjack/blackjack/PairPlusResult
585
+ // Hint: Opt-out from lifting as a record by providing an empty constructor
586
+ if (!pointer) return null;
587
+ return {
588
+ hasPair: __getU8(pointer + 0) != 0,
589
+ pairType: __liftString(__getU32(pointer + 4)),
590
+ payoutMultiplier: __getI32(pointer + 8),
591
+ };
592
+ }
593
+ function __liftRecord19(pointer) {
594
+ // assembly/blackjack/blackjack/TwentyOnePlusThreeResult
595
+ // Hint: Opt-out from lifting as a record by providing an empty constructor
596
+ if (!pointer) return null;
597
+ return {
598
+ hasMatch: __getU8(pointer + 0) != 0,
599
+ handType: __liftString(__getU32(pointer + 4)),
600
+ payoutMultiplier: __getI32(pointer + 8),
601
+ };
602
+ }
603
+ function __liftRecord20(pointer) {
604
+ // assembly/blackjack/actions/AvailableActions
605
+ // Hint: Opt-out from lifting as a record by providing an empty constructor
606
+ if (!pointer) return null;
607
+ return {
608
+ canStand: __getU8(pointer + 0) != 0,
609
+ canDouble: __getU8(pointer + 1) != 0,
610
+ canSplit: __getU8(pointer + 2) != 0,
611
+ canSurrender: __getU8(pointer + 3) != 0,
612
+ };
613
+ }
614
+ function __lowerRecord27(value) {
615
+ // assembly/deck/deck/DeckConfig
616
+ // Hint: Opt-out from lowering as a record by providing an empty constructor
617
+ if (value == null) return 0;
618
+ const pointer = exports.__pin(exports.__new(0, 27));
619
+ exports.__unpin(pointer);
620
+ return pointer;
621
+ }
622
+ function __liftString(pointer) {
623
+ if (!pointer) return null;
624
+ const
625
+ end = pointer + new Uint32Array(memory.buffer)[pointer - 4 >>> 2] >>> 1,
626
+ memoryU16 = new Uint16Array(memory.buffer);
627
+ let
628
+ start = pointer >>> 1,
629
+ string = "";
630
+ while (end - start > 1024) string += String.fromCharCode(...memoryU16.subarray(start, start += 1024));
631
+ return string + String.fromCharCode(...memoryU16.subarray(start, end));
632
+ }
633
+ function __lowerString(value) {
634
+ if (value == null) return 0;
635
+ const
636
+ length = value.length,
637
+ pointer = exports.__new(length << 1, 2) >>> 0,
638
+ memoryU16 = new Uint16Array(memory.buffer);
639
+ for (let i = 0; i < length; ++i) memoryU16[(pointer >>> 1) + i] = value.charCodeAt(i);
640
+ return pointer;
641
+ }
642
+ function __liftArray(liftElement, align, pointer) {
643
+ if (!pointer) return null;
644
+ const
645
+ dataStart = __getU32(pointer + 4),
646
+ length = __dataview.getUint32(pointer + 12, true),
647
+ values = new Array(length);
648
+ for (let i = 0; i < length; ++i) values[i] = liftElement(dataStart + (i << align >>> 0));
649
+ return values;
650
+ }
651
+ function __lowerArray(lowerElement, id, align, values) {
652
+ if (values == null) return 0;
653
+ const
654
+ length = values.length,
655
+ buffer = exports.__pin(exports.__new(length << align, 1)) >>> 0,
656
+ header = exports.__pin(exports.__new(16, id)) >>> 0;
657
+ __setU32(header + 0, buffer);
658
+ __dataview.setUint32(header + 4, buffer, true);
659
+ __dataview.setUint32(header + 8, length << align, true);
660
+ __dataview.setUint32(header + 12, length, true);
661
+ for (let i = 0; i < length; ++i) lowerElement(buffer + (i << align >>> 0), values[i]);
662
+ exports.__unpin(buffer);
663
+ exports.__unpin(header);
664
+ return header;
665
+ }
666
+ class Internref extends Number {}
667
+ const registry = new FinalizationRegistry(__release);
668
+ function __liftInternref(pointer) {
669
+ if (!pointer) return null;
670
+ const sentinel = new Internref(__retain(pointer));
671
+ registry.register(sentinel, pointer);
672
+ return sentinel;
673
+ }
674
+ function __lowerInternref(value) {
675
+ if (value == null) return 0;
676
+ if (value instanceof Internref) return value.valueOf();
677
+ throw TypeError("internref expected");
678
+ }
679
+ const refcounts = new Map();
680
+ function __retain(pointer) {
681
+ if (pointer) {
682
+ const refcount = refcounts.get(pointer);
683
+ if (refcount) refcounts.set(pointer, refcount + 1);
684
+ else refcounts.set(exports.__pin(pointer), 1);
685
+ }
686
+ return pointer;
687
+ }
688
+ function __release(pointer) {
689
+ if (pointer) {
690
+ const refcount = refcounts.get(pointer);
691
+ if (refcount === 1) exports.__unpin(pointer), refcounts.delete(pointer);
692
+ else if (refcount) refcounts.set(pointer, refcount - 1);
693
+ else throw Error(`invalid refcount '${refcount}' for reference '${pointer}'`);
694
+ }
695
+ }
696
+ function __notnull() {
697
+ throw TypeError("value must not be null");
698
+ }
699
+ let __dataview = new DataView(memory.buffer);
700
+ function __setU32(pointer, value) {
701
+ try {
702
+ __dataview.setUint32(pointer, value, true);
703
+ } catch {
704
+ __dataview = new DataView(memory.buffer);
705
+ __dataview.setUint32(pointer, value, true);
706
+ }
707
+ }
708
+ function __getU8(pointer) {
709
+ try {
710
+ return __dataview.getUint8(pointer, true);
711
+ } catch {
712
+ __dataview = new DataView(memory.buffer);
713
+ return __dataview.getUint8(pointer, true);
714
+ }
715
+ }
716
+ function __getI32(pointer) {
717
+ try {
718
+ return __dataview.getInt32(pointer, true);
719
+ } catch {
720
+ __dataview = new DataView(memory.buffer);
721
+ return __dataview.getInt32(pointer, true);
722
+ }
723
+ }
724
+ function __getU32(pointer) {
725
+ try {
726
+ return __dataview.getUint32(pointer, true);
727
+ } catch {
728
+ __dataview = new DataView(memory.buffer);
729
+ return __dataview.getUint32(pointer, true);
730
+ }
731
+ }
732
+ function __getI64(pointer) {
733
+ try {
734
+ return __dataview.getBigInt64(pointer, true);
735
+ } catch {
736
+ __dataview = new DataView(memory.buffer);
737
+ return __dataview.getBigInt64(pointer, true);
738
+ }
739
+ }
740
+ exports.__unit_test_start();
741
+ return adaptedExports;
742
+ }
743
+ export const {
744
+ memory,
745
+ __new,
746
+ __pin,
747
+ __unpin,
748
+ __collect,
749
+ __rtti_base,
750
+ createStandardDeck,
751
+ shuffleDeck,
752
+ createShuffledDeck,
753
+ dealCard,
754
+ dealCards,
755
+ dealCardFromDeck,
756
+ getDeckSize,
757
+ isDeckEmpty,
758
+ cloneDeck,
759
+ cardToInt,
760
+ intToCard,
761
+ deckToIntArray,
762
+ intArrayToDeck,
763
+ evaluateHand,
764
+ compareHands,
765
+ getBestFiveCards,
766
+ getBlackjackCardValue,
767
+ calculateBlackjackHandValue,
768
+ isBlackjack,
769
+ isBusted,
770
+ canSplitCards,
771
+ isSoftHand,
772
+ dealerShouldHit,
773
+ evaluatePairPlus,
774
+ evaluateTwentyOnePlusThree,
775
+ calculateAvailableActions,
776
+ shouldDealerHit,
777
+ validateActionPhase,
778
+ validateActiveHand,
779
+ validateCanHit,
780
+ validateCanStand,
781
+ validateCanDouble,
782
+ validateCanSplit,
783
+ validateCanSurrender,
784
+ shouldOfferInsurance,
785
+ validateBuyInAmount,
786
+ calculateRake,
787
+ calculateRakeString,
788
+ canRebuy,
789
+ canTopUp,
790
+ initializeCashGameSeats,
791
+ deterministicShuffleIndices,
792
+ dealCardByIndex,
793
+ dealCardFromShoe,
794
+ getShuffledShoeIndices,
795
+ dealCardsFromShoe,
796
+ createShuffledDeck,
797
+ getShuffledIndices,
798
+ dealCards,
799
+ createUnshuffledDeck,
800
+ calculatePokerRake,
801
+ calculateRakeSimple,
802
+ constructSidePots,
803
+ splitPotForRuns,
804
+ splitAllPotsForRuns,
805
+ calculateOddChips,
806
+ distributePot,
807
+ distributePotSimple,
808
+ lockPots,
809
+ getTotalPotAmount,
810
+ calculateAnteAmount,
811
+ postAntes,
812
+ postBlinds,
813
+ getNextActingSeat,
814
+ validateBuyIn,
815
+ processBuyIn,
816
+ isBettingRoundComplete,
817
+ } = await (async url => instantiate(
818
+ await (async () => {
819
+ const isNodeOrBun = typeof process != "undefined" && process.versions != null && (process.versions.node != null || process.versions.bun != null);
820
+ if (isNodeOrBun) { return globalThis.WebAssembly.compile(await (await import("node:fs/promises")).readFile(url)); }
821
+ else { return await globalThis.WebAssembly.compileStreaming(globalThis.fetch(url)); }
822
+ })(), {
823
+ __unittest_framework_env: __maybeDefault(__import0),
824
+ }
825
+ ))(new URL("test.wasm", import.meta.url));
826
+ function __maybeDefault(module) {
827
+ return typeof module.default === "object" && Object.keys(module).length == 1
828
+ ? module.default
829
+ : module;
830
+ }