@betorigami/games 2.8.0 → 2.8.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.d.ts CHANGED
@@ -7502,7 +7502,6 @@ export interface RouletteEndAction {
7502
7502
  result: number[];
7503
7503
  }
7504
7504
  export interface Action {
7505
- id: string;
7506
7505
  data: {
7507
7506
  DICE?: DiceStartAction | EndAction;
7508
7507
  KENO?: KenoStartAction | EndAction;
package/dist/index.mjs CHANGED
@@ -1779,7 +1779,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
1779
1779
  @input-change=${(l)=>{this.setMultiplierValue(l.detail.value)}}
1780
1780
  >
1781
1781
  ${!this._multiplierFocused?x`<lottie-icon
1782
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
1782
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
1783
1783
  trigger-selector="origami-input"
1784
1784
  size="16px"
1785
1785
  slot="right-icon"
@@ -1834,7 +1834,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
1834
1834
  >
1835
1835
  ${!this._winChanceFocused?x`
1836
1836
  <lottie-icon
1837
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
1837
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
1838
1838
  trigger-selector="origami-input"
1839
1839
  size="16px"
1840
1840
  slot="right-icon"
@@ -3063,7 +3063,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3063
3063
  >
3064
3064
  <div class=${U(r)} slot="icon">
3065
3065
  ${this.gameData?.customFooterLobbySvgUrl?x`<img src=${this.gameData.customFooterLobbySvgUrl} alt="" aria-hidden="true" />`:x`<lottie-icon
3066
- src="https://lottie.host/db97a0ba-3a21-44bc-96fa-d4088bd2fe5c/vbKvdWpsfG.json"
3066
+ src="https://assets.betorigami.com/games/animations/lobby.json"
3067
3067
  size="16px"
3068
3068
  ></lottie-icon>`}
3069
3069
  </div>
@@ -3087,7 +3087,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3087
3087
  <div class=${U(i)} slot="icon">
3088
3088
  ${this.gameData?.customFooterVolumeSvgUrl?x`<div class=${U({"custom-icon":!0,active:this.isVolumeSliderOpen})} style="--icon-url: url(${this.gameData.customFooterVolumeSvgUrl})"></div>`:x`<lottie-icon
3089
3089
  ?active=${this.isVolumeSliderOpen}
3090
- src="https://lottie.host/058da5c0-d98e-4ea5-a94a-3e4009cd65e4/jDXGAtHbYk.json"
3090
+ src="https://assets.betorigami.com/games/animations/volume.json"
3091
3091
  size="16px"
3092
3092
  ></lottie-icon>`}
3093
3093
  </div>
@@ -3126,7 +3126,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3126
3126
  <div class=${U(t)} slot="icon">
3127
3127
  ${this.gameData?.customFooterGameInfoSvgUrl?x`<div class=${U({"custom-icon":!0,active:this.gameInfoOpen})} style="--icon-url: url(${this.gameData.customFooterGameInfoSvgUrl})"></div>`:x`<lottie-icon
3128
3128
  ?active=${this.gameInfoOpen}
3129
- src="https://lottie.host/deb0332a-92c3-483b-a15b-55b09e90f39f/slFpZu28zm.json"
3129
+ src="https://assets.betorigami.com/games/animations/info_book.json"
3130
3130
  size="16px"
3131
3131
  ></lottie-icon>`}
3132
3132
  </div>
@@ -3149,7 +3149,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3149
3149
  <div class=${U(n)} slot="icon">
3150
3150
  ${this.gameData?.customFooterInstantBetSvgUrl?x`<div class=${U({"custom-icon":!0,active:this.gameData?.instantBetEnabled??!1})} style="--icon-url: url(${this.gameData.customFooterInstantBetSvgUrl})"></div>`:x`<lottie-icon
3151
3151
  ?active=${this.gameData?.instantBetEnabled}
3152
- src="https://lottie.host/c1091440-04f3-4d88-b58a-7d0c6eea7cc9/g8rUu8TusE.json"
3152
+ src="https://assets.betorigami.com/games/animations/bolt.json"
3153
3153
  size="16px"
3154
3154
  ></lottie-icon>`}
3155
3155
  </div>
@@ -3174,7 +3174,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3174
3174
  <div class="icon-wrapper" slot="icon">
3175
3175
  ${this.gameData?.customFooterHotkeysSvgUrl?x`<div class=${U({"custom-icon":!0,active:(this.gameData?.hotkeysOpenEnabled??!1)||this.hotkeysOpen})} style="--icon-url: url(${this.gameData.customFooterHotkeysSvgUrl})"></div>`:x`<lottie-icon
3176
3176
  ?active=${(this.gameData?.hotkeysOpenEnabled??!1)||this.hotkeysOpen}
3177
- src="https://lottie.host/559ba17e-9241-43ce-828e-6d0561b7bf84/Au2WDwCaGd.json"
3177
+ src="https://assets.betorigami.com/games/animations/hotkeys.json"
3178
3178
  size="16px"
3179
3179
  ></lottie-icon>`}
3180
3180
  </div>
@@ -3211,7 +3211,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
3211
3211
  >
3212
3212
  <div class="icon-wrapper" slot="icon">
3213
3213
  ${this.gameData?.customFooterProvablyFairSvgUrl?x`<img src=${this.gameData.customFooterProvablyFairSvgUrl} alt="" aria-hidden="true" />`:x`<lottie-icon
3214
- src="https://lottie.host/169b3e52-2d9c-4ead-9783-1d5162ea48f3/gQcXU0IsMY.json"
3214
+ src="https://assets.betorigami.com/games/animations/subscription_icon.json"
3215
3215
  size="16px"
3216
3216
  ></lottie-icon>`}
3217
3217
  </div>
@@ -8140,7 +8140,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
8140
8140
  <origami-spinner class="info-icon"></origami-spinner>
8141
8141
  `:this._isVerified===!0?x`
8142
8142
  <lottie-icon
8143
- src="https://lottie.host/169b3e52-2d9c-4ead-9783-1d5162ea48f3/gQcXU0IsMY.json"
8143
+ src="https://assets.betorigami.com/games/animations/subscription_icon.json"
8144
8144
  size="20px"
8145
8145
  class="info-icon"
8146
8146
  tone="success"
@@ -9504,7 +9504,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9504
9504
  .value=${e.getLimboDisplayData()?.betTargetMultiplier?.toFixed(2)??""}
9505
9505
  >
9506
9506
  <lottie-icon
9507
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
9507
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
9508
9508
  trigger-selector="origami-input"
9509
9509
  size="16px"
9510
9510
  slot="right-icon"
@@ -9515,7 +9515,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9515
9515
  .value=${`${(99/(e.getLimboDisplayData()?.betTargetMultiplier??1)).toFixed(4)}%`}
9516
9516
  >
9517
9517
  <lottie-icon
9518
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
9518
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
9519
9519
  trigger-selector="origami-input"
9520
9520
  size="16px"
9521
9521
  slot="right-icon"
@@ -9531,7 +9531,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9531
9531
  .value=${parseFloat(this.betData.multiplier??"1.0000").toFixed(4)}
9532
9532
  >
9533
9533
  <lottie-icon
9534
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
9534
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
9535
9535
  trigger-selector="origami-input"
9536
9536
  size="16px"
9537
9537
  slot="right-icon"
@@ -9547,7 +9547,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9547
9547
  .value=${`${Number(e.getDiceData().winChance).toFixed(4)}%`}
9548
9548
  >
9549
9549
  <lottie-icon
9550
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
9550
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
9551
9551
  trigger-selector="origami-input"
9552
9552
  size="16px"
9553
9553
  slot="right-icon"
@@ -9563,7 +9563,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9563
9563
  .value=${parseFloat(this.betData.multiplier??"1.0000").toFixed(4)}
9564
9564
  >
9565
9565
  <lottie-icon
9566
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
9566
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
9567
9567
  trigger-selector="origami-input"
9568
9568
  size="16px"
9569
9569
  slot="right-icon"
@@ -9579,7 +9579,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
9579
9579
  .value=${`${Number(e.getAdvancedDiceRawData().winChance).toFixed(4)}%`}
9580
9580
  >
9581
9581
  <lottie-icon
9582
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
9582
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
9583
9583
  trigger-selector="origami-input"
9584
9584
  size="16px"
9585
9585
  slot="right-icon"
@@ -11188,7 +11188,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11188
11188
  </span>
11189
11189
  ${!this._onWinFocused?x`
11190
11190
  <lottie-icon
11191
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
11191
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
11192
11192
  trigger-selector="origami-input"
11193
11193
  size="16px"
11194
11194
  slot="right-icon"
@@ -11225,7 +11225,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11225
11225
  </span>
11226
11226
  ${!this._onLossFocused?x`
11227
11227
  <lottie-icon
11228
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
11228
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
11229
11229
  trigger-selector="origami-input"
11230
11230
  size="16px"
11231
11231
  slot="right-icon"
@@ -11530,7 +11530,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11530
11530
  <span class="value">0.00X</span>
11531
11531
  </div>
11532
11532
  <lottie-icon
11533
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
11533
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
11534
11534
  trigger-selector="origami-input"
11535
11535
  size="16px"
11536
11536
  ></lottie-icon>
@@ -11552,7 +11552,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11552
11552
  <span class="value">0.00%</span>
11553
11553
  </div>
11554
11554
  <lottie-icon
11555
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
11555
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
11556
11556
  trigger-selector="origami-input"
11557
11557
  size="16px"
11558
11558
  ></lottie-icon>
@@ -11583,7 +11583,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11583
11583
  <span class="value">${d.toFixed(2)}X</span>
11584
11584
  </div>
11585
11585
  <lottie-icon
11586
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
11586
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
11587
11587
  trigger-selector="origami-input"
11588
11588
  size="16px"
11589
11589
  ></lottie-icon>
@@ -11605,7 +11605,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11605
11605
  <span class="value">${De(c.toNumber())}%</span>
11606
11606
  </div>
11607
11607
  <lottie-icon
11608
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
11608
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
11609
11609
  trigger-selector="origami-input"
11610
11610
  size="16px"
11611
11611
  ></lottie-icon>
@@ -11714,7 +11714,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11714
11714
  .multipliersForSelectedTiles=${this.multipliersForSelectedTiles}
11715
11715
  ></origami-keno-content-bottom>
11716
11716
  </div>
11717
- `}}h([w({type:Array})],Et.prototype,"selectedTiles",void 0),h([w({type:Array})],Et.prototype,"resultTiles",void 0),h([w({type:Boolean})],Et.prototype,"isPlaying",void 0),h([w({type:Boolean})],Et.prototype,"gameOver",void 0),h([w({type:Number})],Et.prototype,"multipliersForSelectedTiles",void 0),h([w({type:Object})],Et.prototype,"payout",void 0),h([w({type:Boolean})],Et.prototype,"gameWinPopupShowing",void 0),h([w({type:Number})],Et.prototype,"multiplier",void 0),h([w({type:String})],Et.prototype,"risk",void 0),h([w({type:String})],Et.prototype,"betAmount",void 0),h([w({type:String})],Et.prototype,"betId",void 0),h([w({type:Boolean})],Et.prototype,"isDesktop",void 0),Et=h([F("origami-keno-content")],Et);var pr=10,js=40;class Wt{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/keno"}async startBet(a){let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify(a)}),i=await e.json();if(e.ok)return{success:!0,data:i};let r="alerts.gameError";switch(i.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}}var B9=10;class S2{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,riskLevel:i,selectedNumbers:r}=a,n=S2.generateRandomTiles(B9),t=this.calculateMultiplier(r,n,i),o=I(e).mul(t).toFixed(4);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",gameId:"KENO",currency:a.currency,amount:e,payout:o,afterBalance:"1000",multiplier:t.toString(),tenantUserId:"mock-user",clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{KENO:{selectedNumbers:r,riskLevel:i}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{id:crypto.randomUUID(),data:{KENO:{result:n}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:o}]}}}static generateRandomTiles(a,e=[]){let i=Array.from({length:js},(r,n)=>n).filter((r)=>!e.includes(r));return[...i].sort(()=>0.5-Math.random()).slice(0,Math.min(a,i.length))}calculateMultiplier(a,e,i){let r=a.filter((l)=>e.includes(l)).length,n=a.length,t=A1.configs(this.edge)[n-1].payout;if(!t)return 0;let o=t[i];if(!o||r>=o.length)return 0;return o[r]||0}}var qs=E`
11717
+ `}}h([w({type:Array})],Et.prototype,"selectedTiles",void 0),h([w({type:Array})],Et.prototype,"resultTiles",void 0),h([w({type:Boolean})],Et.prototype,"isPlaying",void 0),h([w({type:Boolean})],Et.prototype,"gameOver",void 0),h([w({type:Number})],Et.prototype,"multipliersForSelectedTiles",void 0),h([w({type:Object})],Et.prototype,"payout",void 0),h([w({type:Boolean})],Et.prototype,"gameWinPopupShowing",void 0),h([w({type:Number})],Et.prototype,"multiplier",void 0),h([w({type:String})],Et.prototype,"risk",void 0),h([w({type:String})],Et.prototype,"betAmount",void 0),h([w({type:String})],Et.prototype,"betId",void 0),h([w({type:Boolean})],Et.prototype,"isDesktop",void 0),Et=h([F("origami-keno-content")],Et);var pr=10,js=40;class Wt{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/keno"}async startBet(a){let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify(a)}),i=await e.json();if(e.ok)return{success:!0,data:i};let r="alerts.gameError";switch(i.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}}var B9=10;class S2{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,riskLevel:i,selectedNumbers:r}=a,n=S2.generateRandomTiles(B9),t=this.calculateMultiplier(r,n,i),o=I(e).mul(t).toFixed(4);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",gameId:"KENO",currency:a.currency,amount:e,payout:o,afterBalance:"1000",multiplier:t.toString(),tenantUserId:"mock-user",clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{KENO:{selectedNumbers:r,riskLevel:i}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{data:{KENO:{result:n}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:o}]}}}static generateRandomTiles(a,e=[]){let i=Array.from({length:js},(r,n)=>n).filter((r)=>!e.includes(r));return[...i].sort(()=>0.5-Math.random()).slice(0,Math.min(a,i.length))}calculateMultiplier(a,e,i){let r=a.filter((l)=>e.includes(l)).length,n=a.length,t=A1.configs(this.edge)[n-1].payout;if(!t)return 0;let o=t[i];if(!o||r>=o.length)return 0;return o[r]||0}}var qs=E`
11718
11718
  :host {
11719
11719
  height: 100%;
11720
11720
  }
@@ -11943,7 +11943,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11943
11943
  >
11944
11944
  ${!this.multiplierInputFocused?x`
11945
11945
  <lottie-icon
11946
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
11946
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
11947
11947
  trigger-selector="origami-input"
11948
11948
  size="16px"
11949
11949
  slot="right-icon"
@@ -11966,7 +11966,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
11966
11966
  >
11967
11967
  ${!this.winChanceInputFocused?x`
11968
11968
  <lottie-icon
11969
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
11969
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
11970
11970
  trigger-selector="origami-input"
11971
11971
  size="16px"
11972
11972
  slot="right-icon"
@@ -12185,7 +12185,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
12185
12185
  ></origami-game-win-popup>
12186
12186
  `:C}
12187
12187
  </origami-game-layout>
12188
- `}}h([q()],K2.prototype,"minesCount",void 0),h([q()],K2.prototype,"autobetSelectedTiles",void 0),h([q()],K2.prototype,"minesData",void 0),h([q()],K2.prototype,"isLoading",void 0),h([q()],K2.prototype,"isSelectingRandomTile",void 0),h([q()],K2.prototype,"isCheckingForSession",void 0),h([q()],K2.prototype,"loadingTiles",void 0),h([aa("origami-mines-manual")],K2.prototype,"_minesManualEl",void 0),h([aa("origami-mines-auto")],K2.prototype,"_minesAutoEl",void 0),h([pa("manualOrAuto")],K2.prototype,"onManualOrAutoChange",null),h([pa("minesCount")],K2.prototype,"onMinesCountChange",null),h([pa("autobetInProgress")],K2.prototype,"onAutobetChange",null),K2=h([F("origami-mines-game")],K2);class Xt{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/diamonds"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class Nt{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e}=a,i=7,r=Array.from({length:5},()=>Math.floor(Math.random()*7)),n=zl(this.edge,r),t=I(e).mul(n).toString(),o={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"diamonds",currency:a.currency,amount:e,payout:t,afterBalance:"1000",multiplier:n.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{DIAMONDS:{}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{id:crypto.randomUUID(),data:{DIAMONDS:{result:r}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:t}]};return await Aa(0),{success:!0,data:o}}}var Cs=E`
12188
+ `}}h([q()],K2.prototype,"minesCount",void 0),h([q()],K2.prototype,"autobetSelectedTiles",void 0),h([q()],K2.prototype,"minesData",void 0),h([q()],K2.prototype,"isLoading",void 0),h([q()],K2.prototype,"isSelectingRandomTile",void 0),h([q()],K2.prototype,"isCheckingForSession",void 0),h([q()],K2.prototype,"loadingTiles",void 0),h([aa("origami-mines-manual")],K2.prototype,"_minesManualEl",void 0),h([aa("origami-mines-auto")],K2.prototype,"_minesAutoEl",void 0),h([pa("manualOrAuto")],K2.prototype,"onManualOrAutoChange",null),h([pa("minesCount")],K2.prototype,"onMinesCountChange",null),h([pa("autobetInProgress")],K2.prototype,"onAutobetChange",null),K2=h([F("origami-mines-game")],K2);class Xt{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/diamonds"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class Nt{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e}=a,i=7,r=Array.from({length:5},()=>Math.floor(Math.random()*7)),n=zl(this.edge,r),t=I(e).mul(n).toString(),o={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"diamonds",currency:a.currency,amount:e,payout:t,afterBalance:"1000",multiplier:n.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{DIAMONDS:{}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{data:{DIAMONDS:{result:r}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:t}]};return await Aa(0),{success:!0,data:o}}}var Cs=E`
12189
12189
  :host {
12190
12190
  width: 100%;
12191
12191
  height: 100%;
@@ -12312,7 +12312,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
12312
12312
  <span class="value">${t}</span>
12313
12313
  </div>
12314
12314
  <lottie-icon
12315
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
12315
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
12316
12316
  trigger-selector="origami-input"
12317
12317
  size="16px"
12318
12318
  ></lottie-icon>
@@ -12520,7 +12520,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
12520
12520
  .instantReveal=${this.gameData?.instantBetEnabled}
12521
12521
  ></origami-diamonds-content>
12522
12522
  </origami-game-layout>
12523
- `}}h([q()],O2.prototype,"isManualPlaying",void 0),h([q()],O2.prototype,"resultGems",void 0),h([aa("origami-diamonds-manual")],O2.prototype,"_diamondsManualEl",void 0),h([aa("origami-diamonds-auto")],O2.prototype,"_diamondsAutoEl",void 0),O2=h([F("origami-diamonds-game")],O2);class e3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/wheel"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{riskLevel:a.riskLevel,segments:a.segments},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class i3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,riskLevel:i,segments:r}=a,t=ye(this.edge)[i][r];if(!t)throw new Error(`No multiplier configuration found for ${r} segments at edge ${this.edge}`);let o=Math.floor(Math.random()*r),s=xe(r,i)[o],d=t[s],c=I(d??0),m=I(e).mul(c).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"wheel",currency:a.currency,amount:e,payout:m,afterBalance:"1000",multiplier:c.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{WHEEL:{riskLevel:a.riskLevel,segments:a.segments}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{id:crypto.randomUUID(),data:{WHEEL:{result:[o]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:m}]}}}}var $s=E`
12523
+ `}}h([q()],O2.prototype,"isManualPlaying",void 0),h([q()],O2.prototype,"resultGems",void 0),h([aa("origami-diamonds-manual")],O2.prototype,"_diamondsManualEl",void 0),h([aa("origami-diamonds-auto")],O2.prototype,"_diamondsAutoEl",void 0),O2=h([F("origami-diamonds-game")],O2);class e3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/wheel"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{riskLevel:a.riskLevel,segments:a.segments},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class i3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,riskLevel:i,segments:r}=a,t=ye(this.edge)[i][r];if(!t)throw new Error(`No multiplier configuration found for ${r} segments at edge ${this.edge}`);let o=Math.floor(Math.random()*r),s=xe(r,i)[o],d=t[s],c=I(d??0),m=I(e).mul(c).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"wheel",currency:a.currency,amount:e,payout:m,afterBalance:"1000",multiplier:c.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{WHEEL:{riskLevel:a.riskLevel,segments:a.segments}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{data:{WHEEL:{result:[o]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:m}]}}}}var $s=E`
12524
12524
  :host {
12525
12525
  width: 100%;
12526
12526
  height: 100%;
@@ -12706,7 +12706,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
12706
12706
  <span class="value">${o}</span>
12707
12707
  </div>
12708
12708
  <lottie-icon
12709
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
12709
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
12710
12710
  trigger-selector=".info-item"
12711
12711
  size="16px"
12712
12712
  ></lottie-icon>
@@ -12928,7 +12928,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
12928
12928
  .resultSegment=${this.resultSegment}
12929
12929
  ></origami-wheel-layout>
12930
12930
  </origami-game-layout>
12931
- `}}h([q()],j2.prototype,"isManualPlaying",void 0),h([q()],j2.prototype,"history",void 0),h([q()],j2.prototype,"wheelRisk",void 0),h([q()],j2.prototype,"numberOfSegments",void 0),h([q()],j2.prototype,"targetAngle",void 0),h([q()],j2.prototype,"resultSegment",void 0),h([q()],j2.prototype,"isWheelSpinning",void 0),h([aa("origami-wheel-manual")],j2.prototype,"_wheelManualEl",void 0),h([aa("origami-wheel-auto")],j2.prototype,"_wheelAutoEl",void 0),j2=h([F("origami-wheel-game")],j2);class l3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/plinko"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{riskLevel:a.riskLevel,numberOfRows:a.rowCount},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class s3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,currency:i,riskLevel:r,rowCount:n}=a,t=zn[this.edge][r][n],o=Array.from({length:n},()=>Math.random()<0.5?0:1),l=o.reduce((m,u)=>m+u,0),s=t[l]??0,d=I(e).mul(s).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"PLINKO",currency:i,amount:e,payout:d,afterBalance:"1000",multiplier:s.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{PLINKO:{riskLevel:r,numberOfRows:n}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{id:crypto.randomUUID(),data:{PLINKO:{result:o}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:d}]}}}}var Ds=E`
12931
+ `}}h([q()],j2.prototype,"isManualPlaying",void 0),h([q()],j2.prototype,"history",void 0),h([q()],j2.prototype,"wheelRisk",void 0),h([q()],j2.prototype,"numberOfSegments",void 0),h([q()],j2.prototype,"targetAngle",void 0),h([q()],j2.prototype,"resultSegment",void 0),h([q()],j2.prototype,"isWheelSpinning",void 0),h([aa("origami-wheel-manual")],j2.prototype,"_wheelManualEl",void 0),h([aa("origami-wheel-auto")],j2.prototype,"_wheelAutoEl",void 0),j2=h([F("origami-wheel-game")],j2);class l3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/plinko"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:{riskLevel:a.riskLevel,numberOfRows:a.rowCount},meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class s3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,currency:i,riskLevel:r,rowCount:n}=a,t=zn[this.edge][r][n],o=Array.from({length:n},()=>Math.random()<0.5?0:1),l=o.reduce((m,u)=>m+u,0),s=t[l]??0,d=I(e).mul(s).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"PLINKO",currency:i,amount:e,payout:d,afterBalance:"1000",multiplier:s.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{PLINKO:{riskLevel:r,numberOfRows:n}},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{data:{PLINKO:{result:o}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:d}]}}}}var Ds=E`
12932
12932
  :host {
12933
12933
  width: 100%;
12934
12934
  height: 100%;
@@ -13435,7 +13435,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
13435
13435
  @input-change=${(i)=>{this.setMultiplierValue(i.detail.value)}}
13436
13436
  >
13437
13437
  ${!this._multiplierFocused?x`<lottie-icon
13438
- src="https://lottie.host/75ca567f-47de-40d3-8807-4a49beec04e0/Xl3aeOdNkj.json"
13438
+ src="https://assets.betorigami.com/games/animations/multi_icon.json"
13439
13439
  trigger-selector="origami-input"
13440
13440
  size="16px"
13441
13441
  slot="right-icon"
@@ -13458,7 +13458,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
13458
13458
  >
13459
13459
  ${!this._winChanceFocused?x`
13460
13460
  <lottie-icon
13461
- src="https://lottie.host/f290f61a-9696-41b5-be7e-6f56c3263257/DlD5UnxyFJ.json"
13461
+ src="https://assets.betorigami.com/games/animations/percentage_symbol.json"
13462
13462
  trigger-selector="origami-input"
13463
13463
  size="16px"
13464
13464
  slot="right-icon"
@@ -13616,7 +13616,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
13616
13616
  ?readonly=${!0}
13617
13617
  >
13618
13618
  <lottie-icon
13619
- src="https://lottie.host/65fba0ab-d299-4515-9860-1a6eab412e57/bEsSyk68LG.json"
13619
+ src="https://assets.betorigami.com/games/animations/payout_icon.json"
13620
13620
  trigger-selector="origami-input"
13621
13621
  size="16px"
13622
13622
  slot="right-icon"
@@ -13775,7 +13775,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
13775
13775
  grid-template-columns: 1fr 1fr;
13776
13776
  gap: 8px;
13777
13777
  }
13778
- `;var ru=(a,e)=>{return Math.floor(Math.random()*(e-a+1))+a};class b3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,gameInputs:i}=a,r=ru(mi,Ra),n=D1[i.mode],t,o;if(i.mode==="ROLL_BETWEEN_TWO")t=i.firstBounds,o=i.secondBounds;else t=i.bounds;let{winChancePercent:l,isWin:s}=n.evaluateOutcome(t,o,r),d=I(l).eq(0)?I(0):I(100-this.edge).div(l).round(4),c=s?d:I(0),m=I(e).mul(c).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",gameId:"ADVANCED_DICE",currency:a.currency??wa,amount:e,payout:m,afterBalance:"1000",multiplier:c.toString(),tenantUserId:"mock-user",clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{ADVANCED_DICE:i},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{id:crypto.randomUUID(),data:{ADVANCED_DICE:{result:[r]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:m}]}}}}class z3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/advanced-dice"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:a.gameInputs,meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class _e extends xa{static styles=[...xa.styles,a6];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}static ROLL_TYPE_ORDER=["ROLL_BETWEEN","ROLL_OUTSIDE","ROLL_BETWEEN_TWO"];constructor(){super();this.isManualPlaying=!1;this.showDice=!1;this.isWin=!0;this.resultValue=null;this.history=[];this.rollType="ROLL_BETWEEN";this.bounds={lower:2500,upper:7500};this.secondBounds={lower:6250,upper:8750};this._multiplierInputValid=!0;this._winChanceInputValid=!0;this._boundsInputValid=!0;new qa(this,[{key:" ",callback:()=>ba.clickBetButton(this.manualOrAuto,this._diceManualEl,this._diceAutoEl),options:{repeat:!0,repeatInterval:200,disabled:()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;return ba.isBetButtonDisabled(this.manualOrAuto,this._diceManualEl,this._diceAutoEl)}}},{key:"q",callback:l1(()=>this.gameData,this.cycleRollType.bind(this)),options:{disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}}])}cycleRollType(){let e=(_e.ROLL_TYPE_ORDER.indexOf(this.rollType)+1)%_e.ROLL_TYPE_ORDER.length;this.handleRollTypeChange(_e.ROLL_TYPE_ORDER[e])}get advancedDiceApi(){return this.isDemoMode?new b3(this.gameData.edge):new z3(this.gameData.authToken,this.gameData.baseUrl)}buildGameInputs(){switch(this.rollType){case"ROLL_BETWEEN":return{mode:"ROLL_BETWEEN",bounds:this.bounds};case"ROLL_OUTSIDE":return{mode:"ROLL_OUTSIDE",bounds:this.bounds};case"ROLL_BETWEEN_TWO":return{mode:"ROLL_BETWEEN_TWO",firstBounds:this.bounds,secondBounds:this.secondBounds}}}calculateWinChance(){return D1[this.rollType].calculateWinChance(this.bounds,this.secondBounds)}calculateMultiplier(){let a=this.calculateWinChance();return ka.calculateMultiplier(a,this.gameData.edge)}isValidWinChance(){let a=this.calculateWinChance(),e=ka.getMaxWinChance(this.gameData.edge,this.gameData.advancedDiceMinMultiplier);return a>=u1&&a<=e}async dicePlay(){this.isManualPlaying=!0,this.showDice=!1,await this.handleBetExecution(this.gameData.betAmount),this.isManualPlaying=!1}async handleBetExecution(a,e){if(!this.gameData.currency)throw new Error(R("alerts.gameError",this.gameData?.language||W));let i=this.buildGameInputs(),r={language:this.gameData.language,amount:a,currency:this.gameData.currency,gameInputs:i,meta:e?Ba(e):void 0},n;if(this.isDemoMode&&I(this.gameData.balance).lt(r.amount))n={success:!1,error:R("alerts.insufficientBalance",this.gameData?.language||"en")};else n=await this.advancedDiceApi.startBet(r);if(n.success){if(!this.gameData.instantBetEnabled)this.gameData.soundEffects?.play(da.diceRoll());let t=this.isDemoMode?I(this.gameData.balance).minus(n.data.amount??0).plus(n.data.payout??0):I(n.data.afterBalance??0);this.gameData.updateBalance(t),this.showDice=!0;let{betActions:o}=n.data,l=o[o.length-1];if(!l)throw new Error("No action data received");let{result:s}=l.data.ADVANCED_DICE,d=s[0];if(this.resultValue=d,this.isWin=I(n.data.multiplier??0).gt(1),this.isWin)setTimeout(()=>{this.playWinFeedback()},300);this.addToHistory(d/100,this.isWin,n.data.id??""),this.updateHistoryWithBet(n.data)}else if(!e)this.showError(n.error);return n}addToHistory(a,e,i){this.history=[...this.history,{multiplier:a,won:e,id:i}].slice(-5)}async executeAutobet(a,e){let i=await this.handleBetExecution(e,a);if(!i.success)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:i.error||R("alerts.gameError",this.gameData?.language||W)};let r=i.data,n=I(r.payout??0).minus(r.amount??0),t=Ga(Number(r.multiplier));return await this.ensureMinimumDisplayTime(this.isWin,300,300),{pnl:n,gameOutcome:t,hasError:!1}}handleRollTypeChange(a){this.rollType=a;let e=Jl[a];if(e.bounds)this.bounds={...e.bounds};if(e.firstBounds)this.bounds={...e.firstBounds};if(e.secondBounds)this.secondBounds={...e.secondBounds}}handleBoundsChange(a){if(this.bounds=a.detail.bounds,a.detail.secondBounds)this.secondBounds=a.detail.secondBounds}handleMultiplierInputChange(a){this._multiplierInputValid=ka.isValidMultiplier(a.detail.multiplier,this.gameData.edge,this.gameData.advancedDiceMinMultiplier)}handleWinChanceInputChange(a){this._winChanceInputValid=ka.isValidWinChance(a.detail.winChance,this.gameData.edge,this.gameData.advancedDiceMinMultiplier)}handleBoundsInputValidityChange(a){this._boundsInputValid=a.detail.isValid}render(){let a=this.calculateMultiplier(),e=I(a).mul(this.gameData.betAmount).minus(this.gameData.betAmount).toFixed(4),i=!this._multiplierInputValid||!this._winChanceInputValid||!this._boundsInputValid||!this.isValidWinChance(),r=Va(this.gameData),n=this.gameData.mainWidth>=768;return x`
13778
+ `;var ru=(a,e)=>{return Math.floor(Math.random()*(e-a+1))+a};class b3{edge;constructor(a){this.edge=a}async startBet(a){let{amount:e,gameInputs:i}=a,r=ru(mi,Ra),n=D1[i.mode],t,o;if(i.mode==="ROLL_BETWEEN_TWO")t=i.firstBounds,o=i.secondBounds;else t=i.bounds;let{winChancePercent:l,isWin:s}=n.evaluateOutcome(t,o,r),d=I(l).eq(0)?I(0):I(100-this.edge).div(l).round(4),c=s?d:I(0),m=I(e).mul(c).toString();return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",gameId:"ADVANCED_DICE",currency:a.currency??wa,amount:e,payout:m,afterBalance:"1000",multiplier:c.toString(),tenantUserId:"mock-user",clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{ADVANCED_DICE:i},type:"START_BET",actionIndex:0,betAmount:e,payoutAmount:null},{data:{ADVANCED_DICE:{result:[r]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:m}]}}}}class z3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/advanced-dice"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,amount:a.amount,gameInputs:a.gameInputs,meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}class _e extends xa{static styles=[...xa.styles,a6];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}static ROLL_TYPE_ORDER=["ROLL_BETWEEN","ROLL_OUTSIDE","ROLL_BETWEEN_TWO"];constructor(){super();this.isManualPlaying=!1;this.showDice=!1;this.isWin=!0;this.resultValue=null;this.history=[];this.rollType="ROLL_BETWEEN";this.bounds={lower:2500,upper:7500};this.secondBounds={lower:6250,upper:8750};this._multiplierInputValid=!0;this._winChanceInputValid=!0;this._boundsInputValid=!0;new qa(this,[{key:" ",callback:()=>ba.clickBetButton(this.manualOrAuto,this._diceManualEl,this._diceAutoEl),options:{repeat:!0,repeatInterval:200,disabled:()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;return ba.isBetButtonDisabled(this.manualOrAuto,this._diceManualEl,this._diceAutoEl)}}},{key:"q",callback:l1(()=>this.gameData,this.cycleRollType.bind(this)),options:{disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}}])}cycleRollType(){let e=(_e.ROLL_TYPE_ORDER.indexOf(this.rollType)+1)%_e.ROLL_TYPE_ORDER.length;this.handleRollTypeChange(_e.ROLL_TYPE_ORDER[e])}get advancedDiceApi(){return this.isDemoMode?new b3(this.gameData.edge):new z3(this.gameData.authToken,this.gameData.baseUrl)}buildGameInputs(){switch(this.rollType){case"ROLL_BETWEEN":return{mode:"ROLL_BETWEEN",bounds:this.bounds};case"ROLL_OUTSIDE":return{mode:"ROLL_OUTSIDE",bounds:this.bounds};case"ROLL_BETWEEN_TWO":return{mode:"ROLL_BETWEEN_TWO",firstBounds:this.bounds,secondBounds:this.secondBounds}}}calculateWinChance(){return D1[this.rollType].calculateWinChance(this.bounds,this.secondBounds)}calculateMultiplier(){let a=this.calculateWinChance();return ka.calculateMultiplier(a,this.gameData.edge)}isValidWinChance(){let a=this.calculateWinChance(),e=ka.getMaxWinChance(this.gameData.edge,this.gameData.advancedDiceMinMultiplier);return a>=u1&&a<=e}async dicePlay(){this.isManualPlaying=!0,this.showDice=!1,await this.handleBetExecution(this.gameData.betAmount),this.isManualPlaying=!1}async handleBetExecution(a,e){if(!this.gameData.currency)throw new Error(R("alerts.gameError",this.gameData?.language||W));let i=this.buildGameInputs(),r={language:this.gameData.language,amount:a,currency:this.gameData.currency,gameInputs:i,meta:e?Ba(e):void 0},n;if(this.isDemoMode&&I(this.gameData.balance).lt(r.amount))n={success:!1,error:R("alerts.insufficientBalance",this.gameData?.language||"en")};else n=await this.advancedDiceApi.startBet(r);if(n.success){if(!this.gameData.instantBetEnabled)this.gameData.soundEffects?.play(da.diceRoll());let t=this.isDemoMode?I(this.gameData.balance).minus(n.data.amount??0).plus(n.data.payout??0):I(n.data.afterBalance??0);this.gameData.updateBalance(t),this.showDice=!0;let{betActions:o}=n.data,l=o[o.length-1];if(!l)throw new Error("No action data received");let{result:s}=l.data.ADVANCED_DICE,d=s[0];if(this.resultValue=d,this.isWin=I(n.data.multiplier??0).gt(1),this.isWin)setTimeout(()=>{this.playWinFeedback()},300);this.addToHistory(d/100,this.isWin,n.data.id??""),this.updateHistoryWithBet(n.data)}else if(!e)this.showError(n.error);return n}addToHistory(a,e,i){this.history=[...this.history,{multiplier:a,won:e,id:i}].slice(-5)}async executeAutobet(a,e){let i=await this.handleBetExecution(e,a);if(!i.success)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:i.error||R("alerts.gameError",this.gameData?.language||W)};let r=i.data,n=I(r.payout??0).minus(r.amount??0),t=Ga(Number(r.multiplier));return await this.ensureMinimumDisplayTime(this.isWin,300,300),{pnl:n,gameOutcome:t,hasError:!1}}handleRollTypeChange(a){this.rollType=a;let e=Jl[a];if(e.bounds)this.bounds={...e.bounds};if(e.firstBounds)this.bounds={...e.firstBounds};if(e.secondBounds)this.secondBounds={...e.secondBounds}}handleBoundsChange(a){if(this.bounds=a.detail.bounds,a.detail.secondBounds)this.secondBounds=a.detail.secondBounds}handleMultiplierInputChange(a){this._multiplierInputValid=ka.isValidMultiplier(a.detail.multiplier,this.gameData.edge,this.gameData.advancedDiceMinMultiplier)}handleWinChanceInputChange(a){this._winChanceInputValid=ka.isValidWinChance(a.detail.winChance,this.gameData.edge,this.gameData.advancedDiceMinMultiplier)}handleBoundsInputValidityChange(a){this._boundsInputValid=a.detail.isValid}render(){let a=this.calculateMultiplier(),e=I(a).mul(this.gameData.betAmount).minus(this.gameData.betAmount).toFixed(4),i=!this._multiplierInputValid||!this._winChanceInputValid||!this._boundsInputValid||!this.isValidWinChance(),r=Va(this.gameData),n=this.gameData.mainWidth>=768;return x`
13779
13779
  <origami-game-layout style=${r} .gameType=${"ADVANCED_DICE"} data-is-desktop=${n}>
13780
13780
  <origami-game-sidebar
13781
13781
  data-is-desktop=${n}
@@ -13844,7 +13844,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
13844
13844
  @advanced-dice-bounds-input-validity-change=${this.handleBoundsInputValidityChange}
13845
13845
  ></origami-advanced-dice-content>
13846
13846
  </origami-game-layout>
13847
- `}}h([q()],_e.prototype,"isManualPlaying",void 0),h([q()],_e.prototype,"showDice",void 0),h([q()],_e.prototype,"isWin",void 0),h([q()],_e.prototype,"resultValue",void 0),h([q()],_e.prototype,"history",void 0),h([q()],_e.prototype,"rollType",void 0),h([q()],_e.prototype,"bounds",void 0),h([q()],_e.prototype,"secondBounds",void 0),h([q()],_e.prototype,"_multiplierInputValid",void 0),h([q()],_e.prototype,"_winChanceInputValid",void 0),h([q()],_e.prototype,"_boundsInputValid",void 0),h([aa("origami-advanced-dice-manual")],_e.prototype,"_diceManualEl",void 0),h([aa("origami-advanced-dice-auto")],_e.prototype,"_diceAutoEl",void 0),_e=h([F("origami-advanced-dice-game")],_e);class y3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/roulette"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,gameInputs:a.gameInputs,meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}var nu=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],tu=[3,6,9,12,15,18,21,24,27,30,33,36],ou=[2,5,8,11,14,17,20,23,26,29,32,35],lu=[1,4,7,10,13,16,19,22,25,28,31,34],su=[0,1,2,3,37],e6={straightBets:[],splitBets:[],streetBets:[],cornerBets:[],doubleStreetBets:[],parityBets:[],colorBets:[],halfBets:[],columnBets:[],dozenBets:[]};function hu(a,e,i){let r=I(0);for(let n of e.straightBets)if(n.value===a)r=r.plus(I(n.amount).times(36));for(let n of e.splitBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(18));for(let n of e.streetBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(12));for(let n of e.cornerBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(9));for(let n of e.doubleStreetBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(6));if(i&&"basketBets"in e){for(let n of e.basketBets)if(su.includes(a))r=r.plus(I(n.amount).times(7))}if(a>=1&&a<=36){for(let n of e.parityBets){let t=a%2===0;if(n.parity==="EVEN"&&t||n.parity==="ODD"&&!t)r=r.plus(I(n.amount).times(2))}for(let n of e.colorBets){let t=nu.includes(a);if(n.color==="RED"&&t||n.color==="BLACK"&&!t)r=r.plus(I(n.amount).times(2))}for(let n of e.halfBets)if(n.half==="LOW"&&a<=18||n.half==="HIGH"&&a>18)r=r.plus(I(n.amount).times(2));for(let n of e.columnBets)if(n.column==="TOP"&&tu.includes(a)||n.column==="MIDDLE"&&ou.includes(a)||n.column==="BOTTOM"&&lu.includes(a))r=r.plus(I(n.amount).times(3));for(let n of e.dozenBets){let t=a>=1&&a<=12,o=a>=13&&a<=24,l=a>=25&&a<=36;if(n.dozen==="FIRST"&&t||n.dozen==="SECOND"&&o||n.dozen==="THIRD"&&l)r=r.plus(I(n.amount).times(3))}}return r}function uu(a,e){let i=I(0);for(let r of a.straightBets)i=i.plus(r.amount);for(let r of a.splitBets)i=i.plus(r.amount);for(let r of a.streetBets)i=i.plus(r.amount);for(let r of a.cornerBets)i=i.plus(r.amount);for(let r of a.doubleStreetBets)i=i.plus(r.amount);for(let r of a.parityBets)i=i.plus(r.amount);for(let r of a.colorBets)i=i.plus(r.amount);for(let r of a.halfBets)i=i.plus(r.amount);for(let r of a.columnBets)i=i.plus(r.amount);for(let r of a.dozenBets)i=i.plus(r.amount);if(e&&"basketBets"in a)for(let r of a.basketBets)i=i.plus(r.amount);return i}class x3{async startBet(a){let{gameInputs:e,currency:i}=a,r=e.type===ua.AMERICAN,n=r?37:36,t=Math.floor(Math.random()*(n+1)),o=e.inputs,l=uu(o,r),s=hu(t,o,r),d=l.gt(0)?s.div(l):I(0);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"ROULETTE",currency:i??wa,amount:l.toString(),payout:s.toString(),afterBalance:"1000",multiplier:d.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),data:{ROULETTE:e},type:"START_BET",actionIndex:0,betAmount:l.toString(),payoutAmount:null},{id:crypto.randomUUID(),data:{ROULETTE:{type:r?"american":"european",betOutcomes:{winningBets:e6,losingBets:e6},result:[t]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:s.toString()}]}}}}var i6=E`
13847
+ `}}h([q()],_e.prototype,"isManualPlaying",void 0),h([q()],_e.prototype,"showDice",void 0),h([q()],_e.prototype,"isWin",void 0),h([q()],_e.prototype,"resultValue",void 0),h([q()],_e.prototype,"history",void 0),h([q()],_e.prototype,"rollType",void 0),h([q()],_e.prototype,"bounds",void 0),h([q()],_e.prototype,"secondBounds",void 0),h([q()],_e.prototype,"_multiplierInputValid",void 0),h([q()],_e.prototype,"_winChanceInputValid",void 0),h([q()],_e.prototype,"_boundsInputValid",void 0),h([aa("origami-advanced-dice-manual")],_e.prototype,"_diceManualEl",void 0),h([aa("origami-advanced-dice-auto")],_e.prototype,"_diceAutoEl",void 0),_e=h([F("origami-advanced-dice-game")],_e);class y3{authToken;baseUrl;constructor(a,e){this.authToken=a,this.baseUrl=e+"/games/roulette"}async startBet(a){try{let e=await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`,"X-Origami-Trace":ja()},body:JSON.stringify({currency:a.currency,gameInputs:a.gameInputs,meta:a.meta})}),i=await e.json();if(e.ok&&!!i.id)return{success:!0,data:i};let r="alerts.gameError";switch(i?.errorCode){case"INSUFFICIENT_BALANCE":r="alerts.insufficientBalance";break;case"LIMIT_REACHED":r="alerts.betLimitReached";break}return{success:!1,error:R(r,a.language)}}catch(e){return{success:!1,error:R("alerts.gameError",a.language)}}}}var nu=[1,3,5,7,9,12,14,16,18,19,21,23,25,27,30,32,34,36],tu=[3,6,9,12,15,18,21,24,27,30,33,36],ou=[2,5,8,11,14,17,20,23,26,29,32,35],lu=[1,4,7,10,13,16,19,22,25,28,31,34],su=[0,1,2,3,37],e6={straightBets:[],splitBets:[],streetBets:[],cornerBets:[],doubleStreetBets:[],parityBets:[],colorBets:[],halfBets:[],columnBets:[],dozenBets:[]};function hu(a,e,i){let r=I(0);for(let n of e.straightBets)if(n.value===a)r=r.plus(I(n.amount).times(36));for(let n of e.splitBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(18));for(let n of e.streetBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(12));for(let n of e.cornerBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(9));for(let n of e.doubleStreetBets)if(n.values.includes(a))r=r.plus(I(n.amount).times(6));if(i&&"basketBets"in e){for(let n of e.basketBets)if(su.includes(a))r=r.plus(I(n.amount).times(7))}if(a>=1&&a<=36){for(let n of e.parityBets){let t=a%2===0;if(n.parity==="EVEN"&&t||n.parity==="ODD"&&!t)r=r.plus(I(n.amount).times(2))}for(let n of e.colorBets){let t=nu.includes(a);if(n.color==="RED"&&t||n.color==="BLACK"&&!t)r=r.plus(I(n.amount).times(2))}for(let n of e.halfBets)if(n.half==="LOW"&&a<=18||n.half==="HIGH"&&a>18)r=r.plus(I(n.amount).times(2));for(let n of e.columnBets)if(n.column==="TOP"&&tu.includes(a)||n.column==="MIDDLE"&&ou.includes(a)||n.column==="BOTTOM"&&lu.includes(a))r=r.plus(I(n.amount).times(3));for(let n of e.dozenBets){let t=a>=1&&a<=12,o=a>=13&&a<=24,l=a>=25&&a<=36;if(n.dozen==="FIRST"&&t||n.dozen==="SECOND"&&o||n.dozen==="THIRD"&&l)r=r.plus(I(n.amount).times(3))}}return r}function uu(a,e){let i=I(0);for(let r of a.straightBets)i=i.plus(r.amount);for(let r of a.splitBets)i=i.plus(r.amount);for(let r of a.streetBets)i=i.plus(r.amount);for(let r of a.cornerBets)i=i.plus(r.amount);for(let r of a.doubleStreetBets)i=i.plus(r.amount);for(let r of a.parityBets)i=i.plus(r.amount);for(let r of a.colorBets)i=i.plus(r.amount);for(let r of a.halfBets)i=i.plus(r.amount);for(let r of a.columnBets)i=i.plus(r.amount);for(let r of a.dozenBets)i=i.plus(r.amount);if(e&&"basketBets"in a)for(let r of a.basketBets)i=i.plus(r.amount);return i}class x3{async startBet(a){let{gameInputs:e,currency:i}=a,r=e.type===ua.AMERICAN,n=r?37:36,t=Math.floor(Math.random()*(n+1)),o=e.inputs,l=uu(o,r),s=hu(t,o,r),d=l.gt(0)?s.div(l):I(0);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"ROULETTE",currency:i??wa,amount:l.toString(),payout:s.toString(),afterBalance:"1000",multiplier:d.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{data:{ROULETTE:e},type:"START_BET",actionIndex:0,betAmount:l.toString(),payoutAmount:null},{data:{ROULETTE:{type:r?"american":"european",betOutcomes:{winningBets:e6,losingBets:e6},result:[t]}},type:"END_BET",actionIndex:1,betAmount:null,payoutAmount:s.toString()}]}}}}var i6=E`
13848
13848
  :host {
13849
13849
  display: block;
13850
13850
  width: 100%;
@@ -16136,7 +16136,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
16136
16136
  :host {
16137
16137
  height: 100%;
16138
16138
  }
16139
- `;var p6=()=>({getRandomInt:({min:a,max:e})=>{let i=Math.floor(Math.random()*(e-a+1))+a;return{value:i,values:[i],count:1,min:a,max:e,proofHash:"mock",proofString:"mock"}},getUniqueRandomInts:({min:a,max:e,count:i})=>{let r=[];while(r.length<i){let n=Math.floor(Math.random()*(e-a+1))+a;if(!r.includes(n))r.push(n)}return{values:r,count:i,min:a,max:e,proofHash:"mock",proofString:"mock"}},getRandomIntsWithReplacement:({min:a,max:e,count:i})=>{return{values:Array.from({length:i},()=>Math.floor(Math.random()*(e-a+1))+a),count:i,min:a,max:e,proofHash:"mock",proofString:"mock"}}}),F3=(a)=>{let e=0,i=(r)=>{let n=[];for(let t=0;t<r;t++){if(e>=a.length)throw new Error("Random sequence exhausted - not enough values provided for this action");n.push(a[e]),e++}return n};return{getRandomInt:({min:r,max:n})=>{let t=i(1);return{value:t[0],values:t,count:1,min:r,max:n,proofHash:"mock",proofString:"mock"}},getUniqueRandomInts:({min:r,max:n,count:t})=>{return{values:i(t),count:t,min:r,max:n,proofHash:"mock",proofString:"mock"}},getRandomIntsWithReplacement:({min:r,max:n,count:t})=>{return{values:i(t),count:t,min:r,max:n,proofHash:"mock",proofString:"mock"}}}};class J3{async startBet(a){let{amount:e,selections:i}=a,r={bets:i.map((d)=>({type:d.position,amount:I(d.amount)}))},t=new Jn().getGameResult({generator:p6(),edge:1,gameInputs:r}),o=Fn(r),l=o.mul(t.payoutMultiplier);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"baccarat",currency:a.currency??"USD",amount:o.toString(),payout:l.toString(),afterBalance:"1000",multiplier:t.payoutMultiplier.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{id:crypto.randomUUID(),type:"START_BET",betAmount:e,payoutAmount:null,actionIndex:0,data:{BACCARAT:r}},{id:crypto.randomUUID(),type:"END_BET",betAmount:null,payoutAmount:l.toString(),actionIndex:1,data:{BACCARAT:t.outputs}}]}}}}class C2 extends ai{static styles=[...ai.styles,m6];constructor(){super();this.isManualPlaying=!1;this.resultMultiplier=null;this.history=[];this.gameWinPopupShowing=!1;this.payout=null;this.instantModeForCurrentBet=!1;this.slowRevealEnabled=!1;this.currentRound=null;new qa(this,[...this.getChipTableHotkeys(()=>this._baccaratManualEl,()=>this._baccaratAutoEl),{key:"p",callback:()=>this.handleChipInteraction("PLAYER"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}},{key:"b",callback:()=>this.handleChipInteraction("BANKER"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}},{key:"t",callback:()=>this.handleChipInteraction("TIE"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}}])}get baccaratApi(){return this.isDemoMode?new J3:new M3(this.gameData.authToken,this.gameData.baseUrl??"")}get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get isSlowRevealActive(){return this.slowRevealEnabled&&this.manualOrAuto==="Manual"&&!this.instantModeForCurrentBet}isMaxPayoutExceeded(a){let e=d1.deriveState(a,I(this.gameData?.maxBet??0));return Ma.getMaxPossiblePayoutFromChips(e).gt(this.gameData?.maxPayout??0)}handleGridClick=(a)=>{let{position:e,remove:i}=a.detail;this.handleChipInteraction(e,!!i)};handleSlowRevealChange=(a)=>{this.slowRevealEnabled=a.detail.enabled};resetRound(){this.currentRound=null,this.resultMultiplier=null,this.gameWinPopupShowing=!1,this.payout=null}onManualOrAutoChange(){this.resetRound()}addToHistory(a,e,i){this.history=[...this.history.filter((r)=>r.id!==i),{multiplier:a,won:e,id:i}].slice(-C5)}onDealSound=()=>{this.gameData?.soundEffects?.play(da.cardSlide())};onCardFlip=()=>{this.gameData?.soundEffects?.play(da.cardFlip())};async processBetResult(a,e,i){let n=a.betActions.find((d)=>d.type==="END_BET")?.data.BACCARAT;if(!n)throw new Error("No baccarat data found");let t=Ma.createGameRound(a,n);this.currentRound=t,await M1(this,"baccarat-dealing-complete",()=>!0,this.isSlowRevealActive?void 0:E5);let o=this.isDemoMode?e.minus(i).plus(a.payout??0):I(a.afterBalance??0);this.gameData.updateBalance(o);let l=t.multiplier,s=l>=1;if(this.resultMultiplier=l,this.betId=t.betId,this.payout=t.payout,this.gameWinPopupShowing=s,l>1)this.playWinFeedback();this.addToHistory(l,s,t.betId),this.updateHistoryWithBet(a)}async handleBetExecution(){if(this.instantModeForCurrentBet=this.gameData?.instantBetEnabled??!1,!this.gameData?.currency)return{success:!1,error:R("alerts.gameError",this.gameData?.language||W)};if(this.derivedChips.size===0)return{success:!1,error:R("games.baccarat.selectChip",this.gameData?.language||W)};if(this.isMaxPayoutExceeded(this.chipEvents))return{success:!1,error:R("alerts.maxPayoutExceeded",this.gameData?.language||W)};let{selections:a,totalAmount:e}=Ma.buildSelectionsAndTotal(this.derivedChips),i=e.toFixed(8);this.currentRound=null,this.resultMultiplier=null,this.gameWinPopupShowing=!1,this.payout=null;let r=I(this.gameData.balance);try{if(this.isDemoMode&&r.lt(e))return{success:!1,error:R("alerts.insufficientBalance",this.gameData?.language||W)};this.gameData.updateBalance(r.minus(e));let n=await this.baccaratApi.startBet({language:this.gameData.language,amount:i,currency:this.gameData.currency,selections:a});if(!n.success)throw new Error(n.error);return await this.processBetResult(n.data,r,e),n}catch(n){return{success:!1,error:n instanceof Error?n.message:R("alerts.gameError",this.gameData?.language||W)}}}async toggleAutobet(a){if(this.derivedChips.size===0){this.emit("show-alert",{detail:{type:"error",message:R("games.baccarat.selectChip",this.gameData?.language||W)}});return}if(!this.autobetInProgress)this.emit("show-alert",{detail:{id:"autobet-started",type:"info",message:R("autobet.startAutobet",this.gameData?.language||W),autoCloseDelay:5000}});await super.toggleAutobet(a)}async baccaratPlay(){if(this.gameWinPopupShowing=!1,this.derivedChips.size===0){this.emit("show-alert",{detail:{type:"error",message:R("games.baccarat.selectChip",this.gameData?.language||W)}});return}this.isManualPlaying=!0;let a=await this.handleBetExecution();if(!a.success)this.showError(a.error);this.isManualPlaying=!1}async executeAutobet(a,e){try{if(this.gameWinPopupShowing=!1,this.derivedChips.size===0)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("games.baccarat.selectChip",this.gameData?.language||W)};let i=await this.handleBetExecution();if(!i.success)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:i.error||R("alerts.errorProcessingBet",this.gameData?.language||W)};let r=i.data,n=I(r.payout??0).minus(r.amount??0),t=Ga(Number(r.multiplier));if(!this.instantModeForCurrentBet){if(await Aa(this.getDelay(200)),t==="Win")await Aa(this.getDelay(150));await Aa(300)}return this.gameWinPopupShowing=!1,{pnl:n,gameOutcome:t,hasError:!1}}catch(i){return console.error("Error in executeAutobet:",i),{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("alerts.gameError",this.gameData?.language||W)}}}render(){let a=this.gameData?.mainWidth>=768,e=Va(this.gameData),i=this.totalBetAmount===0;return x`
16139
+ `;var p6=()=>({getRandomInt:({min:a,max:e})=>{let i=Math.floor(Math.random()*(e-a+1))+a;return{value:i,values:[i],count:1,min:a,max:e,proofHash:"mock",proofString:"mock"}},getUniqueRandomInts:({min:a,max:e,count:i})=>{let r=[];while(r.length<i){let n=Math.floor(Math.random()*(e-a+1))+a;if(!r.includes(n))r.push(n)}return{values:r,count:i,min:a,max:e,proofHash:"mock",proofString:"mock"}},getRandomIntsWithReplacement:({min:a,max:e,count:i})=>{return{values:Array.from({length:i},()=>Math.floor(Math.random()*(e-a+1))+a),count:i,min:a,max:e,proofHash:"mock",proofString:"mock"}}}),F3=(a)=>{let e=0,i=(r)=>{let n=[];for(let t=0;t<r;t++){if(e>=a.length)throw new Error("Random sequence exhausted - not enough values provided for this action");n.push(a[e]),e++}return n};return{getRandomInt:({min:r,max:n})=>{let t=i(1);return{value:t[0],values:t,count:1,min:r,max:n,proofHash:"mock",proofString:"mock"}},getUniqueRandomInts:({min:r,max:n,count:t})=>{return{values:i(t),count:t,min:r,max:n,proofHash:"mock",proofString:"mock"}},getRandomIntsWithReplacement:({min:r,max:n,count:t})=>{return{values:i(t),count:t,min:r,max:n,proofHash:"mock",proofString:"mock"}}}};class J3{async startBet(a){let{amount:e,selections:i}=a,r={bets:i.map((d)=>({type:d.position,amount:I(d.amount)}))},t=new Jn().getGameResult({generator:p6(),edge:1,gameInputs:r}),o=Fn(r),l=o.mul(t.payoutMultiplier);return{success:!0,data:{id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:"baccarat",currency:a.currency??"USD",amount:o.toString(),payout:l.toString(),afterBalance:"1000",multiplier:t.payoutMultiplier.toString(),clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:1,betActions:[{type:"START_BET",betAmount:e,payoutAmount:null,actionIndex:0,data:{BACCARAT:r}},{type:"END_BET",betAmount:null,payoutAmount:l.toString(),actionIndex:1,data:{BACCARAT:t.outputs}}]}}}}class C2 extends ai{static styles=[...ai.styles,m6];constructor(){super();this.isManualPlaying=!1;this.resultMultiplier=null;this.history=[];this.gameWinPopupShowing=!1;this.payout=null;this.instantModeForCurrentBet=!1;this.slowRevealEnabled=!1;this.currentRound=null;new qa(this,[...this.getChipTableHotkeys(()=>this._baccaratManualEl,()=>this._baccaratAutoEl),{key:"p",callback:()=>this.handleChipInteraction("PLAYER"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}},{key:"b",callback:()=>this.handleChipInteraction("BANKER"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}},{key:"t",callback:()=>this.handleChipInteraction("TIE"),options:{repeat:!0,repeatInterval:200,disabled:()=>this.areInputsDisabled||!this.gameData?.hotkeysOpenEnabled}}])}get baccaratApi(){return this.isDemoMode?new J3:new M3(this.gameData.authToken,this.gameData.baseUrl??"")}get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get isSlowRevealActive(){return this.slowRevealEnabled&&this.manualOrAuto==="Manual"&&!this.instantModeForCurrentBet}isMaxPayoutExceeded(a){let e=d1.deriveState(a,I(this.gameData?.maxBet??0));return Ma.getMaxPossiblePayoutFromChips(e).gt(this.gameData?.maxPayout??0)}handleGridClick=(a)=>{let{position:e,remove:i}=a.detail;this.handleChipInteraction(e,!!i)};handleSlowRevealChange=(a)=>{this.slowRevealEnabled=a.detail.enabled};resetRound(){this.currentRound=null,this.resultMultiplier=null,this.gameWinPopupShowing=!1,this.payout=null}onManualOrAutoChange(){this.resetRound()}addToHistory(a,e,i){this.history=[...this.history.filter((r)=>r.id!==i),{multiplier:a,won:e,id:i}].slice(-C5)}onDealSound=()=>{this.gameData?.soundEffects?.play(da.cardSlide())};onCardFlip=()=>{this.gameData?.soundEffects?.play(da.cardFlip())};async processBetResult(a,e,i){let n=a.betActions.find((d)=>d.type==="END_BET")?.data.BACCARAT;if(!n)throw new Error("No baccarat data found");let t=Ma.createGameRound(a,n);this.currentRound=t,await M1(this,"baccarat-dealing-complete",()=>!0,this.isSlowRevealActive?void 0:E5);let o=this.isDemoMode?e.minus(i).plus(a.payout??0):I(a.afterBalance??0);this.gameData.updateBalance(o);let l=t.multiplier,s=l>=1;if(this.resultMultiplier=l,this.betId=t.betId,this.payout=t.payout,this.gameWinPopupShowing=s,l>1)this.playWinFeedback();this.addToHistory(l,s,t.betId),this.updateHistoryWithBet(a)}async handleBetExecution(){if(this.instantModeForCurrentBet=this.gameData?.instantBetEnabled??!1,!this.gameData?.currency)return{success:!1,error:R("alerts.gameError",this.gameData?.language||W)};if(this.derivedChips.size===0)return{success:!1,error:R("games.baccarat.selectChip",this.gameData?.language||W)};if(this.isMaxPayoutExceeded(this.chipEvents))return{success:!1,error:R("alerts.maxPayoutExceeded",this.gameData?.language||W)};let{selections:a,totalAmount:e}=Ma.buildSelectionsAndTotal(this.derivedChips),i=e.toFixed(8);this.currentRound=null,this.resultMultiplier=null,this.gameWinPopupShowing=!1,this.payout=null;let r=I(this.gameData.balance);try{if(this.isDemoMode&&r.lt(e))return{success:!1,error:R("alerts.insufficientBalance",this.gameData?.language||W)};this.gameData.updateBalance(r.minus(e));let n=await this.baccaratApi.startBet({language:this.gameData.language,amount:i,currency:this.gameData.currency,selections:a});if(!n.success)throw new Error(n.error);return await this.processBetResult(n.data,r,e),n}catch(n){return{success:!1,error:n instanceof Error?n.message:R("alerts.gameError",this.gameData?.language||W)}}}async toggleAutobet(a){if(this.derivedChips.size===0){this.emit("show-alert",{detail:{type:"error",message:R("games.baccarat.selectChip",this.gameData?.language||W)}});return}if(!this.autobetInProgress)this.emit("show-alert",{detail:{id:"autobet-started",type:"info",message:R("autobet.startAutobet",this.gameData?.language||W),autoCloseDelay:5000}});await super.toggleAutobet(a)}async baccaratPlay(){if(this.gameWinPopupShowing=!1,this.derivedChips.size===0){this.emit("show-alert",{detail:{type:"error",message:R("games.baccarat.selectChip",this.gameData?.language||W)}});return}this.isManualPlaying=!0;let a=await this.handleBetExecution();if(!a.success)this.showError(a.error);this.isManualPlaying=!1}async executeAutobet(a,e){try{if(this.gameWinPopupShowing=!1,this.derivedChips.size===0)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("games.baccarat.selectChip",this.gameData?.language||W)};let i=await this.handleBetExecution();if(!i.success)return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:i.error||R("alerts.errorProcessingBet",this.gameData?.language||W)};let r=i.data,n=I(r.payout??0).minus(r.amount??0),t=Ga(Number(r.multiplier));if(!this.instantModeForCurrentBet){if(await Aa(this.getDelay(200)),t==="Win")await Aa(this.getDelay(150));await Aa(300)}return this.gameWinPopupShowing=!1,{pnl:n,gameOutcome:t,hasError:!1}}catch(i){return console.error("Error in executeAutobet:",i),{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("alerts.gameError",this.gameData?.language||W)}}}render(){let a=this.gameData?.mainWidth>=768,e=Va(this.gameData),i=this.totalBetAmount===0;return x`
16140
16140
  <origami-game-layout style=${e} .gameType=${"BACCARAT"} data-is-desktop=${a}>
16141
16141
  <origami-game-sidebar
16142
16142
  slot="control-panel"
@@ -16573,7 +16573,7 @@ var Z6=Object.create;var{getPrototypeOf:O6,defineProperty:N3,getOwnPropertyNames
16573
16573
  :host {
16574
16574
  height: 100%;
16575
16575
  }
16576
- `;class $3{edge=0;currentBalance;activeBet=null;previousPlayResults=[];randomSequence=[];useCustomSequence=!1;amount="0";betCurrency="USD";constructor(a){this.currentBalance=I(a)}setRandomSequence(a){let e=Array.from({length:this.maxRandomValues-a.length},()=>Math.floor(Math.random()*(this.maxRandomValue-this.minRandomValue+1))+this.minRandomValue);this.randomSequence=[...a,...e],this.useCustomSequence=!0}async startGame(a){let e=I(a.amount);if(e.gt(this.currentBalance))return{success:!1,error:"Insufficient balance"};let i=this.currentBalance.minus(e);if(!this.useCustomSequence)this.randomSequence=Array.from({length:this.maxRandomValues},()=>Math.floor(Math.random()*(this.maxRandomValue-this.minRandomValue+1))+this.minRandomValue);this.useCustomSequence=!1,this.amount=a.amount,this.betCurrency=a.currency??"USD";let r=F3(this.randomSequence),t=this.createGameEngine(this.edge).play(r,a.gameInputs,[]);this.previousPlayResults=[t];let o=crypto.randomUUID(),l=this.toActionData(t);if(t.state.isFinished){let d=e.mul(t.state.multiplier),c=i.plus(d);this.currentBalance=c;let m={id:o,tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:this.gameId,currency:this.betCurrency,amount:e.toString(),payout:d.toString(),afterBalance:c.toString(),multiplier:t.state.multiplier.toString(),clientSeed:"mock-seed",randomValue:t.proof.proofHash,proof:t.proof.proofString,nonce:1,betActions:[{id:crypto.randomUUID(),type:"START_BET",betAmount:a.amount,payoutAmount:null,actionIndex:0,data:l},{id:crypto.randomUUID(),type:"END_BET",betAmount:null,payoutAmount:d.toString(),actionIndex:1,data:l}]};return this.clearState(),{success:!0,data:m}}let s={id:o,tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:this.gameId,currency:this.betCurrency,amount:e.toString(),payout:null,afterBalance:i.toString(),multiplier:null,clientSeed:"mock-seed",randomValue:null,proof:null,nonce:1,betActions:[{id:crypto.randomUUID(),type:"START_BET",betAmount:a.amount,payoutAmount:null,actionIndex:0,data:l}]};return this.currentBalance=i,this.activeBet=s,{success:!0,data:s}}async performNextAction(a){if(!this.activeBet)return{success:!1,error:"No active bet"};let e=F3(this.randomSequence),r=this.createGameEngine(this.edge).play(e,a,this.previousPlayResults);this.previousPlayResults=[...this.previousPlayResults,r];let n=this.activeBet,t=[...n.betActions],o=t.length,l=this.toActionData(r),s=r.additionalBetAmount!==void 0,d=s?r.additionalBetAmount:null,c=d!==null?I(this.amount).plus(d):I(this.amount),m=c.mul(r.state.multiplier),u=this.currentBalance;if(s&&d!==null){u=u.minus(d),this.amount=c.toString();let H={id:crypto.randomUUID(),type:"INTERMEDIATE_BET_ACTION",betAmount:d.toString(),payoutAmount:null,actionIndex:o,data:l},z=[...t,H];if(!r.state.isFinished){this.currentBalance=u;let b={...n,amount:c.toString(),afterBalance:u.toString(),betActions:z};return this.activeBet=b,{success:!0,data:b}}let v=u.plus(m);this.currentBalance=v,z.push({id:crypto.randomUUID(),type:"END_BET",betAmount:null,payoutAmount:m.toString(),actionIndex:o+1,data:l});let g={...n,amount:c.toString(),payout:m.toString(),afterBalance:v.toString(),multiplier:r.state.multiplier.toString(),randomValue:r.proof.proofHash,proof:r.proof.proofString,betActions:z};return this.clearState(),{success:!0,data:g}}if(!r.state.isFinished){let H={id:crypto.randomUUID(),type:"INTERMEDIATE_NON_BET_ACTION",betAmount:null,payoutAmount:null,actionIndex:o,data:l},z={...n,afterBalance:u.toString(),betActions:[...t,H]};return this.currentBalance=u,this.activeBet=z,{success:!0,data:z}}let f=u.plus(m);this.currentBalance=f;let k={id:crypto.randomUUID(),type:"END_BET",betAmount:null,payoutAmount:m.toString(),actionIndex:o,data:l},p={...n,payout:m.toString(),afterBalance:f.toString(),multiplier:r.state.multiplier.toString(),randomValue:r.proof.proofHash,proof:r.proof.proofString,betActions:[...t,k]};return this.clearState(),{success:!0,data:p}}async fetchActiveBet(){if(!this.activeBet)return{success:!1,error:"No active bet"};return{success:!0,data:this.activeBet}}clearState(){this.activeBet=null,this.previousPlayResults=[],this.randomSequence=[],this.amount="0"}}var mu=0,pu=51,gu=63;class ei extends $3{static pendingCardSequence=null;gameId="blackjack";maxRandomValues=gu;minRandomValue=mu;maxRandomValue=pu;static setCardSequence(a){ei.pendingCardSequence=[...a]}constructor(a){super(a)}createGameEngine(a){return new er(a)}toActionData(a){return{BLACKJACK:a}}async startBet(a){if(ei.pendingCardSequence!==null)this.setRandomSequence(ei.pendingCardSequence),ei.pendingCardSequence=null;let e=a.mainBetAmount,i=a.pairBonusAmount??"0",r=a.threeCardBonusAmount??"0",n=I(e).plus(i).plus(r),t=await this.startGame({amount:n.toString(),currency:a.currency??"USD",gameInputs:{type:Za.START,mainBetAmount:e,pairBonusAmount:i,threeCardBonusAmount:r}});if(t.success)return t;return{success:!1,errorCode:t.error==="Insufficient balance"?"INSUFFICIENT_BALANCE":"UNKNOWN"}}async next(a){let e=await this.performNextAction({type:a.type});if(e.success)return e;return{success:!1,errorCode:"UNKNOWN"}}async getActiveBet(){let a=await this.fetchActiveBet();if(a.success)return a;if(a.error==="No active bet")return{success:!0,data:null};return{success:!1,errorCode:"UNKNOWN"}}}var wu=(a)=>{if(typeof a!=="object"||a===null||!("cardId"in a))return!1;return a.cardId===void 0||typeof a.cardId==="string"};class wr{host;constructor(a){this.host=a,a.addController(this)}hostConnected(){}get instantMode(){return this.host.gameData.instantBetEnabled}static BETWEEN_CARD_ACTIONS_PAUSE=120;static DEALER_REVEAL_PAUSE=300;async waitBeforeDealerReveal(){if(this.instantMode)return;if(this.host.visibleState.stage!=="player")return;await Aa(wr.DEALER_REVEAL_PAUSE)}async waitBetweenCardActions(){if(this.instantMode)return;await Aa(wr.BETWEEN_CARD_ACTIONS_PAUSE)}async dealPlayerCard(a,e){let i=this.host.addPlayerCardToHand(a,e);await this.waitForCardDealComplete(i)}async dealDealerCard(a){let e=this.host.addDealerCard(a);await this.waitForCardDealComplete(e)}async revealDealerHoleCard(a){this.host.updateDealerCard(1,a,!1),await this.waitForCardDealComplete("d-1")}async runCardActions(a){for(let e=0;e<a.length;e++){let i=a[e];if(await i(),e<a.length-1)await this.waitBetweenCardActions()}}async playInitialDeal(a,e){if(this.instantMode){this.host.updateVisibleState({playerHands:[a],dealerCards:e});return}let i={...e[1],faceDown:!0};await this.runCardActions([()=>this.dealPlayerCard(0,a[0]),()=>this.dealDealerCard(e[0]),()=>this.dealPlayerCard(0,a[1]),()=>this.dealDealerCard(i)])}async playDealerReveal(a){await this.waitBeforeDealerReveal(),this.host.updateVisibleState({stage:"dealer"}),await this.host.triggerForceUIUpdate();let e=[];if(a[1])e.push(()=>this.revealDealerHoleCard(a[1]));for(let i=2;i<a.length;i++){let r=a[i];e.push(()=>this.dealDealerCard(r))}await this.runCardActions(e)}async playSplitDeal(a,e){await this.dealPlayerCard(0,a),await this.waitBetweenCardActions(),await this.dealPlayerCard(1,e)}async waitForAllCardsToBeIdle(){if(this.instantMode)return;await this.host.triggerForceUIUpdate(),await Aa(50)}waitForCardDealComplete(a){if(this.instantMode)return Promise.resolve();return new Promise((e)=>{let i=!1,r=(n)=>{if(!(n instanceof CustomEvent)||!wu(n.detail)||n.detail.cardId!==a)return;this.host.removeEventListener("blackjack-card-dealt",r),i=!0,e()};this.host.addEventListener("blackjack-card-dealt",r),Aa(2000).then(()=>{if(i)return;this.host.removeEventListener("blackjack-card-dealt",r),e()})})}}var ku=5,I6="origami-blackjack-sidebet-onboarded";class W2 extends xa{static styles=[...xa.styles,S6];currentBetId=null;currentMainBetAmount="0";animationController;actionHandlers;betController;hasTrackedSessionConfig=!1;previousAuthToken="";previousBaseUrl="";get activeHand(){return this.visibleState.playerHands[this.visibleState.activeHandIndex]??[]}get playerHandsForContent(){return this.visibleState.playerHands}get activeHandIndexForContent(){return this.visibleState.activeHandIndex}get isGameActive(){return this.visibleState.stage!=="idle"&&this.visibleState.stage!=="settled"}get isToggleDisabled(){return this.visibleState.isActing||this.autobetInProgress||this.autobetStopping||this.isGameActive}get areInputsDisabled(){return this.visibleState.isActing||this.autobetInProgress||this.autobetStopping||this.controlsLocked}get totalBetExceedsBalance(){if(!this.gameData?.hasLoadedBalance)return!1;let a=this.gameData.betAmount??"0",e=this.sideBetMode?this.pairBonusAmount:"0",i=this.sideBetMode?this.threeCardBonusAmount:"0";if(![a,e,i].every(fa))return!1;return I(a).plus(e).plus(i).gt(I(this.gameData.balance??0))}get sidebarMode(){return this.sideBetMode||this.showSideBetOnboarding?"Auto":"Manual"}_getBlackjackApi=U1(()=>this.gameData,()=>this.isDemoMode,{createReal:(a,e)=>new P3(a,e),createMock:()=>new ei(this.gameData.balance)});getBlackjackApi(){return this._getBlackjackApi()}constructor(){super();this.canonicalState=null;this.visibleState=hr();this.history=[];this.controlsLocked=!1;this._loadingAction=null;this.suppressNextContentAnimations=!1;this.sideBetMode=!1;this.pairBonusAmount="0";this.threeCardBonusAmount="0";this.sideBetResults=null;this.showSideBetOnboarding=!1;this.animationController=new wr(this),this.actionHandlers=new W3(this,this.animationController),this.betController=new E3(this,this.animationController),new qa(this,[{key:" ",callback:this.handleSpacebar,options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}},{key:"q",callback:this.handleHit,options:{disabled:this.isHitDisabled}},{key:"w",callback:this.handleStand,options:{disabled:this.isStandDisabled}},{key:"e",callback:this.handleSplit,options:{disabled:this.isSplitDisabled}},{key:"r",callback:this.handleDoubleDown,options:{disabled:this.isDoubleDisabled}},{key:"t",callback:this.handleAcceptInsurance,options:{disabled:this.isAcceptInsuranceDisabled}},{key:"y",callback:this.handleNoInsurance,options:{disabled:this.isNoInsuranceDisabled}}])}setCanonicalState(a){this.canonicalState=a}setVisibleState(a){this.visibleState=a}updateVisibleState(a){this.visibleState={...this.visibleState,...a}}addToHistory(a,e,i){this.history=[...this.history,{multiplier:a,won:e,id:i}].slice(-ku)}async withOptimisticBalanceDeduction(a,e){let i=I(this.gameData.balance);this.gameData.updateBalance(i.minus(a));try{let r=await e();if(r===null)this.gameData.updateBalance(i);return r}catch(r){throw this.gameData.updateBalance(i),r}}async runWithLockedControls(a,e){this.controlsLocked=!0,this._loadingAction=e??null;try{await a()}finally{this.controlsLocked=!1,this._loadingAction=null}}async firstUpdated(a){super.firstUpdated(a),await this.getBlackjackActiveBet()}updated(a){super.updated(a);let e=this.gameData.authToken,i=this.gameData.baseUrl;if(!this.hasTrackedSessionConfig){this.previousAuthToken=e,this.previousBaseUrl=i,this.hasTrackedSessionConfig=!0;return}if(e===this.previousAuthToken&&i===this.previousBaseUrl)return;let r=Boolean(this.previousAuthToken)&&Boolean(this.previousBaseUrl),n=Boolean(e)&&Boolean(i);if(this.previousAuthToken=e,this.previousBaseUrl=i,!r&&!n)return;this.getBlackjackActiveBet()}async getBlackjackActiveBet(){let a=!1;try{let e=await this.getBlackjackApi().getActiveBet();if(!e.success)return;if(e.data===null){this.currentBetId=null,this.canonicalState=null,this.sideBetResults=null,this.setVisibleState(hr());return}this.currentBetId=e.data.id;let i=ur(e.data);if(!i)return;this.canonicalState=i,this.suppressNextContentAnimations=!0,a=!0,this.setVisibleState(ls(i)),this.sideBetResults=Ai(i),await this.forceUIUpdate()}catch{this.showError(R("alerts.gameError",this.gameData.language||W))}finally{if(a)this.suppressNextContentAnimations=!1}}addPlayerCardToHand(a,e){let i=this.visibleState.playerHands.map((r,n)=>n===a?[...r,e]:r);return this.visibleState={...this.visibleState,playerHands:i},`p-${a}-${i[a].length-1}`}addDealerCard(a){return this.visibleState={...this.visibleState,dealerCards:[...this.visibleState.dealerCards,a]},`d-${this.visibleState.dealerCards.length-1}`}updateDealerCard(a,e,i){this.visibleState={...this.visibleState,dealerCards:this.visibleState.dealerCards.map((r,n)=>{if(n===a)return{...e,faceDown:i};return r})}}setSuppressAnimations(a){this.suppressNextContentAnimations=a}setSideBetResults(a){this.sideBetResults=a}revertToStandardModeIfNoSideBets(){if(!this.sideBetMode)return;if(![this.pairBonusAmount,this.threeCardBonusAmount].some((e)=>fa(e)&&I(e).gt(0)))this.sideBetMode=!1}async finishRound(a){if(!this.canonicalState)return;let e=this.canonicalState.multiplier.toNumber(),i=e>1;this.addToHistory(e,i,a.id),this.updateHistoryWithBet({id:a.id,currency:a.currency,amount:a.amount,payout:a.payout});let r=bt(this.canonicalState),n=dr(this.canonicalState);if(await this.animationController.waitForAllCardsToBeIdle(),this.updateVisibleState({resultMultiplier:e,mainHandOutcome:r.mainOutcome,splitHandOutcome:r.splitOutcome,insuranceOutcome:n}),await this.forceUIUpdate(),i)this.playWinFeedback();if(a.afterBalance)this.gameData.updateBalance(I(a.afterBalance));this.updateVisibleState({stage:"settled",isActing:!1}),this.hasPendingBet=!1,this.currentBetId=null,this.currentMainBetAmount="0"}async executeNextAction(a){if(!this.currentBetId)return null;let e=await this.getBlackjackApi().next({betId:this.currentBetId,type:a});if(!e.success)return this.showError(R(e1(e.errorCode),this.gameData.language||W)),null;let i=ur(e.data);return this.canonicalState=i,e.data}async blackjackPlay(){if(this.isGameActive)return;this.updateVisibleState({isActing:!0}),this.gameData.soundEffects?.play(da.buttonPress(0.5));try{await this.betController.handleBetExecution(this.gameData.betAmount??"0")}catch{this.showError(R("alerts.gameError",this.gameData.language||W))}finally{this.updateVisibleState({isActing:!1})}}async executeAutobet(a,e){return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("alerts.gameError",this.gameData.language||W)}}triggerForceUIUpdate(){return this.forceUIUpdate()}triggerShowError(a){this.showError(a)}setHasPendingBet(a){this.hasPendingBet=a}canAffordAction(a){if(!this.gameData?.hasLoadedBalance)return!0;if(!fa(this.currentMainBetAmount))return!0;let e=I(this.gameData.balance??0),i=I(this.currentMainBetAmount);switch(a){case Za.SPLIT:case Za.DOUBLE_DOWN:return e.gte(i);case Za.BUY_INSURANCE:return e.gte(i.div(2));case Za.HIT:case Za.STAND:case Za.START:case Za.REJECT_INSURANCE:return!0;default:return!1}}canPerformAction(a){return this.visibleState.stage==="player"&&!this.controlsLocked&&this.currentBetId!==null&&os(this.canonicalState).includes(a)&&this.canAffordAction(a)}onBuyInsurance=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleInsurance(Za.BUY_INSURANCE),"buy-insurance")};onDeclineInsurance=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleInsurance(Za.REJECT_INSURANCE),"no-insurance")};handleHit=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleHit(this.currentBetId),"hit")};handleStand=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleStand(this.currentBetId),"stand")};handleDoubleDown=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleDoubleDown(this.currentBetId),"double")};handleSplit=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleSplit(this.currentBetId),"split")};isSpacebarDisabled=()=>{if(!this.gameData.hotkeysOpenEnabled||this.isGameActive)return!0;return this._blackjackManualEl?.isPrimaryActionDisabled()??!0};isHitDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.HIT)};isStandDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.STAND)};isSplitDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.SPLIT)};isDoubleDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.DOUBLE_DOWN)};isAcceptInsuranceDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||this.controlsLocked||this.visibleState.stage!=="insurance"||!this.canAffordAction(Za.BUY_INSURANCE)};isNoInsuranceDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||this.controlsLocked||this.visibleState.stage!=="insurance"};handleAcceptInsurance=()=>{if(this.isAcceptInsuranceDisabled())return;this.onBuyInsurance()};handleNoInsurance=()=>{if(this.isNoInsuranceDisabled())return;this.onDeclineInsurance()};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;this._blackjackManualEl?.triggerPrimaryAction()};onBetModeChange=(a)=>{if(!$1(a.detail.tab))return;if(a.detail.tab==="Manual"&&this.showSideBetOnboarding){this.showSideBetOnboarding=!1;return}if(a.detail.tab==="Auto"&&!this.sideBetMode&&!this.sideBetOnboardingComplete){this.showSideBetOnboarding=!0;return}this.showSideBetOnboarding=!1,this.sideBetMode=a.detail.tab==="Auto"};get sideBetOnboardingComplete(){if(typeof localStorage==="undefined")return!1;return localStorage.getItem(I6)==="1"}handleSideBetOnboardingComplete=()=>{if(typeof localStorage!=="undefined")localStorage.setItem(I6,"1");this.showSideBetOnboarding=!1,this.sideBetMode=!0};onPairBonusAmountChange=(a)=>{this.pairBonusAmount=a.detail.value};onThreeCardBonusAmountChange=(a)=>{this.threeCardBonusAmount=a.detail.value};onDealSound=()=>{this.gameData.soundEffects?.play(da.cardSlide())};onCardFlip=()=>{this.gameData.soundEffects?.play(da.cardFlip())};render(){let a=this.gameData.mainWidth>=768,e=this.areInputsDisabled||this.isGameActive||this.totalBetExceedsBalance,i=Va(this.gameData);return x`
16576
+ `;class $3{edge=0;currentBalance;activeBet=null;previousPlayResults=[];randomSequence=[];useCustomSequence=!1;amount="0";betCurrency="USD";constructor(a){this.currentBalance=I(a)}setRandomSequence(a){let e=Array.from({length:this.maxRandomValues-a.length},()=>Math.floor(Math.random()*(this.maxRandomValue-this.minRandomValue+1))+this.minRandomValue);this.randomSequence=[...a,...e],this.useCustomSequence=!0}async startGame(a){let e=I(a.amount);if(e.gt(this.currentBalance))return{success:!1,error:"Insufficient balance"};let i=this.currentBalance.minus(e);if(!this.useCustomSequence)this.randomSequence=Array.from({length:this.maxRandomValues},()=>Math.floor(Math.random()*(this.maxRandomValue-this.minRandomValue+1))+this.minRandomValue);this.useCustomSequence=!1,this.amount=a.amount,this.betCurrency=a.currency??"USD";let r=F3(this.randomSequence),t=this.createGameEngine(this.edge).play(r,a.gameInputs,[]);this.previousPlayResults=[t];let o=crypto.randomUUID(),l=this.toActionData(t);if(t.state.isFinished){let d=e.mul(t.state.multiplier),c=i.plus(d);this.currentBalance=c;let m={id:o,tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:this.gameId,currency:this.betCurrency,amount:e.toString(),payout:d.toString(),afterBalance:c.toString(),multiplier:t.state.multiplier.toString(),clientSeed:"mock-seed",randomValue:t.proof.proofHash,proof:t.proof.proofString,nonce:1,betActions:[{type:"START_BET",betAmount:a.amount,payoutAmount:null,actionIndex:0,data:l},{type:"END_BET",betAmount:null,payoutAmount:d.toString(),actionIndex:1,data:l}]};return this.clearState(),{success:!0,data:m}}let s={id:o,tenantId:"origami-casino",userId:"mock-user",tenantUserId:"mock-user",gameId:this.gameId,currency:this.betCurrency,amount:e.toString(),payout:null,afterBalance:i.toString(),multiplier:null,clientSeed:"mock-seed",randomValue:null,proof:null,nonce:1,betActions:[{type:"START_BET",betAmount:a.amount,payoutAmount:null,actionIndex:0,data:l}]};return this.currentBalance=i,this.activeBet=s,{success:!0,data:s}}async performNextAction(a){if(!this.activeBet)return{success:!1,error:"No active bet"};let e=F3(this.randomSequence),r=this.createGameEngine(this.edge).play(e,a,this.previousPlayResults);this.previousPlayResults=[...this.previousPlayResults,r];let n=this.activeBet,t=[...n.betActions],o=t.length,l=this.toActionData(r),s=r.additionalBetAmount!==void 0,d=s?r.additionalBetAmount:null,c=d!==null?I(this.amount).plus(d):I(this.amount),m=c.mul(r.state.multiplier),u=this.currentBalance;if(s&&d!==null){u=u.minus(d),this.amount=c.toString();let H={type:"INTERMEDIATE_BET_ACTION",betAmount:d.toString(),payoutAmount:null,actionIndex:o,data:l},z=[...t,H];if(!r.state.isFinished){this.currentBalance=u;let b={...n,amount:c.toString(),afterBalance:u.toString(),betActions:z};return this.activeBet=b,{success:!0,data:b}}let v=u.plus(m);this.currentBalance=v,z.push({type:"END_BET",betAmount:null,payoutAmount:m.toString(),actionIndex:o+1,data:l});let g={...n,amount:c.toString(),payout:m.toString(),afterBalance:v.toString(),multiplier:r.state.multiplier.toString(),randomValue:r.proof.proofHash,proof:r.proof.proofString,betActions:z};return this.clearState(),{success:!0,data:g}}if(!r.state.isFinished){let H={type:"INTERMEDIATE_NON_BET_ACTION",betAmount:null,payoutAmount:null,actionIndex:o,data:l},z={...n,afterBalance:u.toString(),betActions:[...t,H]};return this.currentBalance=u,this.activeBet=z,{success:!0,data:z}}let f=u.plus(m);this.currentBalance=f;let k={type:"END_BET",betAmount:null,payoutAmount:m.toString(),actionIndex:o,data:l},p={...n,payout:m.toString(),afterBalance:f.toString(),multiplier:r.state.multiplier.toString(),randomValue:r.proof.proofHash,proof:r.proof.proofString,betActions:[...t,k]};return this.clearState(),{success:!0,data:p}}async fetchActiveBet(){if(!this.activeBet)return{success:!1,error:"No active bet"};return{success:!0,data:this.activeBet}}clearState(){this.activeBet=null,this.previousPlayResults=[],this.randomSequence=[],this.amount="0"}}var mu=0,pu=51,gu=63;class ei extends $3{static pendingCardSequence=null;gameId="blackjack";maxRandomValues=gu;minRandomValue=mu;maxRandomValue=pu;static setCardSequence(a){ei.pendingCardSequence=[...a]}constructor(a){super(a)}createGameEngine(a){return new er(a)}toActionData(a){return{BLACKJACK:a}}async startBet(a){if(ei.pendingCardSequence!==null)this.setRandomSequence(ei.pendingCardSequence),ei.pendingCardSequence=null;let e=a.mainBetAmount,i=a.pairBonusAmount??"0",r=a.threeCardBonusAmount??"0",n=I(e).plus(i).plus(r),t=await this.startGame({amount:n.toString(),currency:a.currency??"USD",gameInputs:{type:Za.START,mainBetAmount:e,pairBonusAmount:i,threeCardBonusAmount:r}});if(t.success)return t;return{success:!1,errorCode:t.error==="Insufficient balance"?"INSUFFICIENT_BALANCE":"UNKNOWN"}}async next(a){let e=await this.performNextAction({type:a.type});if(e.success)return e;return{success:!1,errorCode:"UNKNOWN"}}async getActiveBet(){let a=await this.fetchActiveBet();if(a.success)return a;if(a.error==="No active bet")return{success:!0,data:null};return{success:!1,errorCode:"UNKNOWN"}}}var wu=(a)=>{if(typeof a!=="object"||a===null||!("cardId"in a))return!1;return a.cardId===void 0||typeof a.cardId==="string"};class wr{host;constructor(a){this.host=a,a.addController(this)}hostConnected(){}get instantMode(){return this.host.gameData.instantBetEnabled}static BETWEEN_CARD_ACTIONS_PAUSE=120;static DEALER_REVEAL_PAUSE=300;async waitBeforeDealerReveal(){if(this.instantMode)return;if(this.host.visibleState.stage!=="player")return;await Aa(wr.DEALER_REVEAL_PAUSE)}async waitBetweenCardActions(){if(this.instantMode)return;await Aa(wr.BETWEEN_CARD_ACTIONS_PAUSE)}async dealPlayerCard(a,e){let i=this.host.addPlayerCardToHand(a,e);await this.waitForCardDealComplete(i)}async dealDealerCard(a){let e=this.host.addDealerCard(a);await this.waitForCardDealComplete(e)}async revealDealerHoleCard(a){this.host.updateDealerCard(1,a,!1),await this.waitForCardDealComplete("d-1")}async runCardActions(a){for(let e=0;e<a.length;e++){let i=a[e];if(await i(),e<a.length-1)await this.waitBetweenCardActions()}}async playInitialDeal(a,e){if(this.instantMode){this.host.updateVisibleState({playerHands:[a],dealerCards:e});return}let i={...e[1],faceDown:!0};await this.runCardActions([()=>this.dealPlayerCard(0,a[0]),()=>this.dealDealerCard(e[0]),()=>this.dealPlayerCard(0,a[1]),()=>this.dealDealerCard(i)])}async playDealerReveal(a){await this.waitBeforeDealerReveal(),this.host.updateVisibleState({stage:"dealer"}),await this.host.triggerForceUIUpdate();let e=[];if(a[1])e.push(()=>this.revealDealerHoleCard(a[1]));for(let i=2;i<a.length;i++){let r=a[i];e.push(()=>this.dealDealerCard(r))}await this.runCardActions(e)}async playSplitDeal(a,e){await this.dealPlayerCard(0,a),await this.waitBetweenCardActions(),await this.dealPlayerCard(1,e)}async waitForAllCardsToBeIdle(){if(this.instantMode)return;await this.host.triggerForceUIUpdate(),await Aa(50)}waitForCardDealComplete(a){if(this.instantMode)return Promise.resolve();return new Promise((e)=>{let i=!1,r=(n)=>{if(!(n instanceof CustomEvent)||!wu(n.detail)||n.detail.cardId!==a)return;this.host.removeEventListener("blackjack-card-dealt",r),i=!0,e()};this.host.addEventListener("blackjack-card-dealt",r),Aa(2000).then(()=>{if(i)return;this.host.removeEventListener("blackjack-card-dealt",r),e()})})}}var ku=5,I6="origami-blackjack-sidebet-onboarded";class W2 extends xa{static styles=[...xa.styles,S6];currentBetId=null;currentMainBetAmount="0";animationController;actionHandlers;betController;hasTrackedSessionConfig=!1;previousAuthToken="";previousBaseUrl="";get activeHand(){return this.visibleState.playerHands[this.visibleState.activeHandIndex]??[]}get playerHandsForContent(){return this.visibleState.playerHands}get activeHandIndexForContent(){return this.visibleState.activeHandIndex}get isGameActive(){return this.visibleState.stage!=="idle"&&this.visibleState.stage!=="settled"}get isToggleDisabled(){return this.visibleState.isActing||this.autobetInProgress||this.autobetStopping||this.isGameActive}get areInputsDisabled(){return this.visibleState.isActing||this.autobetInProgress||this.autobetStopping||this.controlsLocked}get totalBetExceedsBalance(){if(!this.gameData?.hasLoadedBalance)return!1;let a=this.gameData.betAmount??"0",e=this.sideBetMode?this.pairBonusAmount:"0",i=this.sideBetMode?this.threeCardBonusAmount:"0";if(![a,e,i].every(fa))return!1;return I(a).plus(e).plus(i).gt(I(this.gameData.balance??0))}get sidebarMode(){return this.sideBetMode||this.showSideBetOnboarding?"Auto":"Manual"}_getBlackjackApi=U1(()=>this.gameData,()=>this.isDemoMode,{createReal:(a,e)=>new P3(a,e),createMock:()=>new ei(this.gameData.balance)});getBlackjackApi(){return this._getBlackjackApi()}constructor(){super();this.canonicalState=null;this.visibleState=hr();this.history=[];this.controlsLocked=!1;this._loadingAction=null;this.suppressNextContentAnimations=!1;this.sideBetMode=!1;this.pairBonusAmount="0";this.threeCardBonusAmount="0";this.sideBetResults=null;this.showSideBetOnboarding=!1;this.animationController=new wr(this),this.actionHandlers=new W3(this,this.animationController),this.betController=new E3(this,this.animationController),new qa(this,[{key:" ",callback:this.handleSpacebar,options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}},{key:"q",callback:this.handleHit,options:{disabled:this.isHitDisabled}},{key:"w",callback:this.handleStand,options:{disabled:this.isStandDisabled}},{key:"e",callback:this.handleSplit,options:{disabled:this.isSplitDisabled}},{key:"r",callback:this.handleDoubleDown,options:{disabled:this.isDoubleDisabled}},{key:"t",callback:this.handleAcceptInsurance,options:{disabled:this.isAcceptInsuranceDisabled}},{key:"y",callback:this.handleNoInsurance,options:{disabled:this.isNoInsuranceDisabled}}])}setCanonicalState(a){this.canonicalState=a}setVisibleState(a){this.visibleState=a}updateVisibleState(a){this.visibleState={...this.visibleState,...a}}addToHistory(a,e,i){this.history=[...this.history,{multiplier:a,won:e,id:i}].slice(-ku)}async withOptimisticBalanceDeduction(a,e){let i=I(this.gameData.balance);this.gameData.updateBalance(i.minus(a));try{let r=await e();if(r===null)this.gameData.updateBalance(i);return r}catch(r){throw this.gameData.updateBalance(i),r}}async runWithLockedControls(a,e){this.controlsLocked=!0,this._loadingAction=e??null;try{await a()}finally{this.controlsLocked=!1,this._loadingAction=null}}async firstUpdated(a){super.firstUpdated(a),await this.getBlackjackActiveBet()}updated(a){super.updated(a);let e=this.gameData.authToken,i=this.gameData.baseUrl;if(!this.hasTrackedSessionConfig){this.previousAuthToken=e,this.previousBaseUrl=i,this.hasTrackedSessionConfig=!0;return}if(e===this.previousAuthToken&&i===this.previousBaseUrl)return;let r=Boolean(this.previousAuthToken)&&Boolean(this.previousBaseUrl),n=Boolean(e)&&Boolean(i);if(this.previousAuthToken=e,this.previousBaseUrl=i,!r&&!n)return;this.getBlackjackActiveBet()}async getBlackjackActiveBet(){let a=!1;try{let e=await this.getBlackjackApi().getActiveBet();if(!e.success)return;if(e.data===null){this.currentBetId=null,this.canonicalState=null,this.sideBetResults=null,this.setVisibleState(hr());return}this.currentBetId=e.data.id;let i=ur(e.data);if(!i)return;this.canonicalState=i,this.suppressNextContentAnimations=!0,a=!0,this.setVisibleState(ls(i)),this.sideBetResults=Ai(i),await this.forceUIUpdate()}catch{this.showError(R("alerts.gameError",this.gameData.language||W))}finally{if(a)this.suppressNextContentAnimations=!1}}addPlayerCardToHand(a,e){let i=this.visibleState.playerHands.map((r,n)=>n===a?[...r,e]:r);return this.visibleState={...this.visibleState,playerHands:i},`p-${a}-${i[a].length-1}`}addDealerCard(a){return this.visibleState={...this.visibleState,dealerCards:[...this.visibleState.dealerCards,a]},`d-${this.visibleState.dealerCards.length-1}`}updateDealerCard(a,e,i){this.visibleState={...this.visibleState,dealerCards:this.visibleState.dealerCards.map((r,n)=>{if(n===a)return{...e,faceDown:i};return r})}}setSuppressAnimations(a){this.suppressNextContentAnimations=a}setSideBetResults(a){this.sideBetResults=a}revertToStandardModeIfNoSideBets(){if(!this.sideBetMode)return;if(![this.pairBonusAmount,this.threeCardBonusAmount].some((e)=>fa(e)&&I(e).gt(0)))this.sideBetMode=!1}async finishRound(a){if(!this.canonicalState)return;let e=this.canonicalState.multiplier.toNumber(),i=e>1;this.addToHistory(e,i,a.id),this.updateHistoryWithBet({id:a.id,currency:a.currency,amount:a.amount,payout:a.payout});let r=bt(this.canonicalState),n=dr(this.canonicalState);if(await this.animationController.waitForAllCardsToBeIdle(),this.updateVisibleState({resultMultiplier:e,mainHandOutcome:r.mainOutcome,splitHandOutcome:r.splitOutcome,insuranceOutcome:n}),await this.forceUIUpdate(),i)this.playWinFeedback();if(a.afterBalance)this.gameData.updateBalance(I(a.afterBalance));this.updateVisibleState({stage:"settled",isActing:!1}),this.hasPendingBet=!1,this.currentBetId=null,this.currentMainBetAmount="0"}async executeNextAction(a){if(!this.currentBetId)return null;let e=await this.getBlackjackApi().next({betId:this.currentBetId,type:a});if(!e.success)return this.showError(R(e1(e.errorCode),this.gameData.language||W)),null;let i=ur(e.data);return this.canonicalState=i,e.data}async blackjackPlay(){if(this.isGameActive)return;this.updateVisibleState({isActing:!0}),this.gameData.soundEffects?.play(da.buttonPress(0.5));try{await this.betController.handleBetExecution(this.gameData.betAmount??"0")}catch{this.showError(R("alerts.gameError",this.gameData.language||W))}finally{this.updateVisibleState({isActing:!1})}}async executeAutobet(a,e){return{pnl:I(0),gameOutcome:"Draw",hasError:!0,errorMessage:R("alerts.gameError",this.gameData.language||W)}}triggerForceUIUpdate(){return this.forceUIUpdate()}triggerShowError(a){this.showError(a)}setHasPendingBet(a){this.hasPendingBet=a}canAffordAction(a){if(!this.gameData?.hasLoadedBalance)return!0;if(!fa(this.currentMainBetAmount))return!0;let e=I(this.gameData.balance??0),i=I(this.currentMainBetAmount);switch(a){case Za.SPLIT:case Za.DOUBLE_DOWN:return e.gte(i);case Za.BUY_INSURANCE:return e.gte(i.div(2));case Za.HIT:case Za.STAND:case Za.START:case Za.REJECT_INSURANCE:return!0;default:return!1}}canPerformAction(a){return this.visibleState.stage==="player"&&!this.controlsLocked&&this.currentBetId!==null&&os(this.canonicalState).includes(a)&&this.canAffordAction(a)}onBuyInsurance=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleInsurance(Za.BUY_INSURANCE),"buy-insurance")};onDeclineInsurance=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleInsurance(Za.REJECT_INSURANCE),"no-insurance")};handleHit=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleHit(this.currentBetId),"hit")};handleStand=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleStand(this.currentBetId),"stand")};handleDoubleDown=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleDoubleDown(this.currentBetId),"double")};handleSplit=async()=>{await this.runWithLockedControls(()=>this.actionHandlers.handleSplit(this.currentBetId),"split")};isSpacebarDisabled=()=>{if(!this.gameData.hotkeysOpenEnabled||this.isGameActive)return!0;return this._blackjackManualEl?.isPrimaryActionDisabled()??!0};isHitDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.HIT)};isStandDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.STAND)};isSplitDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.SPLIT)};isDoubleDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||!this.canPerformAction(Za.DOUBLE_DOWN)};isAcceptInsuranceDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||this.controlsLocked||this.visibleState.stage!=="insurance"||!this.canAffordAction(Za.BUY_INSURANCE)};isNoInsuranceDisabled=()=>{return!this.gameData.hotkeysOpenEnabled||this.controlsLocked||this.visibleState.stage!=="insurance"};handleAcceptInsurance=()=>{if(this.isAcceptInsuranceDisabled())return;this.onBuyInsurance()};handleNoInsurance=()=>{if(this.isNoInsuranceDisabled())return;this.onDeclineInsurance()};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;this._blackjackManualEl?.triggerPrimaryAction()};onBetModeChange=(a)=>{if(!$1(a.detail.tab))return;if(a.detail.tab==="Manual"&&this.showSideBetOnboarding){this.showSideBetOnboarding=!1;return}if(a.detail.tab==="Auto"&&!this.sideBetMode&&!this.sideBetOnboardingComplete){this.showSideBetOnboarding=!0;return}this.showSideBetOnboarding=!1,this.sideBetMode=a.detail.tab==="Auto"};get sideBetOnboardingComplete(){if(typeof localStorage==="undefined")return!1;return localStorage.getItem(I6)==="1"}handleSideBetOnboardingComplete=()=>{if(typeof localStorage!=="undefined")localStorage.setItem(I6,"1");this.showSideBetOnboarding=!1,this.sideBetMode=!0};onPairBonusAmountChange=(a)=>{this.pairBonusAmount=a.detail.value};onThreeCardBonusAmountChange=(a)=>{this.threeCardBonusAmount=a.detail.value};onDealSound=()=>{this.gameData.soundEffects?.play(da.cardSlide())};onCardFlip=()=>{this.gameData.soundEffects?.play(da.cardFlip())};render(){let a=this.gameData.mainWidth>=768,e=this.areInputsDisabled||this.isGameActive||this.totalBetExceedsBalance,i=Va(this.gameData);return x`
16577
16577
  <origami-game-layout style=${i} .gameType=${"BLACKJACK"} data-is-desktop=${a}>
16578
16578
  <origami-game-sidebar
16579
16579
  slot="control-panel"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betorigami/games",
3
- "version": "2.8.0",
3
+ "version": "2.8.2",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",
@@ -46,15 +46,12 @@
46
46
  "@playwright/test": "^1.53.0",
47
47
  "@rollup/plugin-babel": "^6.0.4",
48
48
  "@rollup/plugin-terser": "^0.4.4",
49
- "@storybook/web-components": "^9.0.4",
50
- "@storybook/web-components-vite": "^9.0.4",
51
49
  "@types/big.js": "^6.2.2",
52
50
  "@types/matter-js": "^0.18.2",
53
51
  "async": "^3.2.6",
54
52
  "glob": "^11.0.2",
55
53
  "mkdirp": "^3.0.1",
56
54
  "rollup": "^4.41.1",
57
- "storybook": "^9.0.4",
58
55
  "typescript": "^5.8.3",
59
56
  "underscore": "^1.13.7",
60
57
  "vite": "^6.3.5",