@betorigami/games 0.7.5 → 0.7.7

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.
Files changed (2) hide show
  1. package/dist/index.mjs +14 -14
  2. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
21
21
  https://github.com/lit/lit/issues/new?template=bug_report.md
22
22
  and include information about your build tooling, if any.
23
23
  `.trim().replace(/\n */g,`
24
- `),new Error(h)}return I3!==void 0?I3.createHTML(o):o}var T3=(d,o)=>{let h=d.length-1,f=[],w=o===g2?"<svg>":o===z2?"<math>":"",x,b=p1;for(let i=0;i<h;i++){let $=d[i],X=-1,j,Q=0,G;while(Q<$.length){if(b.lastIndex=Q,G=b.exec($),G===null)break;if(Q=b.lastIndex,b===p1){if(G[V3]==="!--")b=L3;else if(G[V3]!==void 0)b=c3;else if(G[y2]!==void 0){if(S3.test(G[y2]))x=new RegExp(`</${G[y2]}`,"g");b=X1}else if(G[M4]!==void 0)throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(b===X1)if(G[l4]===">")b=x??p1,X=-1;else if(G[R3]===void 0)X=-2;else X=b.lastIndex-G[p4].length,j=G[R3],b=G[B3]===void 0?X1:G[B3]==='"'?r2:E2;else if(b===r2||b===E2)b=X1;else if(b===L3||b===c3)b=p1;else b=X1,x=void 0}console.assert(X===-1||b===X1||b===E2||b===r2,"unexpected parse state B");let _=b===X1&&d[i+1].startsWith("/>")?" ":"";w+=b===p1?$+T4:X>=0?(f.push(j),$.slice(0,X)+s2+$.slice(X))+a0+_:$+a0+(X===-2?i:_)}let g=w+(d[h]||"<?>")+(o===g2?"</svg>":o===z2?"</math>":"");return[D3(d,g),f]};class r1{constructor({strings:d,["_$litType$"]:o},h){this.parts=[];let f,w=0,x=0,b=d.length-1,g=this.parts,[i,$]=T3(d,o);if(this.el=r1.createElement(i,h),K1.currentNode=this.el.content,o===g2||o===z2){let X=this.el.content.firstChild;X.replaceWith(...X.childNodes)}while((f=K1.nextNode())!==null&&g.length<b){if(f.nodeType===1){{let X=f.localName;if(/^(?:textarea|template)$/i.test(X)&&f.innerHTML.includes(a0)){let j=`Expressions are not supported inside \`${X}\` elements. See https://lit.dev/msg/expression-in-${X} for more information.`;if(X==="template")throw new Error(j);else P1("",j)}}if(f.hasAttributes()){for(let X of f.getAttributeNames())if(X.endsWith(s2)){let j=$[x++],G=f.getAttribute(X).split(a0),_=/([.?@])?(.*)/.exec(j);g.push({type:m2,index:w,name:_[2],strings:G,ctor:_[1]==="."?o5:_[1]==="?"?h5:_[1]==="@"?f5:T1}),f.removeAttribute(X)}else if(X.startsWith(a0))g.push({type:t2,index:w}),f.removeAttribute(X)}if(S3.test(f.tagName)){let X=f.textContent.split(a0),j=X.length-1;if(j>0){f.textContent=i2?i2.emptyScript:"";for(let Q=0;Q<j;Q++)f.append(X[Q],y1()),K1.nextNode(),g.push({type:Z2,index:++w});f.append(X[j],y1())}}}else if(f.nodeType===8)if(f.data===a2)g.push({type:Z2,index:w});else{let j=-1;while((j=f.data.indexOf(a0,j+1))!==-1)g.push({type:r4,index:w}),j+=a0.length-1}w++}if($.length!==x)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+d.join("${...}")+"`");z0&&z0({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:d})}static createElement(d,o){let h=j1.createElement("template");return h.innerHTML=d,h}}function I1(d,o,h=d,f){if(o===F0)return o;let w=f!==void 0?h.__directives?.[f]:h.__directive,x=E1(o)?void 0:o._$litDirective$;if(w?.constructor!==x){if(w?._$notifyDirectiveConnectionChanged?.(!1),x===void 0)w=void 0;else w=new x(d),w._$initialize(d,h,f);if(f!==void 0)(h.__directives??=[])[f]=w;else h.__directive=w}if(w!==void 0)o=I1(d,w._$resolve(d,o.values),w,f);return o}class d5{constructor(d,o){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=d,this._$parent=o}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(d){let{el:{content:o},parts:h}=this._$template,f=(d?.creationScope??j1).importNode(o,!0);K1.currentNode=f;let w=K1.nextNode(),x=0,b=0,g=h[0];while(g!==void 0){if(x===g.index){let i;if(g.type===Z2)i=new D1(w,w.nextSibling,this,d);else if(g.type===m2)i=new g.ctor(w,g.name,g.strings,this,d);else if(g.type===t2)i=new w5(w,this,d);this._$parts.push(i),g=h[++b]}if(x!==g?.index)w=K1.nextNode(),x++}return K1.currentNode=j1,f}_update(d){let o=0;for(let h of this._$parts){if(h!==void 0)if(z0&&z0({kind:"set part",part:h,value:d[o],valueIndex:o,values:d,templateInstance:this}),h.strings!==void 0)h._$setValue(d,h,o),o+=h.strings.length-2;else h._$setValue(d[o]);o++}}}class D1{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(d,o,h,f){this.type=Z2,this._$committedValue=u,this._$disconnectableChildren=void 0,this._$startNode=d,this._$endNode=o,this._$parent=h,this.options=f,this.__isConnected=f?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let d=y0(this._$startNode).parentNode,o=this._$parent;if(o!==void 0&&d?.nodeType===11)d=o.parentNode;return d}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(d,o=this){if(this.parentNode===null)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(d=I1(this,d,o),E1(d)){if(d===u||d==null||d===""){if(this._$committedValue!==u)z0&&z0({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=u}else if(d!==this._$committedValue&&d!==F0)this._commitText(d)}else if(d._$litType$!==void 0)this._commitTemplateResult(d);else if(d.nodeType!==void 0){if(this.options?.host===d){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",d,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(d)}else if(v3(d))this._commitIterable(d);else this._commitText(d)}_insert(d){return y0(y0(this._$startNode).parentNode).insertBefore(d,this._$endNode)}_commitNode(d){if(this._$committedValue!==d){if(this._$clear(),F1!==$2){let o=this._$startNode.parentNode?.nodeName;if(o==="STYLE"||o==="SCRIPT"){let h="Forbidden";if(o==="STYLE")h="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else h="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw new Error(h)}}z0&&z0({kind:"commit node",start:this._$startNode,parent:this._$parent,value:d,options:this.options}),this._$committedValue=this._insert(d)}}_commitText(d){if(this._$committedValue!==u&&E1(this._$committedValue)){let o=y0(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=u2(o,"data","property");d=this._textSanitizer(d),z0&&z0({kind:"commit text",node:o,value:d,options:this.options}),o.data=d}else{let o=j1.createTextNode("");if(this._commitNode(o),this._textSanitizer===void 0)this._textSanitizer=u2(o,"data","property");d=this._textSanitizer(d),z0&&z0({kind:"commit text",node:o,value:d,options:this.options}),o.data=d}this._$committedValue=d}_commitTemplateResult(d){let{values:o,["_$litType$"]:h}=d,f=typeof h==="number"?this._$getTemplate(d):(h.el===void 0&&(h.el=r1.createElement(D3(h.h,h.h[0]),this.options)),h);if(this._$committedValue?._$template===f)z0&&z0({kind:"template updating",template:f,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:o}),this._$committedValue._update(o);else{let w=new d5(f,this),x=w._clone(this.options);z0&&z0({kind:"template instantiated",template:f,instance:w,parts:w._$parts,options:this.options,fragment:x,values:o}),w._update(o),z0&&z0({kind:"template instantiated and updated",template:f,instance:w,parts:w._$parts,options:this.options,fragment:x,values:o}),this._commitNode(x),this._$committedValue=w}}_$getTemplate(d){let o=C3.get(d.strings);if(o===void 0)C3.set(d.strings,o=new r1(d));return o}_commitIterable(d){if(!n2(this._$committedValue))this._$committedValue=[],this._$clear();let o=this._$committedValue,h=0,f;for(let w of d){if(h===o.length)o.push(f=new D1(this._insert(y1()),this._insert(y1()),this,this.options));else f=o[h];f._$setValue(w),h++}if(h<o.length)this._$clear(f&&y0(f._$endNode).nextSibling,h),o.length=h}_$clear(d=y0(this._$startNode).nextSibling,o){this._$notifyConnectionChanged?.(!1,!0,o);while(d&&d!==this._$endNode){let h=y0(d).nextSibling;y0(d).remove(),d=h}}setConnected(d){if(this._$parent===void 0)this.__isConnected=d,this._$notifyConnectionChanged?.(d);else throw new Error("part.setConnected() may only be called on a RootPart returned from render().")}}class T1{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(d,o,h,f,w){if(this.type=m2,this._$committedValue=u,this._$disconnectableChildren=void 0,this.element=d,this.name=o,this._$parent=f,this.options=w,h.length>2||h[0]!==""||h[1]!=="")this._$committedValue=new Array(h.length-1).fill(new String),this.strings=h;else this._$committedValue=u;this._sanitizer=void 0}_$setValue(d,o=this,h,f){let w=this.strings,x=!1;if(w===void 0){if(d=I1(this,d,o,0),x=!E1(d)||d!==this._$committedValue&&d!==F0,x)this._$committedValue=d}else{let b=d;d=w[0];let g,i;for(g=0;g<w.length-1;g++){if(i=I1(this,b[h+g],o,g),i===F0)i=this._$committedValue[g];if(x||=!E1(i)||i!==this._$committedValue[g],i===u)d=u;else if(d!==u)d+=(i??"")+w[g+1];this._$committedValue[g]=i}}if(x&&!f)this._commitValue(d)}_commitValue(d){if(d===u)y0(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=F1(this.element,this.name,"attribute");d=this._sanitizer(d??""),z0&&z0({kind:"commit attribute",element:this.element,name:this.name,value:d,options:this.options}),y0(this.element).setAttribute(this.name,d??"")}}}class o5 extends T1{constructor(){super(...arguments);this.type=P4}_commitValue(d){if(this._sanitizer===void 0)this._sanitizer=F1(this.element,this.name,"property");d=this._sanitizer(d),z0&&z0({kind:"commit property",element:this.element,name:this.name,value:d,options:this.options}),this.element[this.name]=d===u?void 0:d}}class h5 extends T1{constructor(){super(...arguments);this.type=y4}_commitValue(d){z0&&z0({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(d&&d!==u),options:this.options}),y0(this.element).toggleAttribute(this.name,!!d&&d!==u)}}class f5 extends T1{constructor(d,o,h,f,w){super(d,o,h,f,w);if(this.type=E4,this.strings!==void 0)throw new Error(`A \`<${d.localName}>\` has a \`@${o}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(d,o=this){if(d=I1(this,d,o,0)??u,d===F0)return;let h=this._$committedValue,f=d===u&&h!==u||d.capture!==h.capture||d.once!==h.once||d.passive!==h.passive,w=d!==u&&(h===u||f);if(z0&&z0({kind:"commit event listener",element:this.element,name:this.name,value:d,options:this.options,removeListener:f,addListener:w,oldListener:h}),f)this.element.removeEventListener(this.name,this,h);if(w)this.element.addEventListener(this.name,this,d);this._$committedValue=d}handleEvent(d){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,d);else this._$committedValue.handleEvent(d)}}class w5{constructor(d,o,h){this.element=d,this.type=t2,this._$disconnectableChildren=void 0,this._$parent=o,this.options=h}get _$isConnected(){return this._$parent._$isConnected}_$setValue(d){z0&&z0({kind:"commit to element binding",element:this.element,value:d,options:this.options}),I1(this,d)}}var O3={_boundAttributeSuffix:s2,_marker:a0,_markerMatch:a2,_HTML_RESULT:N3,_getTemplateHtml:T3,_TemplateInstance:d5,_isIterable:v3,_resolveDirective:I1,_ChildPart:D1,_AttributePart:T1,_BooleanAttributePart:h5,_EventPart:f5,_PropertyPart:o5,_ElementPart:w5},u4=S0.litHtmlPolyfillSupportDevMode;u4?.(r1,D1);(S0.litHtmlVersions??=[]).push("3.3.0");if(S0.litHtmlVersions.length>1)queueMicrotask(()=>{P1("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var G1=(d,o,h)=>{if(o==null)throw new TypeError(`The container to render into may not be ${o}`);let f=v4++,w=h?.renderBefore??o,x=w._$litPart$;if(z0&&z0({kind:"begin render",id:f,value:d,container:o,options:h,part:x}),x===void 0){let b=h?.renderBefore??null;w._$litPart$=x=new D1(o.insertBefore(y1(),b),b,void 0,h??{})}return x._$setValue(d),z0&&z0({kind:"end render",id:f,value:d,container:o,options:h,part:x}),x};G1.setSanitizer=N4,G1.createSanitizer=u2,G1._testOnlyClearSanitizerFactoryDoNotCallOrElse=D4;var s4=(d,o)=>d,x5=!0,f1=globalThis,A3;if(x5)f1.litIssuedWarnings??=new Set,A3=(d,o)=>{if(o+=` See https://lit.dev/msg/${d} for more information.`,!f1.litIssuedWarnings.has(o)&&!f1.litIssuedWarnings.has(d))console.warn(o),f1.litIssuedWarnings.add(o)};class _0 extends v0{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let d=super.createRenderRoot();return this.renderOptions.renderBefore??=d.firstChild,d}update(d){let o=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(d),this.__childPart=G1(o,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return F0}}_0._$litElement$=!0;_0[s4("finalized",_0)]=!0;f1.litElementHydrateSupport?.({LitElement:_0});var a4=x5?f1.litElementPolyfillSupportDevMode:f1.litElementPolyfillSupport;a4?.({LitElement:_0});(f1.litElementVersions??=[]).push("4.2.0");if(x5&&f1.litElementVersions.length>1)queueMicrotask(()=>{A3("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var P=(d)=>(o,h)=>{if(h!==void 0)h.addInitializer(()=>{customElements.define(d,o)});else customElements.define(d,o)};var M3=!0,l3;if(M3)globalThis.litIssuedWarnings??=new Set,l3=(d,o)=>{if(o+=` See https://lit.dev/msg/${d} for more information.`,!globalThis.litIssuedWarnings.has(o)&&!globalThis.litIssuedWarnings.has(d))console.warn(o),globalThis.litIssuedWarnings.add(o)};var n4=(d,o,h)=>{let f=o.hasOwnProperty(h);return o.constructor.createProperty(h,d),f?Object.getOwnPropertyDescriptor(o,h):void 0},m4={attribute:!0,type:String,converter:l1,reflect:!1,hasChanged:b2},t4=(d=m4,o,h)=>{let{kind:f,metadata:w}=h;if(M3&&w==null)l3("missing-class-metadata",`The class ${o} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let x=globalThis.litPropertyMetadata.get(w);if(x===void 0)globalThis.litPropertyMetadata.set(w,x=new Map);if(f==="setter")d=Object.create(d),d.wrapped=!0;if(x.set(h.name,d),f==="accessor"){let{name:b}=h;return{set(g){let i=o.get.call(this);o.set.call(this,g),this.requestUpdate(b,i,d)},init(g){if(g!==void 0)this._$changeProperty(b,void 0,d,g);return g}}}else if(f==="setter"){let{name:b}=h;return function(g){let i=this[b];o.call(this,g),this.requestUpdate(b,i,d)}}throw new Error(`Unsupported decorator location: ${f}`)};function V(d){return(o,h)=>{return typeof h==="object"?t4(d,o,h):n4(d,o,h)}}function p(d){return V({...d,state:!0,attribute:!1})}var V1=(d,o,h)=>{if(h.configurable=!0,h.enumerable=!0,Reflect.decorate&&typeof o!=="object")Object.defineProperty(d,o,h);return h};var b5=!0,p3;if(b5)globalThis.litIssuedWarnings??=new Set,p3=(d,o)=>{if(o+=d?` See https://lit.dev/msg/${d} for more information.`:"",!globalThis.litIssuedWarnings.has(o)&&!globalThis.litIssuedWarnings.has(d))console.warn(o),globalThis.litIssuedWarnings.add(o)};function $0(d,o){return(h,f,w)=>{let x=(b)=>{let g=b.renderRoot?.querySelector(d)??null;if(b5&&g===null&&o&&!b.hasUpdated){let i=typeof f==="object"?f.name:f;p3("",`@query'd field ${JSON.stringify(String(i))} with the 'cache' flag set for selector '${d}' has been accessed before the first update and returned null. This is expected if the renderRoot tree has not been provided beforehand (e.g. via Declarative Shadow DOM). Therefore the value hasn't been cached.`)}return g};if(o){let{get:b,set:g}=typeof f==="object"?h:w??(()=>{let i=b5?Symbol(`${String(f)} (@query() cache)`):Symbol();return{get(){return this[i]},set($){this[i]=$}}})();return V1(h,f,{get(){let i=b.call(this);if(i===void 0){if(i=x(this),i!==null||this.hasUpdated)g.call(this,i)}return i}})}else return V1(h,f,{get(){return x(this)}})}}class i5{host;muted=!1;audioCache=new Map;constructor(d){this.host=d,d.addController(this)}preload(d){if(this.audioCache.has(d))return;let o=new Audio(d);o.preload="auto",o.load(),this.audioCache.set(d,o)}async play(d){try{if(!this.audioCache.has(d))this.preload(d);let o=this.audioCache.get(d),h=this.host.gameData?.volume??100;o.volume=this.muted?0:h/100,o.currentTime=0,await o.play()}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;throw console.error("Failed to play sound:",o),o}}stop(){this.audioCache.forEach((d)=>{d.pause(),d.currentTime=0})}pause(){this.audioCache.forEach((d)=>{d.pause()})}}var n0=8,u1=2,P3=100;class E extends _0{static componentStyles=[];emit(d,o){let h=new CustomEvent(d,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...o});return this.dispatchEvent(h),h}}var w0=S1(Symbol("game"));class J2 extends E{constructor(){super(...arguments);this.currency="USDC";this.isTheatreMode=!1;this.showFavorites=!1;this.balance=1000;this.baseUrl="https://us-api.dev.betorigami.com/provider/v1/games";this.authToken="";this.isCryptoMode=!0;this.gameStatsOpen=!1;this.betAmount="0.00";this.autobetNumberOfBets=0;this.hotkeysOpenEnabled=!1;this.volume=100;this.instantBetEnabled=!1}_soundController=new i5(this);firstUpdated(){this._soundController.preload("/src/assets/sounds/shared/bet.mp3"),this._soundController.preload("/src/assets/sounds/shared/click.mp3"),this._soundController.preload("/src/assets/sounds/shared/tick.mp3"),this._soundController.preload("/src/assets/sounds/shared/half-double.mp3"),this._soundController.preload("/src/assets/sounds/toggle.mp3")}_gameProvider=new Y1(this,{context:w0,initialValue:{amount:this.betAmount,updateBalance:this.updateBalance.bind(this),currency:this.currency,isCryptoMode:this.isCryptoMode,isTheatreMode:this.isTheatreMode,showFavorites:this.showFavorites,balance:this.balance,baseUrl:this.baseUrl,authToken:this.authToken,gameStatsOpen:this.gameStatsOpen,autobetNumberOfBets:this.autobetNumberOfBets,hotkeysOpenEnabled:this.hotkeysOpenEnabled,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this),updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this)}});connectedCallback(){super.connectedCallback(),this.updateProviderValue()}updated(d){if(super.updated(d),d.has("currency")||d.has("isTheatreMode")||d.has("showFavorites")||d.has("balance")||d.has("baseUrl")||d.has("isCryptoMode")||d.has("authToken")||d.has("gameStatsOpen")||d.has("hotkeysOpenEnabled")||d.has("volume")||d.has("instantBetEnabled"))this.updateProviderValue()}get gameData(){return this._gameProvider.value}updateProviderValue(){this._gameProvider.setValue({amount:this.betAmount,currency:this.currency,updateBalance:this.updateBalance.bind(this),isCryptoMode:this.isCryptoMode,isTheatreMode:this.isTheatreMode,showFavorites:this.showFavorites,balance:this.balance,baseUrl:this.baseUrl,authToken:this.authToken,gameStatsOpen:this.gameStatsOpen,autobetNumberOfBets:this.autobetNumberOfBets,updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this),hotkeysOpenEnabled:this.hotkeysOpenEnabled,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this)})}updateHotkeysOpenEnabled(d){this.hotkeysOpenEnabled=d,this.updateProviderValue()}updateVolume(d){this.volume=d,this.updateProviderValue()}updateInstantBetEnabled(d){this.instantBetEnabled=d,this.updateProviderValue()}updateAutobetNumberOfBets(d){this.autobetNumberOfBets=d,this.updateProviderValue()}updateBalance(d){if(d.isNaN())return;if(d.isLessThan(0)){this.betAmount="0";return}let o=d.toFixed(n0);this.betAmount=o,this.updateProviderValue()}render(){return M`<slot></slot>`}}Z([V({type:String})],J2.prototype,"currency",void 0),Z([V({type:Boolean})],J2.prototype,"isTheatreMode",void 0),Z([V({type:Boolean})],J2.prototype,"showFavorites",void 0),Z([V({type:Number})],J2.prototype,"balance",void 0),Z([V({type:String})],J2.prototype,"baseUrl",void 0),Z([V({type:String})],J2.prototype,"authToken",void 0),Z([V({type:Boolean})],J2.prototype,"isCryptoMode",void 0),Z([V({type:Boolean})],J2.prototype,"gameStatsOpen",void 0),Z([p()],J2.prototype,"betAmount",void 0),Z([p()],J2.prototype,"autobetNumberOfBets",void 0),Z([p()],J2.prototype,"hotkeysOpenEnabled",void 0),Z([p()],J2.prototype,"volume",void 0),Z([p()],J2.prototype,"instantBetEnabled",void 0),J2=Z([P("origami-game-provider-wrapper")],J2);var N0={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m0=(d)=>(...o)=>({["_$litDirective$"]:d,values:o});class E0{constructor(d){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(d,o,h){this.__part=d,this._$parent=o,this.__attributeIndex=h}_$resolve(d,o){return this.update(d,o)}update(d,o){return this.render(...o)}}class y3 extends E0{constructor(d){super(d);if(d.type!==N0.ATTRIBUTE||d.name!=="class"||d.strings?.length>2)throw new Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(d){return" "+Object.keys(d).filter((o)=>d[o]).join(" ")+" "}update(d,[o]){if(this._previousClasses===void 0){if(this._previousClasses=new Set,d.strings!==void 0)this._staticClasses=new Set(d.strings.join(" ").split(/\s/).filter((f)=>f!==""));for(let f in o)if(o[f]&&!this._staticClasses?.has(f))this._previousClasses.add(f);return this.render(o)}let h=d.element.classList;for(let f of this._previousClasses)if(!(f in o))h.remove(f),this._previousClasses.delete(f);for(let f in o){let w=!!o[f];if(w!==this._previousClasses.has(f)&&!this._staticClasses?.has(f))if(w)h.add(f),this._previousClasses.add(f);else h.remove(f),this._previousClasses.delete(f)}return F0}}var d0=m0(y3);var Y0=(d)=>d??u;var r=s`
24
+ `),new Error(h)}return I3!==void 0?I3.createHTML(o):o}var T3=(d,o)=>{let h=d.length-1,f=[],w=o===g2?"<svg>":o===z2?"<math>":"",x,b=p1;for(let i=0;i<h;i++){let $=d[i],X=-1,j,Q=0,G;while(Q<$.length){if(b.lastIndex=Q,G=b.exec($),G===null)break;if(Q=b.lastIndex,b===p1){if(G[V3]==="!--")b=L3;else if(G[V3]!==void 0)b=c3;else if(G[y2]!==void 0){if(S3.test(G[y2]))x=new RegExp(`</${G[y2]}`,"g");b=X1}else if(G[M4]!==void 0)throw new Error("Bindings in tag names are not supported. Please use static templates instead. See https://lit.dev/docs/templates/expressions/#static-expressions")}else if(b===X1)if(G[l4]===">")b=x??p1,X=-1;else if(G[R3]===void 0)X=-2;else X=b.lastIndex-G[p4].length,j=G[R3],b=G[B3]===void 0?X1:G[B3]==='"'?r2:E2;else if(b===r2||b===E2)b=X1;else if(b===L3||b===c3)b=p1;else b=X1,x=void 0}console.assert(X===-1||b===X1||b===E2||b===r2,"unexpected parse state B");let _=b===X1&&d[i+1].startsWith("/>")?" ":"";w+=b===p1?$+T4:X>=0?(f.push(j),$.slice(0,X)+s2+$.slice(X))+a0+_:$+a0+(X===-2?i:_)}let g=w+(d[h]||"<?>")+(o===g2?"</svg>":o===z2?"</math>":"");return[D3(d,g),f]};class r1{constructor({strings:d,["_$litType$"]:o},h){this.parts=[];let f,w=0,x=0,b=d.length-1,g=this.parts,[i,$]=T3(d,o);if(this.el=r1.createElement(i,h),K1.currentNode=this.el.content,o===g2||o===z2){let X=this.el.content.firstChild;X.replaceWith(...X.childNodes)}while((f=K1.nextNode())!==null&&g.length<b){if(f.nodeType===1){{let X=f.localName;if(/^(?:textarea|template)$/i.test(X)&&f.innerHTML.includes(a0)){let j=`Expressions are not supported inside \`${X}\` elements. See https://lit.dev/msg/expression-in-${X} for more information.`;if(X==="template")throw new Error(j);else P1("",j)}}if(f.hasAttributes()){for(let X of f.getAttributeNames())if(X.endsWith(s2)){let j=$[x++],G=f.getAttribute(X).split(a0),_=/([.?@])?(.*)/.exec(j);g.push({type:m2,index:w,name:_[2],strings:G,ctor:_[1]==="."?o5:_[1]==="?"?h5:_[1]==="@"?f5:T1}),f.removeAttribute(X)}else if(X.startsWith(a0))g.push({type:t2,index:w}),f.removeAttribute(X)}if(S3.test(f.tagName)){let X=f.textContent.split(a0),j=X.length-1;if(j>0){f.textContent=i2?i2.emptyScript:"";for(let Q=0;Q<j;Q++)f.append(X[Q],y1()),K1.nextNode(),g.push({type:Z2,index:++w});f.append(X[j],y1())}}}else if(f.nodeType===8)if(f.data===a2)g.push({type:Z2,index:w});else{let j=-1;while((j=f.data.indexOf(a0,j+1))!==-1)g.push({type:r4,index:w}),j+=a0.length-1}w++}if($.length!==x)throw new Error('Detected duplicate attribute bindings. This occurs if your template has duplicate attributes on an element tag. For example "<input ?disabled=${true} ?disabled=${false}>" contains a duplicate "disabled" attribute. The error was detected in the following template: \n`'+d.join("${...}")+"`");z0&&z0({kind:"template prep",template:this,clonableTemplate:this.el,parts:this.parts,strings:d})}static createElement(d,o){let h=j1.createElement("template");return h.innerHTML=d,h}}function I1(d,o,h=d,f){if(o===F0)return o;let w=f!==void 0?h.__directives?.[f]:h.__directive,x=E1(o)?void 0:o._$litDirective$;if(w?.constructor!==x){if(w?._$notifyDirectiveConnectionChanged?.(!1),x===void 0)w=void 0;else w=new x(d),w._$initialize(d,h,f);if(f!==void 0)(h.__directives??=[])[f]=w;else h.__directive=w}if(w!==void 0)o=I1(d,w._$resolve(d,o.values),w,f);return o}class d5{constructor(d,o){this._$parts=[],this._$disconnectableChildren=void 0,this._$template=d,this._$parent=o}get parentNode(){return this._$parent.parentNode}get _$isConnected(){return this._$parent._$isConnected}_clone(d){let{el:{content:o},parts:h}=this._$template,f=(d?.creationScope??j1).importNode(o,!0);K1.currentNode=f;let w=K1.nextNode(),x=0,b=0,g=h[0];while(g!==void 0){if(x===g.index){let i;if(g.type===Z2)i=new D1(w,w.nextSibling,this,d);else if(g.type===m2)i=new g.ctor(w,g.name,g.strings,this,d);else if(g.type===t2)i=new w5(w,this,d);this._$parts.push(i),g=h[++b]}if(x!==g?.index)w=K1.nextNode(),x++}return K1.currentNode=j1,f}_update(d){let o=0;for(let h of this._$parts){if(h!==void 0)if(z0&&z0({kind:"set part",part:h,value:d[o],valueIndex:o,values:d,templateInstance:this}),h.strings!==void 0)h._$setValue(d,h,o),o+=h.strings.length-2;else h._$setValue(d[o]);o++}}}class D1{get _$isConnected(){return this._$parent?._$isConnected??this.__isConnected}constructor(d,o,h,f){this.type=Z2,this._$committedValue=u,this._$disconnectableChildren=void 0,this._$startNode=d,this._$endNode=o,this._$parent=h,this.options=f,this.__isConnected=f?.isConnected??!0,this._textSanitizer=void 0}get parentNode(){let d=y0(this._$startNode).parentNode,o=this._$parent;if(o!==void 0&&d?.nodeType===11)d=o.parentNode;return d}get startNode(){return this._$startNode}get endNode(){return this._$endNode}_$setValue(d,o=this){if(this.parentNode===null)throw new Error("This `ChildPart` has no `parentNode` and therefore cannot accept a value. This likely means the element containing the part was manipulated in an unsupported way outside of Lit's control such that the part's marker nodes were ejected from DOM. For example, setting the element's `innerHTML` or `textContent` can do this.");if(d=I1(this,d,o),E1(d)){if(d===u||d==null||d===""){if(this._$committedValue!==u)z0&&z0({kind:"commit nothing to child",start:this._$startNode,end:this._$endNode,parent:this._$parent,options:this.options}),this._$clear();this._$committedValue=u}else if(d!==this._$committedValue&&d!==F0)this._commitText(d)}else if(d._$litType$!==void 0)this._commitTemplateResult(d);else if(d.nodeType!==void 0){if(this.options?.host===d){this._commitText("[probable mistake: rendered a template's host in itself (commonly caused by writing ${this} in a template]"),console.warn("Attempted to render the template host",d,"inside itself. This is almost always a mistake, and in dev mode ","we render some warning text. In production however, we'll ","render it, which will usually result in an error, and sometimes ","in the element disappearing from the DOM.");return}this._commitNode(d)}else if(v3(d))this._commitIterable(d);else this._commitText(d)}_insert(d){return y0(y0(this._$startNode).parentNode).insertBefore(d,this._$endNode)}_commitNode(d){if(this._$committedValue!==d){if(this._$clear(),F1!==$2){let o=this._$startNode.parentNode?.nodeName;if(o==="STYLE"||o==="SCRIPT"){let h="Forbidden";if(o==="STYLE")h="Lit does not support binding inside style nodes. This is a security risk, as style injection attacks can exfiltrate data and spoof UIs. Consider instead using css`...` literals to compose styles, and do dynamic styling with css custom properties, ::parts, <slot>s, and by mutating the DOM rather than stylesheets.";else h="Lit does not support binding inside script nodes. This is a security risk, as it could allow arbitrary code execution.";throw new Error(h)}}z0&&z0({kind:"commit node",start:this._$startNode,parent:this._$parent,value:d,options:this.options}),this._$committedValue=this._insert(d)}}_commitText(d){if(this._$committedValue!==u&&E1(this._$committedValue)){let o=y0(this._$startNode).nextSibling;if(this._textSanitizer===void 0)this._textSanitizer=u2(o,"data","property");d=this._textSanitizer(d),z0&&z0({kind:"commit text",node:o,value:d,options:this.options}),o.data=d}else{let o=j1.createTextNode("");if(this._commitNode(o),this._textSanitizer===void 0)this._textSanitizer=u2(o,"data","property");d=this._textSanitizer(d),z0&&z0({kind:"commit text",node:o,value:d,options:this.options}),o.data=d}this._$committedValue=d}_commitTemplateResult(d){let{values:o,["_$litType$"]:h}=d,f=typeof h==="number"?this._$getTemplate(d):(h.el===void 0&&(h.el=r1.createElement(D3(h.h,h.h[0]),this.options)),h);if(this._$committedValue?._$template===f)z0&&z0({kind:"template updating",template:f,instance:this._$committedValue,parts:this._$committedValue._$parts,options:this.options,values:o}),this._$committedValue._update(o);else{let w=new d5(f,this),x=w._clone(this.options);z0&&z0({kind:"template instantiated",template:f,instance:w,parts:w._$parts,options:this.options,fragment:x,values:o}),w._update(o),z0&&z0({kind:"template instantiated and updated",template:f,instance:w,parts:w._$parts,options:this.options,fragment:x,values:o}),this._commitNode(x),this._$committedValue=w}}_$getTemplate(d){let o=C3.get(d.strings);if(o===void 0)C3.set(d.strings,o=new r1(d));return o}_commitIterable(d){if(!n2(this._$committedValue))this._$committedValue=[],this._$clear();let o=this._$committedValue,h=0,f;for(let w of d){if(h===o.length)o.push(f=new D1(this._insert(y1()),this._insert(y1()),this,this.options));else f=o[h];f._$setValue(w),h++}if(h<o.length)this._$clear(f&&y0(f._$endNode).nextSibling,h),o.length=h}_$clear(d=y0(this._$startNode).nextSibling,o){this._$notifyConnectionChanged?.(!1,!0,o);while(d&&d!==this._$endNode){let h=y0(d).nextSibling;y0(d).remove(),d=h}}setConnected(d){if(this._$parent===void 0)this.__isConnected=d,this._$notifyConnectionChanged?.(d);else throw new Error("part.setConnected() may only be called on a RootPart returned from render().")}}class T1{get tagName(){return this.element.tagName}get _$isConnected(){return this._$parent._$isConnected}constructor(d,o,h,f,w){if(this.type=m2,this._$committedValue=u,this._$disconnectableChildren=void 0,this.element=d,this.name=o,this._$parent=f,this.options=w,h.length>2||h[0]!==""||h[1]!=="")this._$committedValue=new Array(h.length-1).fill(new String),this.strings=h;else this._$committedValue=u;this._sanitizer=void 0}_$setValue(d,o=this,h,f){let w=this.strings,x=!1;if(w===void 0){if(d=I1(this,d,o,0),x=!E1(d)||d!==this._$committedValue&&d!==F0,x)this._$committedValue=d}else{let b=d;d=w[0];let g,i;for(g=0;g<w.length-1;g++){if(i=I1(this,b[h+g],o,g),i===F0)i=this._$committedValue[g];if(x||=!E1(i)||i!==this._$committedValue[g],i===u)d=u;else if(d!==u)d+=(i??"")+w[g+1];this._$committedValue[g]=i}}if(x&&!f)this._commitValue(d)}_commitValue(d){if(d===u)y0(this.element).removeAttribute(this.name);else{if(this._sanitizer===void 0)this._sanitizer=F1(this.element,this.name,"attribute");d=this._sanitizer(d??""),z0&&z0({kind:"commit attribute",element:this.element,name:this.name,value:d,options:this.options}),y0(this.element).setAttribute(this.name,d??"")}}}class o5 extends T1{constructor(){super(...arguments);this.type=P4}_commitValue(d){if(this._sanitizer===void 0)this._sanitizer=F1(this.element,this.name,"property");d=this._sanitizer(d),z0&&z0({kind:"commit property",element:this.element,name:this.name,value:d,options:this.options}),this.element[this.name]=d===u?void 0:d}}class h5 extends T1{constructor(){super(...arguments);this.type=y4}_commitValue(d){z0&&z0({kind:"commit boolean attribute",element:this.element,name:this.name,value:!!(d&&d!==u),options:this.options}),y0(this.element).toggleAttribute(this.name,!!d&&d!==u)}}class f5 extends T1{constructor(d,o,h,f,w){super(d,o,h,f,w);if(this.type=E4,this.strings!==void 0)throw new Error(`A \`<${d.localName}>\` has a \`@${o}=...\` listener with invalid content. Event listeners in templates must have exactly one expression and no surrounding text.`)}_$setValue(d,o=this){if(d=I1(this,d,o,0)??u,d===F0)return;let h=this._$committedValue,f=d===u&&h!==u||d.capture!==h.capture||d.once!==h.once||d.passive!==h.passive,w=d!==u&&(h===u||f);if(z0&&z0({kind:"commit event listener",element:this.element,name:this.name,value:d,options:this.options,removeListener:f,addListener:w,oldListener:h}),f)this.element.removeEventListener(this.name,this,h);if(w)this.element.addEventListener(this.name,this,d);this._$committedValue=d}handleEvent(d){if(typeof this._$committedValue==="function")this._$committedValue.call(this.options?.host??this.element,d);else this._$committedValue.handleEvent(d)}}class w5{constructor(d,o,h){this.element=d,this.type=t2,this._$disconnectableChildren=void 0,this._$parent=o,this.options=h}get _$isConnected(){return this._$parent._$isConnected}_$setValue(d){z0&&z0({kind:"commit to element binding",element:this.element,value:d,options:this.options}),I1(this,d)}}var O3={_boundAttributeSuffix:s2,_marker:a0,_markerMatch:a2,_HTML_RESULT:N3,_getTemplateHtml:T3,_TemplateInstance:d5,_isIterable:v3,_resolveDirective:I1,_ChildPart:D1,_AttributePart:T1,_BooleanAttributePart:h5,_EventPart:f5,_PropertyPart:o5,_ElementPart:w5},u4=S0.litHtmlPolyfillSupportDevMode;u4?.(r1,D1);(S0.litHtmlVersions??=[]).push("3.3.0");if(S0.litHtmlVersions.length>1)queueMicrotask(()=>{P1("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var G1=(d,o,h)=>{if(o==null)throw new TypeError(`The container to render into may not be ${o}`);let f=v4++,w=h?.renderBefore??o,x=w._$litPart$;if(z0&&z0({kind:"begin render",id:f,value:d,container:o,options:h,part:x}),x===void 0){let b=h?.renderBefore??null;w._$litPart$=x=new D1(o.insertBefore(y1(),b),b,void 0,h??{})}return x._$setValue(d),z0&&z0({kind:"end render",id:f,value:d,container:o,options:h,part:x}),x};G1.setSanitizer=N4,G1.createSanitizer=u2,G1._testOnlyClearSanitizerFactoryDoNotCallOrElse=D4;var s4=(d,o)=>d,x5=!0,f1=globalThis,A3;if(x5)f1.litIssuedWarnings??=new Set,A3=(d,o)=>{if(o+=` See https://lit.dev/msg/${d} for more information.`,!f1.litIssuedWarnings.has(o)&&!f1.litIssuedWarnings.has(d))console.warn(o),f1.litIssuedWarnings.add(o)};class _0 extends v0{constructor(){super(...arguments);this.renderOptions={host:this},this.__childPart=void 0}createRenderRoot(){let d=super.createRenderRoot();return this.renderOptions.renderBefore??=d.firstChild,d}update(d){let o=this.render();if(!this.hasUpdated)this.renderOptions.isConnected=this.isConnected;super.update(d),this.__childPart=G1(o,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.__childPart?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.__childPart?.setConnected(!1)}render(){return F0}}_0._$litElement$=!0;_0[s4("finalized",_0)]=!0;f1.litElementHydrateSupport?.({LitElement:_0});var a4=x5?f1.litElementPolyfillSupportDevMode:f1.litElementPolyfillSupport;a4?.({LitElement:_0});(f1.litElementVersions??=[]).push("4.2.0");if(x5&&f1.litElementVersions.length>1)queueMicrotask(()=>{A3("multiple-versions","Multiple versions of Lit loaded. Loading multiple versions is not recommended.")});var P=(d)=>(o,h)=>{if(h!==void 0)h.addInitializer(()=>{customElements.define(d,o)});else customElements.define(d,o)};var M3=!0,l3;if(M3)globalThis.litIssuedWarnings??=new Set,l3=(d,o)=>{if(o+=` See https://lit.dev/msg/${d} for more information.`,!globalThis.litIssuedWarnings.has(o)&&!globalThis.litIssuedWarnings.has(d))console.warn(o),globalThis.litIssuedWarnings.add(o)};var n4=(d,o,h)=>{let f=o.hasOwnProperty(h);return o.constructor.createProperty(h,d),f?Object.getOwnPropertyDescriptor(o,h):void 0},m4={attribute:!0,type:String,converter:l1,reflect:!1,hasChanged:b2},t4=(d=m4,o,h)=>{let{kind:f,metadata:w}=h;if(M3&&w==null)l3("missing-class-metadata",`The class ${o} is missing decorator metadata. This could mean that you're using a compiler that supports decorators but doesn't support decorator metadata, such as TypeScript 5.1. Please update your compiler.`);let x=globalThis.litPropertyMetadata.get(w);if(x===void 0)globalThis.litPropertyMetadata.set(w,x=new Map);if(f==="setter")d=Object.create(d),d.wrapped=!0;if(x.set(h.name,d),f==="accessor"){let{name:b}=h;return{set(g){let i=o.get.call(this);o.set.call(this,g),this.requestUpdate(b,i,d)},init(g){if(g!==void 0)this._$changeProperty(b,void 0,d,g);return g}}}else if(f==="setter"){let{name:b}=h;return function(g){let i=this[b];o.call(this,g),this.requestUpdate(b,i,d)}}throw new Error(`Unsupported decorator location: ${f}`)};function V(d){return(o,h)=>{return typeof h==="object"?t4(d,o,h):n4(d,o,h)}}function p(d){return V({...d,state:!0,attribute:!1})}var V1=(d,o,h)=>{if(h.configurable=!0,h.enumerable=!0,Reflect.decorate&&typeof o!=="object")Object.defineProperty(d,o,h);return h};var b5=!0,p3;if(b5)globalThis.litIssuedWarnings??=new Set,p3=(d,o)=>{if(o+=d?` See https://lit.dev/msg/${d} for more information.`:"",!globalThis.litIssuedWarnings.has(o)&&!globalThis.litIssuedWarnings.has(d))console.warn(o),globalThis.litIssuedWarnings.add(o)};function $0(d,o){return(h,f,w)=>{let x=(b)=>{let g=b.renderRoot?.querySelector(d)??null;if(b5&&g===null&&o&&!b.hasUpdated){let i=typeof f==="object"?f.name:f;p3("",`@query'd field ${JSON.stringify(String(i))} with the 'cache' flag set for selector '${d}' has been accessed before the first update and returned null. This is expected if the renderRoot tree has not been provided beforehand (e.g. via Declarative Shadow DOM). Therefore the value hasn't been cached.`)}return g};if(o){let{get:b,set:g}=typeof f==="object"?h:w??(()=>{let i=b5?Symbol(`${String(f)} (@query() cache)`):Symbol();return{get(){return this[i]},set($){this[i]=$}}})();return V1(h,f,{get(){let i=b.call(this);if(i===void 0){if(i=x(this),i!==null||this.hasUpdated)g.call(this,i)}return i}})}else return V1(h,f,{get(){return x(this)}})}}class i5{host;muted=!1;audioCache=new Map;constructor(d){this.host=d,d.addController(this)}preload(d){if(this.audioCache.has(d))return;let o=new Audio(d);o.preload="auto",o.load(),this.audioCache.set(d,o)}async play(d){try{if(!this.audioCache.has(d))this.preload(d);let o=this.audioCache.get(d),h=this.host.gameData?.volume??100;o.volume=this.muted?0:h/100,o.currentTime=0,await o.play()}catch(o){if(o instanceof DOMException&&o.name==="AbortError")return;throw console.error("Failed to play sound:",o),o}}stop(){this.audioCache.forEach((d)=>{d.pause(),d.currentTime=0})}pause(){this.audioCache.forEach((d)=>{d.pause()})}}var n0=8,u1=2,P3=100;class E extends _0{static componentStyles=[];emit(d,o){let h=new CustomEvent(d,{bubbles:!0,cancelable:!1,composed:!0,detail:{},...o});return this.dispatchEvent(h),h}}var w0=S1(Symbol("game"));class J2 extends E{constructor(){super(...arguments);this.currency="USDC";this.isTheatreMode=!1;this.showFavorites=!1;this.balance=1000;this.baseUrl="https://us-api.dev.betorigami.com/provider/v1/games";this.authToken="";this.isCryptoMode=!0;this.gameStatsOpen=!1;this.betAmount="0.00";this.autobetNumberOfBets=0;this.hotkeysOpenEnabled=!1;this.volume=100;this.instantBetEnabled=!1}_soundController=new i5(this);firstUpdated(){this._soundController.preload("https://assets.betorigami.com/sounds/shared/bet.mp3"),this._soundController.preload("https://assets.betorigami.com/sounds/shared/click.mp3"),this._soundController.preload("https://assets.betorigami.com/sounds/shared/half-double.mp3"),this._soundController.preload("https://assets.betorigami.com/sounds/shared/secondary.mp3"),this._soundController.preload("https://assets.betorigami.com/sounds/shared/toggle.mp3"),this._soundController.preload("https://assets.betorigami.com/sounds/shared/win.mp3")}_gameProvider=new Y1(this,{context:w0,initialValue:{amount:this.betAmount,updateBalance:this.updateBalance.bind(this),currency:this.currency,isCryptoMode:this.isCryptoMode,isTheatreMode:this.isTheatreMode,showFavorites:this.showFavorites,balance:this.balance,baseUrl:this.baseUrl,authToken:this.authToken,gameStatsOpen:this.gameStatsOpen,autobetNumberOfBets:this.autobetNumberOfBets,hotkeysOpenEnabled:this.hotkeysOpenEnabled,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this),updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this)}});connectedCallback(){super.connectedCallback(),this.updateProviderValue()}updated(d){if(super.updated(d),d.has("currency")||d.has("isTheatreMode")||d.has("showFavorites")||d.has("balance")||d.has("baseUrl")||d.has("isCryptoMode")||d.has("authToken")||d.has("gameStatsOpen")||d.has("hotkeysOpenEnabled")||d.has("volume")||d.has("instantBetEnabled"))this.updateProviderValue()}get gameData(){return this._gameProvider.value}updateProviderValue(){this._gameProvider.setValue({amount:this.betAmount,currency:this.currency,updateBalance:this.updateBalance.bind(this),isCryptoMode:this.isCryptoMode,isTheatreMode:this.isTheatreMode,showFavorites:this.showFavorites,balance:this.balance,baseUrl:this.baseUrl,authToken:this.authToken,gameStatsOpen:this.gameStatsOpen,autobetNumberOfBets:this.autobetNumberOfBets,updateAutobetNumberOfBets:this.updateAutobetNumberOfBets.bind(this),hotkeysOpenEnabled:this.hotkeysOpenEnabled,volume:this.volume,instantBetEnabled:this.instantBetEnabled,soundController:this._soundController,updateHotkeysOpenEnabled:this.updateHotkeysOpenEnabled.bind(this),updateVolume:this.updateVolume.bind(this),updateInstantBetEnabled:this.updateInstantBetEnabled.bind(this)})}updateHotkeysOpenEnabled(d){this.hotkeysOpenEnabled=d,this.updateProviderValue()}updateVolume(d){this.volume=d,this.updateProviderValue()}updateInstantBetEnabled(d){this.instantBetEnabled=d,this.updateProviderValue()}updateAutobetNumberOfBets(d){this.autobetNumberOfBets=d,this.updateProviderValue()}updateBalance(d){if(d.isNaN())return;if(d.isLessThan(0)){this.betAmount="0";return}let o=d.toFixed(n0);this.betAmount=o,this.updateProviderValue()}render(){return M`<slot></slot>`}}Z([V({type:String})],J2.prototype,"currency",void 0),Z([V({type:Boolean})],J2.prototype,"isTheatreMode",void 0),Z([V({type:Boolean})],J2.prototype,"showFavorites",void 0),Z([V({type:Number})],J2.prototype,"balance",void 0),Z([V({type:String})],J2.prototype,"baseUrl",void 0),Z([V({type:String})],J2.prototype,"authToken",void 0),Z([V({type:Boolean})],J2.prototype,"isCryptoMode",void 0),Z([V({type:Boolean})],J2.prototype,"gameStatsOpen",void 0),Z([p()],J2.prototype,"betAmount",void 0),Z([p()],J2.prototype,"autobetNumberOfBets",void 0),Z([p()],J2.prototype,"hotkeysOpenEnabled",void 0),Z([p()],J2.prototype,"volume",void 0),Z([p()],J2.prototype,"instantBetEnabled",void 0),J2=Z([P("origami-game-provider-wrapper")],J2);var N0={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m0=(d)=>(...o)=>({["_$litDirective$"]:d,values:o});class E0{constructor(d){}get _$isConnected(){return this._$parent._$isConnected}_$initialize(d,o,h){this.__part=d,this._$parent=o,this.__attributeIndex=h}_$resolve(d,o){return this.update(d,o)}update(d,o){return this.render(...o)}}class y3 extends E0{constructor(d){super(d);if(d.type!==N0.ATTRIBUTE||d.name!=="class"||d.strings?.length>2)throw new Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(d){return" "+Object.keys(d).filter((o)=>d[o]).join(" ")+" "}update(d,[o]){if(this._previousClasses===void 0){if(this._previousClasses=new Set,d.strings!==void 0)this._staticClasses=new Set(d.strings.join(" ").split(/\s/).filter((f)=>f!==""));for(let f in o)if(o[f]&&!this._staticClasses?.has(f))this._previousClasses.add(f);return this.render(o)}let h=d.element.classList;for(let f of this._previousClasses)if(!(f in o))h.remove(f),this._previousClasses.delete(f);for(let f in o){let w=!!o[f];if(w!==this._previousClasses.has(f)&&!this._staticClasses?.has(f))if(w)h.add(f),this._previousClasses.add(f);else h.remove(f),this._previousClasses.delete(f)}return F0}}var d0=m0(y3);var Y0=(d)=>d??u;var r=s`
25
25
  :host {
26
26
  all: initial;
27
27
  display: block;
@@ -166,7 +166,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
166
166
  .button.selected:focus-visible {
167
167
  outline-color: rgba(55, 55, 55, 0.8);
168
168
  }
169
- `;class g5 extends E{constructor(){super(...arguments);this.option1="Manual";this.option2="Auto";this.value="Manual";this.disabled=!1;this.name="Toggle";this.class="";this.noRightBorderRadius=!1}static styles=[r,E3];handleOptionClick(d){if(this.value!==d)this.value=d,this.gameContext?.soundController?.play("/src/assets/sounds/shared/toggle.mp3").catch((o)=>console.error(o)),this.emit("toggle-change",{detail:{value:d},bubbles:!1,composed:!1})}render(){let d=this.value===this.option1,o=this.value===this.option2;return M`
169
+ `;class g5 extends E{constructor(){super(...arguments);this.option1="Manual";this.option2="Auto";this.value="Manual";this.disabled=!1;this.name="Toggle";this.class="";this.noRightBorderRadius=!1}static styles=[r,E3];handleOptionClick(d){if(this.value!==d)this.value=d,this.gameContext?.soundController?.play("https://assets.betorigami.com/sounds/shared/toggle.mp3").catch((o)=>console.error(o)),this.emit("toggle-change",{detail:{value:d},bubbles:!1,composed:!1})}render(){let d=this.value===this.option1,o=this.value===this.option2;return M`
170
170
  <button
171
171
  .variant=${d?"primary":"secondary"}
172
172
  @click=${()=>this.handleOptionClick(this.option1)}
@@ -1431,7 +1431,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
1431
1431
  flex-grow: 1;
1432
1432
  display: block;
1433
1433
  }
1434
- `];_gameContext=new c0(this,{context:w0,subscribe:!0,callback:(d)=>{if(!l(d.amount).isEqualTo(this.value)&&!this.isFocused)this.value=l(d.amount).toFixed(n0)}});firstUpdated(){if(this.gameData?.amount)this.value=l(this.gameData.amount).toFixed(n0)}handleValueOrBalanceChange(){if(!this.gameData)return;let d=this.value===""?"0":this.value,o=l(d),h=l(this.gameData.balance??0),f=this.isInvalid;if(o.isNaN())this.isInvalid=!0;else this.isInvalid=o.gt(h);if(f!==this.isInvalid)this.emit("bet-amount-validity-change",{detail:{isValid:!this.isInvalid}})}constructor(){super();this.isFocused=!1;this.isInvalid=!1;this.value="0";this.disabled=!1;this.label="Bet Amount";new u0(this,[{key:"a",callback:this.handleHalfBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled,repeat:!0,repeatInterval:200}},{key:"s",callback:this.handleDoubleBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled,repeat:!0,repeatInterval:200}},{key:"d",callback:this.handleZeroBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled}}])}updateBalanceState(d){if(d.isNaN())return;let o=d.toFixed(n0);this.gameData?.updateBalance(l(o))}handleCurrencyInputChange(d){let o=d.detail.value;this.value=o,this.updateBalanceState(l(o))}updateAmount(d){if(this.disabled)return;let o=d.isLessThan(0)?l(0):d,h=this.gameData?.isCryptoMode?n0:u1,f=o.decimalPlaces(h,l.ROUND_DOWN);if(f.toString()!==this.value)this.value=f.toFixed(h),this.updateBalanceState(l(f))}handleHalfBet(){if(this.disabled||l(this.value).isLessThanOrEqualTo(0))return;this.gameData?.soundController?.play("/src/assets/sounds/shared/half-double.mp3").catch((d)=>console.error(d)),this.updateAmount(l(this.value).dividedBy(2))}handleDoubleBet(){if(this.disabled)return;if(this.gameData?.soundController?.play("/src/assets/sounds/shared/half-double.mp3").catch((o)=>console.error(o)),l(this.value).isZero()){this.updateAmount(l(l("1").div(10**(this.gameData?.isCryptoMode?n0:u1))));return}let d=l.min(l(this.value).multipliedBy(2),l(this.gameData?.balance??0));this.updateAmount(d)}handleZeroBet(){if(this.disabled)return;this.gameData?.soundController?.play("/src/assets/sounds/shared/click.mp3").catch((d)=>console.error(d)),this.updateAmount(l(0))}handleDisplayInFiatChange(){this.value=this.gameData?.isCryptoMode?"0.00000000":"0.00",this.updateBalanceState(l(this.value))}render(){let d=this.gameData?.isCryptoMode?"0.00000000":"0.00",o=this.isInvalid?"Not enough balance":"";return M`
1434
+ `];_gameContext=new c0(this,{context:w0,subscribe:!0,callback:(d)=>{if(!l(d.amount).isEqualTo(this.value)&&!this.isFocused)this.value=l(d.amount).toFixed(n0)}});firstUpdated(){if(this.gameData?.amount)this.value=l(this.gameData.amount).toFixed(n0)}handleValueOrBalanceChange(){if(!this.gameData)return;let d=this.value===""?"0":this.value,o=l(d),h=l(this.gameData.balance??0),f=this.isInvalid;if(o.isNaN())this.isInvalid=!0;else this.isInvalid=o.gt(h);if(f!==this.isInvalid)this.emit("bet-amount-validity-change",{detail:{isValid:!this.isInvalid}})}constructor(){super();this.isFocused=!1;this.isInvalid=!1;this.value="0";this.disabled=!1;this.label="Bet Amount";new u0(this,[{key:"a",callback:this.handleHalfBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled,repeat:!0,repeatInterval:200}},{key:"s",callback:this.handleDoubleBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled,repeat:!0,repeatInterval:200}},{key:"d",callback:this.handleZeroBet.bind(this),options:{disabled:()=>this.disabled||!this.gameData?.hotkeysOpenEnabled}}])}updateBalanceState(d){if(d.isNaN())return;let o=d.toFixed(n0);this.gameData?.updateBalance(l(o))}handleCurrencyInputChange(d){let o=d.detail.value;this.value=o,this.updateBalanceState(l(o))}updateAmount(d){if(this.disabled)return;let o=d.isLessThan(0)?l(0):d,h=this.gameData?.isCryptoMode?n0:u1,f=o.decimalPlaces(h,l.ROUND_DOWN);if(f.toString()!==this.value)this.value=f.toFixed(h),this.updateBalanceState(l(f))}handleHalfBet(){if(this.disabled||l(this.value).isLessThanOrEqualTo(0))return;this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/half-double.mp3").catch((d)=>console.error(d)),this.updateAmount(l(this.value).dividedBy(2))}handleDoubleBet(){if(this.disabled)return;if(this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/half-double.mp3").catch((o)=>console.error(o)),l(this.value).isZero()){this.updateAmount(l(l("1").div(10**(this.gameData?.isCryptoMode?n0:u1))));return}let d=l.min(l(this.value).multipliedBy(2),l(this.gameData?.balance??0));this.updateAmount(d)}handleZeroBet(){if(this.disabled)return;this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/click.mp3").catch((d)=>console.error(d)),this.updateAmount(l(0))}handleDisplayInFiatChange(){this.value=this.gameData?.isCryptoMode?"0.00000000":"0.00",this.updateBalanceState(l(this.value))}render(){let d=this.gameData?.isCryptoMode?"0.00000000":"0.00",o=this.isInvalid?"Not enough balance":"";return M`
1435
1435
  <origami-raw-currency-input
1436
1436
  .value=${this.value}
1437
1437
  .label=${this.label}
@@ -1603,7 +1603,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
1603
1603
  flex-direction: column;
1604
1604
  }
1605
1605
  }
1606
- `;var $6=1e4,$8=100;function J8(d){if(d<$8)throw new Error("Exceeded Minimum edge allowed on platform");return new l($6).minus(d).dividedBy($6)}function Q6(d){if(!d)return new Uint8Array;let o=[];for(let h=0;h<d.length;h+=2)o.push(parseInt(d.substring(h,h+2),16));return new Uint8Array(o)}var j5=[new l(1)];function _2(d){if(!Number.isInteger(d)||d<0)throw new Error(`Factorial: <${d}> should be an integer greater or equal to 0`);let o=new l(d);if(!j5[d])j5[d]=o.multipliedBy(_2(d-1));return j5[d]}function m1(d,o){return _2(d).dividedBy(_2(o)).dividedBy(_2(new l(d).minus(o).toNumber()))}var Q8=new l(256),k2=new l(25),Y6=class{static getResults(d,o){let h=[],f=Array.from(Array(k2.toNumber()).keys());return d.map(Q6).every((w,x)=>{for(let b=0;b<8;b++){if(h.length>=o)return!1;let g=new l(0);for(let i=0;i<4;i++){let $=w[4*b+i];g=g.plus(new l($).dividedBy(Q8.pow(i+1)))}g=g.multipliedBy(k2.minus(new l(8*x+b))).integerValue(l.ROUND_DOWN),h.push(f.splice(g.toNumber(),1)[0])}return!0}),h}static hitMine=(d,o)=>{return o.some((h)=>h===d)};static calculateMultiplierBN(d,o,h){return J8(h).dividedBy(this.calculateWinChanceBN(d,o))}static calculateWinChanceBN(d,o){return m1(k2.minus(o).toNumber(),d).dividedBy(m1(k2.toNumber(),d))}},e=((d)=>{return d.CLASSIC="CLASSIC",d.LOW_RISK="LOW_RISK",d.MEDIUM_RISK="MEDIUM_RISK",d.HIGH_RISK="HIGH_RISK",d})(e||{}),Y8=new l(256),J6=new l(40),X8=[{tiles:1,payout:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]}},{tiles:2,payout:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]}},{tiles:3,payout:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]}},{tiles:4,payout:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]}},{tiles:5,payout:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]}},{tiles:6,payout:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]}},{tiles:7,payout:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]}},{tiles:8,payout:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]}},{tiles:9,payout:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]}},{tiles:10,payout:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}}],X6=class{static configs(){return X8}static calculateMultiplier(d,o,h){let f=h.filter((x)=>o.includes(x)),w=this.configs().find((x)=>x.tiles===o.length);if(!w)throw new Error(`No configuration found for ${o.length} tiles`);return new l(w.payout[d][f.length]??0)}static getResults(d,o){let h=[],f=Array.from(Array(J6.toNumber()).keys());return d.map(Q6).every((w,x)=>{for(let b=0;b<8;b++){if(h.length>=o)return!1;let g=new l(0);for(let i=0;i<4;i++){let $=w[4*b+i];g=g.plus(new l($).dividedBy(Y8.pow(i+1)))}g=g.multipliedBy(J6.minus(new l(8*x+b))).integerValue(l.ROUND_DOWN),h.push(f.splice(g.toNumber(),1)[0]+1)}return!0}),h}static getChance({correctPicks:d,picked:o}){return new l(m1(10,d)).multipliedBy(m1(30,o-d)).dividedBy(new l(m1(40,o)))}},j0=((d)=>{return d.ABOVE="ABOVE",d.BELOW="BELOW",d})(j0||{});class I0{authToken;baseUrl;constructor(d,o){this.authToken=d,this.baseUrl=o+"/games/mines"}async startManualBet(d){try{let h=await(await fetch(`${this.baseUrl}/start`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}async getActiveBet(){try{let o=await(await fetch(`${this.baseUrl}/active-bet`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`}})).json();if(!o.activeBet)return{success:!1,error:"No active bet"};return{success:!0,data:o.activeBet}}catch(d){return{success:!1,error:d?.message||"Unknown Error"}}}async selectTile(d){try{let h=await(await fetch(`${this.baseUrl}/next`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}async cashout(){try{let o=await(await fetch(`${this.baseUrl}/cashout`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify({})})).json();if(!o.id)throw new Error("Unknown error");return{success:!0,data:o}}catch(d){return{success:!1,error:d?.message||"Unknown Error"}}}async autobetPlay(d){try{let h=await(await fetch(`${this.baseUrl}/auto`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}static getInitialState=()=>{return{selectedTiles:[],mineLocations:[],minesCount:C1,numMinesRemaining:C1,numGemsRemaining:t0-C1,outcome:null,numGemsFound:0,state:"NO_GAME_ACTIVE",betAmount:l(0)}};static deriveSelectedTiles=(d)=>{if(!d?.length)return[];return Array.from(new Set(d.flatMap(({data:o})=>o.mines?.selected??[])))};static deriveMineLocations=(d)=>{return d?.find((h)=>h.data.mines?.minesResult?.length??!1)?.data.mines?.minesResult??[]};static getMinesBetInfo=(d)=>{let o=d?.map((w)=>({minesResult:w.data.mines?.minesResult??[],selected:w.data.mines?.selected??[]}))??[],h=[],f=[];return o.forEach(({minesResult:w,selected:x})=>{h.push(...x),f.push(...w)}),{selected:h,mines:f}};static deriveOutcome=(d)=>{let o=d?.actions??[],h=o[o.length-1]?.data.mines??null;if(!h||!h?.minesResult||h?.minesResult?.length===0)return null;return h.minesResult.length>=1&&h.selected?.length===0||l(d?.multiplier??0).isGreaterThan(0)?"WIN":"LOSS"};static deriveAutoOutcome=(d)=>{let h=(d?.actions??[])[0]?.data.mines??null;if(!h||!h.minesResult)return null;let f=h.selected??[];return h.minesResult.some((x)=>f.includes(x))?"LOSS":"WIN"};static calculateMinesMultiplier=(d,o)=>{if(!o)return l(0);if(d===0)return l(1);let h=Math.min(t0-d,o);return Y6.calculateMultiplierBN(d,h,P3)};static getState=(d)=>{let o=d?.actions??[];if(!o||o.length===0||!d)return I0.getInitialState();let h=I0.deriveOutcome(d),f=d?.actions?.[0]?.data.mines?.minesCount??0,w=h==="LOSS"?f-1:f,x=h?"VIEWING_RESULTS":"GAME_IN_PROGRESS",b=I0.deriveSelectedTiles(d?.actions),g=t0-f-b.length,i=I0.deriveMineLocations(d?.actions),$=b.filter((X)=>!i.includes(X)).length;return{currency:d?.currency,selectedTiles:b,mineLocations:i,outcome:h,minesCount:f,numMinesRemaining:w,numGemsFound:$,numGemsRemaining:g,state:x,betAmount:l(d.amount)}}}class I5 extends E{constructor(){super(...arguments);this.inputsDisabled=!1;this.minesState=null;this.isGameActive=!1;this.isLoading=!1;this.minesCount=3;this.isSelectingRandomTile=!1;this.isTileLoading=!1;this.isBetAmountValid=!0}static styles=[r,W2];get _isActionDisabled(){return this.isLoading||this.isSelectingRandomTile||this.isTileLoading}_playSound(d){let o={click:"/src/assets/sounds/shared/click.mp3",bet:"/src/assets/sounds/shared/bet.mp3"};this.gameData?.soundController?.play(o[d])}render(){let{betAmount:d=l(0),minesCount:o=0,numGemsFound:h=0,numGemsRemaining:f=0,selectedTiles:w=[]}=this.minesState??{},x=I0.calculateMinesMultiplier(h+1,o),b=I0.calculateMinesMultiplier(h,o),g=w.length>0,i=l(d).multipliedBy(b).minus(d).toFixed(8),$=l(d).multipliedBy(x).minus(d).toFixed(8);return M`
1606
+ `;var $6=1e4,$8=100;function J8(d){if(d<$8)throw new Error("Exceeded Minimum edge allowed on platform");return new l($6).minus(d).dividedBy($6)}function Q6(d){if(!d)return new Uint8Array;let o=[];for(let h=0;h<d.length;h+=2)o.push(parseInt(d.substring(h,h+2),16));return new Uint8Array(o)}var j5=[new l(1)];function _2(d){if(!Number.isInteger(d)||d<0)throw new Error(`Factorial: <${d}> should be an integer greater or equal to 0`);let o=new l(d);if(!j5[d])j5[d]=o.multipliedBy(_2(d-1));return j5[d]}function m1(d,o){return _2(d).dividedBy(_2(o)).dividedBy(_2(new l(d).minus(o).toNumber()))}var Q8=new l(256),k2=new l(25),Y6=class{static getResults(d,o){let h=[],f=Array.from(Array(k2.toNumber()).keys());return d.map(Q6).every((w,x)=>{for(let b=0;b<8;b++){if(h.length>=o)return!1;let g=new l(0);for(let i=0;i<4;i++){let $=w[4*b+i];g=g.plus(new l($).dividedBy(Q8.pow(i+1)))}g=g.multipliedBy(k2.minus(new l(8*x+b))).integerValue(l.ROUND_DOWN),h.push(f.splice(g.toNumber(),1)[0])}return!0}),h}static hitMine=(d,o)=>{return o.some((h)=>h===d)};static calculateMultiplierBN(d,o,h){return J8(h).dividedBy(this.calculateWinChanceBN(d,o))}static calculateWinChanceBN(d,o){return m1(k2.minus(o).toNumber(),d).dividedBy(m1(k2.toNumber(),d))}},e=((d)=>{return d.CLASSIC="CLASSIC",d.LOW_RISK="LOW_RISK",d.MEDIUM_RISK="MEDIUM_RISK",d.HIGH_RISK="HIGH_RISK",d})(e||{}),Y8=new l(256),J6=new l(40),X8=[{tiles:1,payout:{["CLASSIC"]:[0,3.96],["LOW_RISK"]:[0.7,1.85],["MEDIUM_RISK"]:[0.4,2.75],["HIGH_RISK"]:[0,3.96]}},{tiles:2,payout:{["CLASSIC"]:[0,1.9,4.5],["LOW_RISK"]:[0,2,3.8],["MEDIUM_RISK"]:[0,1.8,5.1],["HIGH_RISK"]:[0,0,17.1]}},{tiles:3,payout:{["CLASSIC"]:[0,1,3.1,10.4],["LOW_RISK"]:[0,1.1,1.38,26],["MEDIUM_RISK"]:[0,0,2.8,50],["HIGH_RISK"]:[0,0,0,81.5]}},{tiles:4,payout:{["CLASSIC"]:[0,0.8,1.8,5,22.5],["LOW_RISK"]:[0,0,2.2,7.9,90],["MEDIUM_RISK"]:[0,0,1.7,10,100],["HIGH_RISK"]:[0,0,0,10,259]}},{tiles:5,payout:{["CLASSIC"]:[0,0.25,1.4,4.1,16.5,36],["LOW_RISK"]:[0,0,1.5,4.2,13,300],["MEDIUM_RISK"]:[0,0,1.4,4,14,390],["HIGH_RISK"]:[0,0,0,4.5,48,450]}},{tiles:6,payout:{["CLASSIC"]:[0,0,1,3.68,7,16.5,40],["LOW_RISK"]:[0,0,1.1,2,6.2,100,700],["MEDIUM_RISK"]:[0,0,0,3,9,180,710],["HIGH_RISK"]:[0,0,0,0,11,350,710]}},{tiles:7,payout:{["CLASSIC"]:[0,0,0.47,3,4.5,14,31,60],["LOW_RISK"]:[0,0,1.1,1.6,3.5,15,225,700],["MEDIUM_RISK"]:[0,0,0,2,7,30,400,800],["HIGH_RISK"]:[0,0,0,0,7,90,400,800]}},{tiles:8,payout:{["CLASSIC"]:[0,0,0,2.2,4,13,22,55,70],["LOW_RISK"]:[0,0,1.1,1.5,2,5.5,39,100,800],["MEDIUM_RISK"]:[0,0,0,2,4,11,67,400,900],["HIGH_RISK"]:[0,0,0,0,5,20,270,600,900]}},{tiles:9,payout:{["CLASSIC"]:[0,0,0,1.55,3,8,15,44,60,85],["LOW_RISK"]:[0,0,1.1,1.3,1.7,2.5,7.5,50,250,1000],["MEDIUM_RISK"]:[0,0,0,2,2.5,5,15,100,500,1000],["HIGH_RISK"]:[0,0,0,0,4,11,56,500,800,1000]}},{tiles:10,payout:{["CLASSIC"]:[0,0,0,1.4,2.25,4.5,8,17,50,80,100],["LOW_RISK"]:[0,0,1.1,1.2,1.3,1.8,3.5,13,50,250,1000],["MEDIUM_RISK"]:[0,0,0,1.6,2,4,7,26,100,500,1000],["HIGH_RISK"]:[0,0,0,0,3.5,8,13,63,500,800,1000]}}],X6=class{static configs(){return X8}static calculateMultiplier(d,o,h){let f=h.filter((x)=>o.includes(x)),w=this.configs().find((x)=>x.tiles===o.length);if(!w)throw new Error(`No configuration found for ${o.length} tiles`);return new l(w.payout[d][f.length]??0)}static getResults(d,o){let h=[],f=Array.from(Array(J6.toNumber()).keys());return d.map(Q6).every((w,x)=>{for(let b=0;b<8;b++){if(h.length>=o)return!1;let g=new l(0);for(let i=0;i<4;i++){let $=w[4*b+i];g=g.plus(new l($).dividedBy(Y8.pow(i+1)))}g=g.multipliedBy(J6.minus(new l(8*x+b))).integerValue(l.ROUND_DOWN),h.push(f.splice(g.toNumber(),1)[0]+1)}return!0}),h}static getChance({correctPicks:d,picked:o}){return new l(m1(10,d)).multipliedBy(m1(30,o-d)).dividedBy(new l(m1(40,o)))}},j0=((d)=>{return d.ABOVE="ABOVE",d.BELOW="BELOW",d})(j0||{});class I0{authToken;baseUrl;constructor(d,o){this.authToken=d,this.baseUrl=o+"/games/mines"}async startManualBet(d){try{let h=await(await fetch(`${this.baseUrl}/start`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}async getActiveBet(){try{let o=await(await fetch(`${this.baseUrl}/active-bet`,{method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`}})).json();if(!o.activeBet)return{success:!1,error:"No active bet"};return{success:!0,data:o.activeBet}}catch(d){return{success:!1,error:d?.message||"Unknown Error"}}}async selectTile(d){try{let h=await(await fetch(`${this.baseUrl}/next`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}async cashout(){try{let o=await(await fetch(`${this.baseUrl}/cashout`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify({})})).json();if(!o.id)throw new Error("Unknown error");return{success:!0,data:o}}catch(d){return{success:!1,error:d?.message||"Unknown Error"}}}async autobetPlay(d){try{let h=await(await fetch(`${this.baseUrl}/auto`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}static getInitialState=()=>{return{selectedTiles:[],mineLocations:[],minesCount:C1,numMinesRemaining:C1,numGemsRemaining:t0-C1,outcome:null,numGemsFound:0,state:"NO_GAME_ACTIVE",betAmount:l(0)}};static deriveSelectedTiles=(d)=>{if(!d?.length)return[];return Array.from(new Set(d.flatMap(({data:o})=>o.mines?.selected??[])))};static deriveMineLocations=(d)=>{return d?.find((h)=>h.data.mines?.minesResult?.length??!1)?.data.mines?.minesResult??[]};static getMinesBetInfo=(d)=>{let o=d?.map((w)=>({minesResult:w.data.mines?.minesResult??[],selected:w.data.mines?.selected??[]}))??[],h=[],f=[];return o.forEach(({minesResult:w,selected:x})=>{h.push(...x),f.push(...w)}),{selected:h,mines:f}};static deriveOutcome=(d)=>{let o=d?.actions??[],h=o[o.length-1]?.data.mines??null;if(!h||!h?.minesResult||h?.minesResult?.length===0)return null;return h.minesResult.length>=1&&h.selected?.length===0||l(d?.multiplier??0).isGreaterThan(0)?"WIN":"LOSS"};static deriveAutoOutcome=(d)=>{let h=(d?.actions??[])[0]?.data.mines??null;if(!h||!h.minesResult)return null;let f=h.selected??[];return h.minesResult.some((x)=>f.includes(x))?"LOSS":"WIN"};static calculateMinesMultiplier=(d,o)=>{if(!o)return l(0);if(d===0)return l(1);let h=Math.min(t0-d,o);return Y6.calculateMultiplierBN(d,h,P3)};static getState=(d)=>{let o=d?.actions??[];if(!o||o.length===0||!d)return I0.getInitialState();let h=I0.deriveOutcome(d),f=d?.actions?.[0]?.data.mines?.minesCount??0,w=h==="LOSS"?f-1:f,x=h?"VIEWING_RESULTS":"GAME_IN_PROGRESS",b=I0.deriveSelectedTiles(d?.actions),g=t0-f-b.length,i=I0.deriveMineLocations(d?.actions),$=b.filter((X)=>!i.includes(X)).length;return{currency:d?.currency,selectedTiles:b,mineLocations:i,outcome:h,minesCount:f,numMinesRemaining:w,numGemsFound:$,numGemsRemaining:g,state:x,betAmount:l(d.amount)}}}class I5 extends E{constructor(){super(...arguments);this.inputsDisabled=!1;this.minesState=null;this.isGameActive=!1;this.isLoading=!1;this.minesCount=3;this.isSelectingRandomTile=!1;this.isTileLoading=!1;this.isBetAmountValid=!0}static styles=[r,W2];get _isActionDisabled(){return this.isLoading||this.isSelectingRandomTile||this.isTileLoading}_playSound(d){let o={click:"https://assets.betorigami.com/sounds/shared/click.mp3",bet:"https://assets.betorigami.com/sounds/shared/bet.mp3"};this.gameData?.soundController?.play(o[d])}render(){let{betAmount:d=l(0),minesCount:o=0,numGemsFound:h=0,numGemsRemaining:f=0,selectedTiles:w=[]}=this.minesState??{},x=I0.calculateMinesMultiplier(h+1,o),b=I0.calculateMinesMultiplier(h,o),g=w.length>0,i=l(d).multipliedBy(b).minus(d).toFixed(8),$=l(d).multipliedBy(x).minus(d).toFixed(8);return M`
1607
1607
  <div>
1608
1608
  <origami-bet-amount-input
1609
1609
  ?disabled=${this.inputsDisabled}
@@ -1950,7 +1950,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
1950
1950
  ?disabled=${this.autobetInProgress&&this.autobetStopping||this.betDisabled||!this.isBetAmountValid}
1951
1951
  ?fullWidth=${!0}
1952
1952
  ?isLoading=${this._isStarting||this.autobetStopping}
1953
- @click=${()=>{if(!this.autobetInProgress)this._isStarting=!0,this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3");this.emit("autobet-toggle",{detail:{...this.autobetSettings,numberOfBets:this._autobetProvider.value.numberOfBets}})}}
1953
+ @click=${()=>{if(!this.autobetInProgress)this._isStarting=!0,this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3");this.emit("autobet-toggle",{detail:{...this.autobetSettings,numberOfBets:this._autobetProvider.value.numberOfBets}})}}
1954
1954
  hotkey=" "
1955
1955
  >
1956
1956
  ${q8(this.autobetInProgress)}
@@ -4006,7 +4006,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
4006
4006
  .multiplier-default {
4007
4007
  color: var(--multiplier-default-color);
4008
4008
  }
4009
- `;var D8=250;class M5 extends E{constructor(){super(...arguments);this.resultMultiplier=null;this.isWin=!0;this.betId="";this.betTargetMultiplier=2;this.disableAnimation=!1;this.inGameDisplay=!1;this.currentValue=1;this.isAnimating=!1;this.queuedMultiplier=null}static styles=[r,l6];animationFrame=null;startTime=null;updated(d){if(d.has("resultMultiplier")&&!this.disableAnimation){if(this.resultMultiplier===null){this.currentValue=1;return}if(this.isAnimating)this.queuedMultiplier={resultMultiplier:this.resultMultiplier,isWin:this.isWin,betId:this.betId,betTargetMultiplier:this.betTargetMultiplier};else this.startAnimation(this.resultMultiplier,this.isWin,this.betId,this.betTargetMultiplier)}}disconnectedCallback(){if(super.disconnectedCallback(),this.animationFrame)cancelAnimationFrame(this.animationFrame)}startAnimation(d,o,h,f){if(this.animationFrame)cancelAnimationFrame(this.animationFrame);this.isAnimating=!0,this.currentValue=1,this.gameData?.soundController?.play("/src/assets/sounds/limbo/tick.mp3"),this.animationFrame=requestAnimationFrame((w)=>{this.startTime=w,this.updateAnimation(w,d,o,h,f)})}updateAnimation(d,o,h,f,w){if(!this.startTime)return;let x=d-this.startTime,b=Math.min(x/D8,1);if(o!==null)if(b>=1){if(this.currentValue=o,this.emit("limbo-multiplier-animation-end",{detail:{resultMultiplier:o,isWin:h,betId:f}}),this.isAnimating=!1,this.queuedMultiplier)this.startAnimation(this.queuedMultiplier.resultMultiplier,this.queuedMultiplier.isWin,this.queuedMultiplier.betId,this.queuedMultiplier.betTargetMultiplier),this.queuedMultiplier=null}else if(o>0)this.currentValue=o**b;else this.currentValue=1;else this.currentValue=1;if(b<1)this.animationFrame=requestAnimationFrame((g)=>this.updateAnimation(g,o,h,f,w))}_getMultiplierColor(){if(this.resultMultiplier!==null){if(this.resultMultiplier<this.betTargetMultiplier&&this.currentValue===this.resultMultiplier)return"multiplier-danger";if(this.currentValue>=this.betTargetMultiplier)return"multiplier-success"}return"multiplier-default"}render(){let d=["multiplier",this._getMultiplierColor()].filter(Boolean).join(" "),o=(this.resultMultiplier===0?0:this.currentValue).toFixed(2);return M`<div class=${d}>${this.disableAnimation?this.resultMultiplier?.toFixed(2):o}X</div>`}}Z([V({type:Number})],M5.prototype,"resultMultiplier",void 0),Z([V({type:Boolean})],M5.prototype,"isWin",void 0),Z([V({type:String})],M5.prototype,"betId",void 0),Z([V({type:Number})],M5.prototype,"betTargetMultiplier",void 0),Z([V({type:Boolean})],M5.prototype,"disableAnimation",void 0),Z([V({type:Boolean})],M5.prototype,"inGameDisplay",void 0),Z([p()],M5.prototype,"currentValue",void 0),Z([p()],M5.prototype,"isAnimating",void 0),Z([p()],M5.prototype,"queuedMultiplier",void 0),Z([i0({context:w0,subscribe:!0})],M5.prototype,"gameData",void 0),M5=Z([P("origami-limbo-multiplier")],M5);var p6=s`
4009
+ `;var D8=250;class M5 extends E{constructor(){super(...arguments);this.resultMultiplier=null;this.isWin=!0;this.betId="";this.betTargetMultiplier=2;this.disableAnimation=!1;this.inGameDisplay=!1;this.currentValue=1;this.isAnimating=!1;this.queuedMultiplier=null}static styles=[r,l6];animationFrame=null;startTime=null;updated(d){if(d.has("resultMultiplier")&&!this.disableAnimation){if(this.resultMultiplier===null){this.currentValue=1;return}if(this.isAnimating)this.queuedMultiplier={resultMultiplier:this.resultMultiplier,isWin:this.isWin,betId:this.betId,betTargetMultiplier:this.betTargetMultiplier};else this.startAnimation(this.resultMultiplier,this.isWin,this.betId,this.betTargetMultiplier)}}disconnectedCallback(){if(super.disconnectedCallback(),this.animationFrame)cancelAnimationFrame(this.animationFrame)}startAnimation(d,o,h,f){if(this.animationFrame)cancelAnimationFrame(this.animationFrame);this.isAnimating=!0,this.currentValue=1,this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/limbo/tick.mp3"),this.animationFrame=requestAnimationFrame((w)=>{this.startTime=w,this.updateAnimation(w,d,o,h,f)})}updateAnimation(d,o,h,f,w){if(!this.startTime)return;let x=d-this.startTime,b=Math.min(x/D8,1);if(o!==null)if(b>=1){if(this.currentValue=o,this.emit("limbo-multiplier-animation-end",{detail:{resultMultiplier:o,isWin:h,betId:f}}),this.isAnimating=!1,this.queuedMultiplier)this.startAnimation(this.queuedMultiplier.resultMultiplier,this.queuedMultiplier.isWin,this.queuedMultiplier.betId,this.queuedMultiplier.betTargetMultiplier),this.queuedMultiplier=null}else if(o>0)this.currentValue=o**b;else this.currentValue=1;else this.currentValue=1;if(b<1)this.animationFrame=requestAnimationFrame((g)=>this.updateAnimation(g,o,h,f,w))}_getMultiplierColor(){if(this.resultMultiplier!==null){if(this.resultMultiplier<this.betTargetMultiplier&&this.currentValue===this.resultMultiplier)return"multiplier-danger";if(this.currentValue>=this.betTargetMultiplier)return"multiplier-success"}return"multiplier-default"}render(){let d=["multiplier",this._getMultiplierColor()].filter(Boolean).join(" "),o=(this.resultMultiplier===0?0:this.currentValue).toFixed(2);return M`<div class=${d}>${this.disableAnimation?this.resultMultiplier?.toFixed(2):o}X</div>`}}Z([V({type:Number})],M5.prototype,"resultMultiplier",void 0),Z([V({type:Boolean})],M5.prototype,"isWin",void 0),Z([V({type:String})],M5.prototype,"betId",void 0),Z([V({type:Number})],M5.prototype,"betTargetMultiplier",void 0),Z([V({type:Boolean})],M5.prototype,"disableAnimation",void 0),Z([V({type:Boolean})],M5.prototype,"inGameDisplay",void 0),Z([p()],M5.prototype,"currentValue",void 0),Z([p()],M5.prototype,"isAnimating",void 0),Z([p()],M5.prototype,"queuedMultiplier",void 0),Z([i0({context:w0,subscribe:!0})],M5.prototype,"gameData",void 0),M5=Z([P("origami-limbo-multiplier")],M5);var p6=s`
4010
4010
  :host {
4011
4011
  display: flex;
4012
4012
  flex-direction: column;
@@ -4332,7 +4332,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
4332
4332
  background: #848484 !important;
4333
4333
  opacity: 1 !important;
4334
4334
  }
4335
- `;class l5 extends E{constructor(){super(...arguments);this.step=1;this.isRollLower=!1;this.value=0;this.min=0;this.max=100;this.disabled=!1;this.resultValue=null;this.showDice=!1;this.isWin=!1;this.inGameDisplay=!1;this.isResultVisible=!1;this.dimLosingSide=!1}static styles=[r,p6];fadeOutTimer;lastStepValue=null;lastSoundPlayTime=0;disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.fadeOutTimer)}updated(d){if(d.has("resultValue")&&this.resultValue!==null)this.isResultVisible=!0,this.dimLosingSide=!0,clearTimeout(this.fadeOutTimer),this.fadeOutTimer=setTimeout(()=>{this.isResultVisible=!1,this.dimLosingSide=!1},3000)}handleChange(d){let o=d.target,h=Number(o.value);if(this.lastStepValue===null)this.lastStepValue=h;else if(Math.floor(h)!==Math.floor(this.lastStepValue)){let f=Date.now();if(f-this.lastSoundPlayTime>50)this.gameData?.soundController?.play("/src/assets/sounds/dice/tick.mp3"),this.lastSoundPlayTime=f}if(this.lastStepValue=h,this.value=h,this.dimLosingSide)this.dimLosingSide=!1;if(this.isResultVisible)this.isResultVisible=!1,clearTimeout(this.fadeOutTimer);this.emit("slider-input-change",{detail:{value:h}})}handleFocus(d){d.target.select()}render(){let d={"dice-result":!0,win:this.isWin&&!this.inGameDisplay,lose:!this.isWin&&this.showDice&&!this.inGameDisplay},o=[0,25,50,75,100],h=this.showDice&&this.resultValue!==null&&this.dimLosingSide,f=this.isRollLower!==this.isWin,w={"track-fill":!0,reverse:!this.isRollLower,"losing-side":h&&f,"hide-track-color":this.inGameDisplay},x={"track-remaining":!0,reverse:!this.isRollLower,"losing-side":h&&!f,"hide-track-color":this.inGameDisplay};return M`
4335
+ `;class l5 extends E{constructor(){super(...arguments);this.step=1;this.isRollLower=!1;this.value=0;this.min=0;this.max=100;this.disabled=!1;this.resultValue=null;this.showDice=!1;this.isWin=!1;this.inGameDisplay=!1;this.isResultVisible=!1;this.dimLosingSide=!1}static styles=[r,p6];fadeOutTimer;lastStepValue=null;lastSoundPlayTime=0;disconnectedCallback(){super.disconnectedCallback(),clearTimeout(this.fadeOutTimer)}updated(d){if(d.has("resultValue")&&this.resultValue!==null)this.isResultVisible=!0,this.dimLosingSide=!0,clearTimeout(this.fadeOutTimer),this.fadeOutTimer=setTimeout(()=>{this.isResultVisible=!1,this.dimLosingSide=!1},3000)}handleChange(d){let o=d.target,h=Number(o.value);if(this.lastStepValue===null)this.lastStepValue=h;else if(Math.floor(h)!==Math.floor(this.lastStepValue)){let f=Date.now();if(f-this.lastSoundPlayTime>50)this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/dice/tick.mp3"),this.lastSoundPlayTime=f}if(this.lastStepValue=h,this.value=h,this.dimLosingSide)this.dimLosingSide=!1;if(this.isResultVisible)this.isResultVisible=!1,clearTimeout(this.fadeOutTimer);this.emit("slider-input-change",{detail:{value:h}})}handleFocus(d){d.target.select()}render(){let d={"dice-result":!0,win:this.isWin&&!this.inGameDisplay,lose:!this.isWin&&this.showDice&&!this.inGameDisplay},o=[0,25,50,75,100],h=this.showDice&&this.resultValue!==null&&this.dimLosingSide,f=this.isRollLower!==this.isWin,w={"track-fill":!0,reverse:!this.isRollLower,"losing-side":h&&f,"hide-track-color":this.inGameDisplay},x={"track-remaining":!0,reverse:!this.isRollLower,"losing-side":h&&!f,"hide-track-color":this.inGameDisplay};return M`
4336
4336
  <div
4337
4337
  class=${"slider-container"}
4338
4338
  style=${`--track-fill-width:${this.value}%; --result-position:${this.resultValue??0}%`}
@@ -6200,7 +6200,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
6200
6200
  <origami-button
6201
6201
  variant="primary"
6202
6202
  ?fullWidth=${!0}
6203
- @button-click=${()=>{this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.emit("dice-manual-play")}}
6203
+ @button-click=${()=>{this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.emit("dice-manual-play")}}
6204
6204
  ?disabled=${this.isPlaying||this.betDisabled||!this.isBetAmountValid}
6205
6205
  ?isLoading=${this.isPlaying}
6206
6206
  hotkey=" "
@@ -6377,7 +6377,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
6377
6377
  .selectedValue=${this.selectedValue}
6378
6378
  .diceDirection=${this.diceDirection}
6379
6379
  ></origami-dice-content-bottom>
6380
- `}}Z([V({type:Number})],f3.prototype,"selectedValue",void 0),Z([V({type:String})],f3.prototype,"diceDirection",void 0),Z([V({type:Boolean})],f3.prototype,"isPlaying",void 0),Z([V({type:Boolean})],f3.prototype,"showDice",void 0),Z([V({type:Boolean})],f3.prototype,"isWin",void 0),Z([V({type:Number})],f3.prototype,"resultValue",void 0),Z([V({type:Array})],f3.prototype,"history",void 0),f3=Z([P("origami-dice-content")],f3);var W1=(d)=>{if(d===1)return"Draw";if(d>1)return"Win";return"Loss"};function H0(d){return new Promise((o)=>setTimeout(o,d))}class g1 extends E{constructor(){super(...arguments);this.manualOrAuto="Manual";this.hasPendingBet=!1;this.autobetInProgress=!1;this.autobetStopping=!1}static soundsToPreload=[];static styles=[r];gameConsumer=new c0(this,{context:w0,subscribe:!0});get gameData(){return this.gameConsumer.value}get isToggleDisabled(){return this.autobetInProgress||this.hasPendingBet}get areInputsDisabled(){return this.autobetInProgress||this.hasPendingBet}getDelay(d){return this.gameData?.instantBetEnabled?Math.min(d/10,20):d}async forceUIUpdate(){this.requestUpdate(),await new Promise((d)=>setTimeout(d,0))}async executeInstantOrAnimated(d,o){if(this.gameData?.instantBetEnabled){let h=await d();return await this.forceUIUpdate(),h}else return await o()}async ensureMinimumDisplayTime(d=!1,o=500,h=500){if(this.gameData?.instantBetEnabled)await this.forceUIUpdate(),await H0(d?o:h)}firstUpdated(){this.constructor.soundsToPreload.forEach((o)=>{this.gameData?.soundController?.preload(o)})}async toggleAutobet(d){if(this.autobetInProgress){this.autobetStopping=!0;return}let o=d.detail;this.autobetStopping=!1,this.autobetInProgress=!0;let h=this.gameData?.amount??"0",f=l(0),w=h;try{this.hasPendingBet=!0;let x=!0;while(x&&!this.autobetStopping){let b=await this.executeAutobet(o,w);if(b.hasError){if(b.errorMessage)this.emit("show-alert",{detail:{type:"error",message:b.errorMessage}});else this.emit("show-alert",{detail:{type:"error",message:"An error occurred during autobet"}});x=!1;continue}if(f=f.plus(b.pnl),w=this.adjustBetAmount(o,b.gameOutcome,h,w),this.gameData?.updateBalance(l(w)),!this.isPnLWithinLimits(o,f)){x=!1;continue}if(this.gameData?.autobetNumberOfBets===0){x=!0;continue}this.gameData?.updateAutobetNumberOfBets(this.gameData?.autobetNumberOfBets-1),x=!Number.isNaN(this.gameData?.autobetNumberOfBets)&&!!this.gameData?.autobetNumberOfBets&&this.gameData?.autobetNumberOfBets>0}}catch(x){console.error("Error occurred in toggle autobet",x),this.emit("show-alert",{detail:{type:"error",message:"An unexpected error occurred"}})}finally{this.autobetInProgress=!1,this.hasPendingBet=!1,this.autobetStopping=!1}}adjustBetAmount(d,o,h,f){if(o==="Draw")return f;if(d.onWinStrategy==="Reset"&&o==="Win"||d.onLossStrategy==="Reset"&&o==="Loss")return h;let w=o==="Win"?d.onWinPercentage:d.onLossPercentage,x=l(w).dividedBy(100).plus(1);return l(f).multipliedBy(x).toFixed(2)}isPnLWithinLimits(d,o){let h=!l(d.stopOnLoss).eq(0)&&l(o).negated().gte(d.stopOnLoss),f=!l(d.stopOnProfit).eq(0)&&o.gte(d.stopOnProfit);return!h&&!f}}Z([p()],g1.prototype,"manualOrAuto",void 0),Z([p()],g1.prototype,"hasPendingBet",void 0),Z([p()],g1.prototype,"autobetInProgress",void 0),Z([p()],g1.prototype,"autobetStopping",void 0);class R2{static getRandomValueInRange(d,o){return Math.floor(Math.random()*(o-d+1))+d}async startBet(d){let{amount:o,direction:h,selectedValue:f}=d,w=R2.getRandomValueInRange(0,1e4),x=0;if(w>f)if(h===j0.ABOVE)x=l(Q0.getMultiplier(f,h)).toNumber();else x=0;else if(h===j0.BELOW)x=l(Q0.getMultiplier(f,h)).toNumber();else x=0;let b=l(o).multipliedBy(x).toString(),g={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"dice",currency:"USDC",edge:0.01,amount:o,payout:b,afterBalance:"1000",maxPayoutReached:!1,multiplier:x,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{dice:{resultValue:w,userValue:f,userDiceDirection:h}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:b}]};return await H0(250),{success:!0,data:g}}}class B2 extends g1{static soundsToPreload=["/src/assets/sounds/dice/roll.mp3","/src/assets/sounds/shared/win.mp3"];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}firstUpdated(){this.gameData?.soundController?.preload("/src/assets/sounds/dice/roll.mp3"),this.gameData?.soundController?.preload("/src/assets/sounds/shared/win.mp3")}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._diceManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._diceAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")this.dicePlay();else{let o=this._diceAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};diceRollOverToggle=()=>{this.diceDirection=this.diceDirection===j0.ABOVE?j0.BELOW:j0.ABOVE,this.selectedValue=Q0.getSelectedValueFromRollOver(this.selectedValue)};constructor(){super();this.diceDirection=j0.ABOVE;this.selectedValue=5000;this.isManualPlaying=!1;this.showDice=!1;this.isWin=!0;this.resultValue=null;this.history=[];new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}},{key:"q",callback:this.diceRollOverToggle.bind(this),options:{disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"w",callback:this.decreaseSlider.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"e",callback:this.increaseSlider.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}}])}decreaseSlider(){this.selectedValue=Math.max(5,this.selectedValue-100)}increaseSlider(){this.selectedValue=Math.min(9995,this.selectedValue+100)}get diceApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new Q0(this.gameData.authToken,this.gameData.baseUrl??""):new R2}async dicePlay(){this.isManualPlaying=!0,this.showDice=!1,this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3").catch((d)=>console.error(d));try{let d=await this.handleBetExecution(this.gameData.amount);if(!d.success)console.error(d.error)}catch(d){console.error("Error in dicePlay:",d)}finally{this.isManualPlaying=!1}}async handleBetExecution(d){if(!this.gameData.currency)throw new Error("Currency is not set");let o={amount:d,currency:this.gameData.currency,direction:this.diceDirection,selectedValue:this.selectedValue},h=await this.diceApi.startBet(o);if(h.success){if(this.gameData.soundController?.play("/src/assets/sounds/dice/roll.mp3").catch((b)=>{console.error("Failed to play sound:",b)}),this.isWin=l(h.data.multiplier).isGreaterThan(0),this.isWin)setTimeout(()=>{this.gameData.soundController?.play("/src/assets/sounds/shared/win.mp3").catch((b)=>{console.error("Failed to play sound:",b)})},300);this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}}),this.showDice=!0;let{actions:f}=h.data,w=f[f.length-1];if(!w)throw new Error("No action data received");let{resultValue:x}=w.data.dice;this.resultValue=x,this.addToHistory(x/100,this.isWin,h.data.id??"")}return h}addToHistory(d,o,h){let f=[...this.history,{multiplier:d,won:o,id:h}];this.history=f}async executeAutobet(d,o){try{let h=await this.handleBetExecution(o);if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};let f=h.data,w=l(f.payout).minus(f.amount),x=W1(f.multiplier);return{pnl:w,gameOutcome:x,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}sliderInputChange=(d)=>{this.selectedValue=d.detail.value*100};diceMultiplierChange=(d)=>{let o=+d.detail.multiplier;if(!Number.isNaN(o)&&o>0)this.selectedValue=Q0.getSelectedValueFromMultiplier(o,this.diceDirection);else this.selectedValue=0};diceWinChanceChange=(d)=>{let o=+d.detail.winChance;if(!Number.isNaN(o)&&o>0&&o<100)this.selectedValue=Q0.getSelectedValueFromWinChance(o,this.diceDirection);else this.selectedValue=0};render(){let d=l(Q0.getMultiplier(this.selectedValue,this.diceDirection)).multipliedBy(this.gameData.amount).minus(this.gameData.amount).toFixed(4),o=+Q0.getMultiplier(this.selectedValue,this.diceDirection),h=o<1.01||Number.isNaN(o)||o>9900;return M`
6380
+ `}}Z([V({type:Number})],f3.prototype,"selectedValue",void 0),Z([V({type:String})],f3.prototype,"diceDirection",void 0),Z([V({type:Boolean})],f3.prototype,"isPlaying",void 0),Z([V({type:Boolean})],f3.prototype,"showDice",void 0),Z([V({type:Boolean})],f3.prototype,"isWin",void 0),Z([V({type:Number})],f3.prototype,"resultValue",void 0),Z([V({type:Array})],f3.prototype,"history",void 0),f3=Z([P("origami-dice-content")],f3);var W1=(d)=>{if(d===1)return"Draw";if(d>1)return"Win";return"Loss"};function H0(d){return new Promise((o)=>setTimeout(o,d))}class g1 extends E{constructor(){super(...arguments);this.manualOrAuto="Manual";this.hasPendingBet=!1;this.autobetInProgress=!1;this.autobetStopping=!1}static soundsToPreload=[];static styles=[r];gameConsumer=new c0(this,{context:w0,subscribe:!0});get gameData(){return this.gameConsumer.value}get isToggleDisabled(){return this.autobetInProgress||this.hasPendingBet}get areInputsDisabled(){return this.autobetInProgress||this.hasPendingBet}getDelay(d){return this.gameData?.instantBetEnabled?Math.min(d/10,20):d}async forceUIUpdate(){this.requestUpdate(),await new Promise((d)=>setTimeout(d,0))}async executeInstantOrAnimated(d,o){if(this.gameData?.instantBetEnabled){let h=await d();return await this.forceUIUpdate(),h}else return await o()}async ensureMinimumDisplayTime(d=!1,o=500,h=500){if(this.gameData?.instantBetEnabled)await this.forceUIUpdate(),await H0(d?o:h)}firstUpdated(){this.constructor.soundsToPreload.forEach((o)=>{this.gameData?.soundController?.preload(o)})}async toggleAutobet(d){if(this.autobetInProgress){this.autobetStopping=!0;return}let o=d.detail;this.autobetStopping=!1,this.autobetInProgress=!0;let h=this.gameData?.amount??"0",f=l(0),w=h;try{this.hasPendingBet=!0;let x=!0;while(x&&!this.autobetStopping){let b=await this.executeAutobet(o,w);if(b.hasError){if(b.errorMessage)this.emit("show-alert",{detail:{type:"error",message:b.errorMessage}});else this.emit("show-alert",{detail:{type:"error",message:"An error occurred during autobet"}});x=!1;continue}if(f=f.plus(b.pnl),w=this.adjustBetAmount(o,b.gameOutcome,h,w),this.gameData?.updateBalance(l(w)),!this.isPnLWithinLimits(o,f)){x=!1;continue}if(this.gameData?.autobetNumberOfBets===0){x=!0;continue}this.gameData?.updateAutobetNumberOfBets(this.gameData?.autobetNumberOfBets-1),x=!Number.isNaN(this.gameData?.autobetNumberOfBets)&&!!this.gameData?.autobetNumberOfBets&&this.gameData?.autobetNumberOfBets>0}}catch(x){console.error("Error occurred in toggle autobet",x),this.emit("show-alert",{detail:{type:"error",message:"An unexpected error occurred"}})}finally{this.autobetInProgress=!1,this.hasPendingBet=!1,this.autobetStopping=!1}}adjustBetAmount(d,o,h,f){if(o==="Draw")return f;if(d.onWinStrategy==="Reset"&&o==="Win"||d.onLossStrategy==="Reset"&&o==="Loss")return h;let w=o==="Win"?d.onWinPercentage:d.onLossPercentage,x=l(w).dividedBy(100).plus(1);return l(f).multipliedBy(x).toFixed(2)}isPnLWithinLimits(d,o){let h=!l(d.stopOnLoss).eq(0)&&l(o).negated().gte(d.stopOnLoss),f=!l(d.stopOnProfit).eq(0)&&o.gte(d.stopOnProfit);return!h&&!f}}Z([p()],g1.prototype,"manualOrAuto",void 0),Z([p()],g1.prototype,"hasPendingBet",void 0),Z([p()],g1.prototype,"autobetInProgress",void 0),Z([p()],g1.prototype,"autobetStopping",void 0);class R2{static getRandomValueInRange(d,o){return Math.floor(Math.random()*(o-d+1))+d}async startBet(d){let{amount:o,direction:h,selectedValue:f}=d,w=R2.getRandomValueInRange(0,1e4),x=0;if(w>f)if(h===j0.ABOVE)x=l(Q0.getMultiplier(f,h)).toNumber();else x=0;else if(h===j0.BELOW)x=l(Q0.getMultiplier(f,h)).toNumber();else x=0;let b=l(o).multipliedBy(x).toString(),g={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"dice",currency:"USDC",edge:0.01,amount:o,payout:b,afterBalance:"1000",maxPayoutReached:!1,multiplier:x,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{dice:{resultValue:w,userValue:f,userDiceDirection:h}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:b}]};return await H0(250),{success:!0,data:g}}}class B2 extends g1{static soundsToPreload=["https://assets.betorigami.com/sounds/dice/roll.mp3","https://assets.betorigami.com/sounds/shared/win.mp3"];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}firstUpdated(){this.gameData?.soundController?.preload("https://assets.betorigami.com/sounds/dice/roll.mp3"),this.gameData?.soundController?.preload("https://assets.betorigami.com/sounds/shared/win.mp3")}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._diceManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._diceAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")this.dicePlay();else{let o=this._diceAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};diceRollOverToggle=()=>{this.diceDirection=this.diceDirection===j0.ABOVE?j0.BELOW:j0.ABOVE,this.selectedValue=Q0.getSelectedValueFromRollOver(this.selectedValue)};constructor(){super();this.diceDirection=j0.ABOVE;this.selectedValue=5000;this.isManualPlaying=!1;this.showDice=!1;this.isWin=!0;this.resultValue=null;this.history=[];new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}},{key:"q",callback:this.diceRollOverToggle.bind(this),options:{disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"w",callback:this.decreaseSlider.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"e",callback:this.increaseSlider.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>this.isManualPlaying||this.autobetInProgress||this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}}])}decreaseSlider(){this.selectedValue=Math.max(5,this.selectedValue-100)}increaseSlider(){this.selectedValue=Math.min(9995,this.selectedValue+100)}get diceApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new Q0(this.gameData.authToken,this.gameData.baseUrl??""):new R2}async dicePlay(){this.isManualPlaying=!0,this.showDice=!1,this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3").catch((d)=>console.error(d));try{let d=await this.handleBetExecution(this.gameData.amount);if(!d.success)console.error(d.error)}catch(d){console.error("Error in dicePlay:",d)}finally{this.isManualPlaying=!1}}async handleBetExecution(d){if(!this.gameData.currency)throw new Error("Currency is not set");let o={amount:d,currency:this.gameData.currency,direction:this.diceDirection,selectedValue:this.selectedValue},h=await this.diceApi.startBet(o);if(h.success){if(this.gameData.soundController?.play("https://assets.betorigami.com/sounds/dice/roll.mp3").catch((b)=>{console.error("Failed to play sound:",b)}),this.isWin=l(h.data.multiplier).isGreaterThan(0),this.isWin)setTimeout(()=>{this.gameData.soundController?.play("https://assets.betorigami.com/sounds/shared/win.mp3").catch((b)=>{console.error("Failed to play sound:",b)})},300);this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}}),this.showDice=!0;let{actions:f}=h.data,w=f[f.length-1];if(!w)throw new Error("No action data received");let{resultValue:x}=w.data.dice;this.resultValue=x,this.addToHistory(x/100,this.isWin,h.data.id??"")}return h}addToHistory(d,o,h){let f=[...this.history,{multiplier:d,won:o,id:h}];this.history=f}async executeAutobet(d,o){try{let h=await this.handleBetExecution(o);if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};let f=h.data,w=l(f.payout).minus(f.amount),x=W1(f.multiplier);return{pnl:w,gameOutcome:x,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}sliderInputChange=(d)=>{this.selectedValue=d.detail.value*100};diceMultiplierChange=(d)=>{let o=+d.detail.multiplier;if(!Number.isNaN(o)&&o>0)this.selectedValue=Q0.getSelectedValueFromMultiplier(o,this.diceDirection);else this.selectedValue=0};diceWinChanceChange=(d)=>{let o=+d.detail.winChance;if(!Number.isNaN(o)&&o>0&&o<100)this.selectedValue=Q0.getSelectedValueFromWinChance(o,this.diceDirection);else this.selectedValue=0};render(){let d=l(Q0.getMultiplier(this.selectedValue,this.diceDirection)).multipliedBy(this.gameData.amount).minus(this.gameData.amount).toFixed(4),o=+Q0.getMultiplier(this.selectedValue,this.diceDirection),h=o<1.01||Number.isNaN(o)||o>9900;return M`
6381
6381
  <origami-game-layout .gameType=${"dice"}>
6382
6382
  <origami-game-sidebar
6383
6383
  ?toggleDisabled=${this.isToggleDisabled}
@@ -6555,7 +6555,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
6555
6555
  class="grid-full-width"
6556
6556
  variant="primary"
6557
6557
  ?fullWidth=${!0}
6558
- @button-click=${()=>{this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.emit("keno-manual-play")}}
6558
+ @button-click=${()=>{this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.emit("keno-manual-play")}}
6559
6559
  ?disabled=${this.disableBet||this.isPlaying||this.autoselectRunning||!this.isBetAmountValid}
6560
6560
  ?isLoading=${this.isPlaying}
6561
6561
  hotkey=" "
@@ -6906,7 +6906,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
6906
6906
  .multipliersForSelectedTiles=${this.multipliersForSelectedTiles}
6907
6907
  ></origami-keno-content-bottom>
6908
6908
  </div>
6909
- `}}Z([V({type:Array})],g3.prototype,"selectedTiles",void 0),Z([V({type:Array})],g3.prototype,"resultTiles",void 0),Z([V({type:Boolean})],g3.prototype,"isPlaying",void 0),Z([V({type:Boolean})],g3.prototype,"gameOver",void 0),Z([V({type:Number})],g3.prototype,"multipliersForSelectedTiles",void 0),Z([V({type:Object})],g3.prototype,"payout",void 0),Z([V({type:Boolean})],g3.prototype,"gameWinPopupShowing",void 0),Z([V({type:Number})],g3.prototype,"multiplier",void 0),Z([V({type:String})],g3.prototype,"risk",void 0),Z([V({type:String})],g3.prototype,"betAmount",void 0),Z([V({type:String})],g3.prototype,"betId",void 0),Z([V({type:Boolean})],g3.prototype,"autoselectRunning",void 0),g3=Z([P("origami-keno-content")],g3);var v2=10,Z4=40;class z3{authToken;baseUrl;constructor(d,o){this.authToken=d,this.baseUrl=o+"/games/keno"}async startBet(d){try{let h=await(await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}}var y8={[e.LOW_RISK]:10,[e.MEDIUM_RISK]:8,[e.CLASSIC]:8,[e.HIGH_RISK]:5},E8={[e.LOW_RISK]:{min:1.2,max:2.5},[e.MEDIUM_RISK]:{min:1.5,max:5},[e.HIGH_RISK]:{min:2,max:10},[e.CLASSIC]:{min:2,max:10}};class o2{static generateRandomTiles(d,o=[]){let h=Array.from({length:Z4},(f,w)=>w+1).filter((f)=>!o.includes(f));return[...h].sort(()=>0.5-Math.random()).slice(0,Math.min(d,h.length))}static calculateMultiplier(d,o,h){let f=d.filter((g)=>o.includes(g)).length,{min:w,max:x}=E8[h],b=f===0?0:w+f/d.length*(x-w);return Number.parseFloat(b.toFixed(2))}startBet=async(d)=>{let{amount:o,riskLevel:h,selectedTiles:f}=d,w=o2.generateRandomTiles(y8[h]),x=o2.calculateMultiplier(f,w,h),b=l(o).multipliedBy(x).toString(),g={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"keno",currency:"USDC",edge:0.01,amount:o,payout:b,afterBalance:"1000",maxPayoutReached:!1,multiplier:x,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{keno:{selectedTiles:f,resultTiles:w,multiplier:x,riskLevel:h}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:b}]};return await H0(250),{success:!0,data:g}}}class S2 extends g1{static soundsToPreload=["/src/assets/sounds/keno/gem.mp3","/src/assets/sounds/keno/clear.mp3","/src/assets/sounds/shared/win.mp3","/src/assets/sounds/shared/secondary.mp3"];get isToggleDisabled(){return this.autobetInProgress||this.isManualPlaying||this.autoselectRunning}get areInputsDisabled(){return this.autobetInProgress||this.isManualPlaying||this.autoselectRunning}get kenoApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new z3(this.gameData.authToken,this.gameData.baseUrl):new o2}async kenoPlay(){if(this.gameWinPopupShowing=!1,this.selectedTiles.length===0){alert("Please select at least one tile");return}this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.isManualPlaying=!0,this.resultTiles=[],this.gameOver=!1;try{let d=await this.handleBetExecution(this.gameData?.amount??"0",this.getDelay(200));if(!d.success){console.error(d.error);return}this.betId=d.data.id}catch(d){console.error("Error in kenoPlay:",d)}finally{this.isManualPlaying=!1,this.gameOver=!0}}async handleBetExecution(d,o){if(!this.gameData?.currency)throw new Error("Currency is not set");let h={amount:d,currency:this.gameData.currency,riskLevel:this.kenoRisk,selectedTiles:this.selectedTiles},f=await this.kenoApi.startBet(h);if(f.success){let{actions:w}=f.data,x=w[w.length-1]?.data.keno;if(!x)throw new Error("No keno data found");if(this.multiplier=f.data.multiplier,await this.executeInstantOrAnimated(async()=>{x.resultTiles.forEach((b)=>{if(this.selectedTiles.includes(b))this.gameData?.soundController?.play("/src/assets/sounds/keno/gem.mp3").catch((g)=>console.error(g));else this.gameData?.soundController?.play("/src/assets/sounds/shared/secondary.mp3").catch((g)=>console.error(g))}),this.resultTiles=[...x.resultTiles]},async()=>{for(let b of x.resultTiles){if(this.selectedTiles.includes(b))this.gameData?.soundController?.play("/src/assets/sounds/keno/gem.mp3").catch((g)=>console.error(g));else this.gameData?.soundController?.play("/src/assets/sounds/shared/secondary.mp3").catch((g)=>console.error(g));this.resultTiles=[...this.resultTiles,b],await H0(o)}}),this.gameWinPopupShowing=l(f.data.multiplier).isGreaterThan(0),this.gameWinPopupShowing)this.gameData?.soundController?.play("/src/assets/sounds/shared/win.mp3").catch((b)=>console.error(b));this.payout=l(f.data.payout),this.addToHistory(l(f.data.multiplier).toNumber(),this.gameWinPopupShowing),this.emit("balance-change",{detail:{balance:Number(f.data.afterBalance),currency:this.gameData.currency}})}return f}addToHistory(d,o){let h=[...this.history,{multiplier:d,won:o}];this.history=h.slice(-5)}async executeAutobet(d,o){try{if(!this.gameData?.currency)throw new Error("Currency is not set");if(this.resultTiles=[],this.gameOver=!1,this.gameWinPopupShowing=!1,this.gameData?.instantBetEnabled)await this.forceUIUpdate();if(this.selectedTiles.length===0)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"Please select at least one tile"};let h={amount:o,currency:this.gameData.currency,riskLevel:this.kenoRisk,selectedTiles:this.selectedTiles},f=await this.kenoApi.startBet(h);if(!f.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:f.error||"Error processing bet"};this.multiplier=f.data.multiplier;let w=f.data,x=l(w.payout).minus(w.amount),b=W1(w.multiplier),g=w.actions,i=g[g.length-1]?.data.keno;if(!i)throw new Error("No keno data found");if(await this.executeInstantOrAnimated(async()=>{i.resultTiles.forEach(($)=>{if(this.selectedTiles.includes($))this.gameData?.soundController?.play("/src/assets/sounds/keno/gem.mp3").catch((X)=>console.error(X));else this.gameData?.soundController?.play("/src/assets/sounds/shared/secondary.mp3").catch((X)=>console.error(X))}),this.resultTiles=[...i.resultTiles]},async()=>{for(let $ of i.resultTiles){if(this.selectedTiles.includes($))this.gameData?.soundController?.play("/src/assets/sounds/keno/gem.mp3").catch((X)=>console.error(X));else this.gameData?.soundController?.play("/src/assets/sounds/shared/secondary.mp3").catch((X)=>console.error(X));this.resultTiles=[...this.resultTiles,$],await H0(this.getDelay(200))}}),this.gameWinPopupShowing=l(w.multiplier).isGreaterThan(0),this.gameWinPopupShowing)this.gameData?.soundController?.play("/src/assets/sounds/shared/win.mp3").catch(($)=>console.error($));if(this.payout=l(w.payout),this.addToHistory(w.multiplier,this.gameWinPopupShowing),await this.ensureMinimumDisplayTime(this.gameWinPopupShowing,500,500),!this.gameData?.instantBetEnabled)await H0(this.getDelay(500));return this.gameWinPopupShowing=!1,this.emit("balance-change",{detail:{balance:Number(f.data.afterBalance),currency:this.gameData.currency}}),{pnl:x,gameOutcome:b,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}finally{this.gameOver=!0}}handleTileClick=(d)=>{if(this.gameOver)this.newGame();if(this.autoselectRunning)return;if(this.gameData?.soundController?.play("/src/assets/sounds/shared/click.mp3").catch((h)=>console.error(h)),this.selectedTiles.includes(d.detail.tile))this.selectedTiles=this.selectedTiles.filter((h)=>h!==d.detail.tile);else if(this.selectedTiles.length<v2)this.selectedTiles=[...this.selectedTiles,d.detail.tile]};handleRiskChange=(d)=>{this.kenoRisk=d.detail.value};autoPick=async()=>{if(this.isManualPlaying||this.autoselectRunning)return;if(this.autoselectRunning=!0,this.hadTilesBeforeAutopick=this.selectedTiles.length>0,this.resultTiles=[],this.gameWinPopupShowing=!1,this.selectedTiles.length>=v2)this.selectedTiles=[];let d=v2-this.selectedTiles.length;if(d<=0)return;let h=Array.from({length:40},(x,b)=>b+1).filter((x)=>!this.selectedTiles.includes(x));if(h.length===0)return;let w=[...h].sort(()=>0.5-Math.random()).slice(0,d);await this.executeInstantOrAnimated(async()=>{this.gameData?.soundController?.play("/src/assets/sounds/shared/click.mp3").catch((x)=>console.error(x)),this.selectedTiles=[...this.selectedTiles,...w]},async()=>{for(let x of w)this.gameData?.soundController?.play("/src/assets/sounds/shared/click.mp3").catch((b)=>console.error(b)),await H0(this.getDelay(200)),this.selectedTiles=[...this.selectedTiles,x]}),this.autoselectRunning=!1,this.hadTilesBeforeAutopick=!1};clearTable=()=>{if(this.isManualPlaying||this.autoselectRunning)return;this.gameData?.soundController?.play("/src/assets/sounds/keno/clear.mp3").catch((d)=>console.error(d)),this.gameWinPopupShowing=!1,this.selectedTiles=[],this.resultTiles=[],this.payout=null};newGame=()=>{this.gameWinPopupShowing=!1,this.resultTiles=[],this.payout=null};render(){let d=this.autoselectRunning?10:this.selectedTiles.length,o=this.selectedTiles.length>0||this.autoselectRunning;return M`
6909
+ `}}Z([V({type:Array})],g3.prototype,"selectedTiles",void 0),Z([V({type:Array})],g3.prototype,"resultTiles",void 0),Z([V({type:Boolean})],g3.prototype,"isPlaying",void 0),Z([V({type:Boolean})],g3.prototype,"gameOver",void 0),Z([V({type:Number})],g3.prototype,"multipliersForSelectedTiles",void 0),Z([V({type:Object})],g3.prototype,"payout",void 0),Z([V({type:Boolean})],g3.prototype,"gameWinPopupShowing",void 0),Z([V({type:Number})],g3.prototype,"multiplier",void 0),Z([V({type:String})],g3.prototype,"risk",void 0),Z([V({type:String})],g3.prototype,"betAmount",void 0),Z([V({type:String})],g3.prototype,"betId",void 0),Z([V({type:Boolean})],g3.prototype,"autoselectRunning",void 0),g3=Z([P("origami-keno-content")],g3);var v2=10,Z4=40;class z3{authToken;baseUrl;constructor(d,o){this.authToken=d,this.baseUrl=o+"/games/keno"}async startBet(d){try{let h=await(await fetch(`${this.baseUrl}/play`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(d)})).json();if(!h.id)throw new Error("Unknown error");return{success:!0,data:h}}catch(o){return{success:!1,error:o?.message||"Unknown Error"}}}}var y8={[e.LOW_RISK]:10,[e.MEDIUM_RISK]:8,[e.CLASSIC]:8,[e.HIGH_RISK]:5},E8={[e.LOW_RISK]:{min:1.2,max:2.5},[e.MEDIUM_RISK]:{min:1.5,max:5},[e.HIGH_RISK]:{min:2,max:10},[e.CLASSIC]:{min:2,max:10}};class o2{static generateRandomTiles(d,o=[]){let h=Array.from({length:Z4},(f,w)=>w+1).filter((f)=>!o.includes(f));return[...h].sort(()=>0.5-Math.random()).slice(0,Math.min(d,h.length))}static calculateMultiplier(d,o,h){let f=d.filter((g)=>o.includes(g)).length,{min:w,max:x}=E8[h],b=f===0?0:w+f/d.length*(x-w);return Number.parseFloat(b.toFixed(2))}startBet=async(d)=>{let{amount:o,riskLevel:h,selectedTiles:f}=d,w=o2.generateRandomTiles(y8[h]),x=o2.calculateMultiplier(f,w,h),b=l(o).multipliedBy(x).toString(),g={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"keno",currency:"USDC",edge:0.01,amount:o,payout:b,afterBalance:"1000",maxPayoutReached:!1,multiplier:x,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{keno:{selectedTiles:f,resultTiles:w,multiplier:x,riskLevel:h}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:b}]};return await H0(250),{success:!0,data:g}}}class S2 extends g1{static soundsToPreload=["https://assets.betorigami.com/sounds/keno/gem.mp3","https://assets.betorigami.com/sounds/keno/clear.mp3","https://assets.betorigami.com/sounds/shared/win.mp3","https://assets.betorigami.com/sounds/shared/secondary.mp3"];get isToggleDisabled(){return this.autobetInProgress||this.isManualPlaying||this.autoselectRunning}get areInputsDisabled(){return this.autobetInProgress||this.isManualPlaying||this.autoselectRunning}get kenoApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new z3(this.gameData.authToken,this.gameData.baseUrl):new o2}async kenoPlay(){if(this.gameWinPopupShowing=!1,this.selectedTiles.length===0){alert("Please select at least one tile");return}this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3").catch((d)=>console.error(d)),this.isManualPlaying=!0,this.resultTiles=[],this.gameOver=!1;try{let d=await this.handleBetExecution(this.gameData?.amount??"0",this.getDelay(200));if(!d.success){console.error(d.error);return}this.betId=d.data.id}catch(d){console.error("Error in kenoPlay:",d)}finally{this.isManualPlaying=!1,this.gameOver=!0}}async handleBetExecution(d,o){if(!this.gameData?.currency)throw new Error("Currency is not set");let h={amount:d,currency:this.gameData.currency,riskLevel:this.kenoRisk,selectedTiles:this.selectedTiles},f=await this.kenoApi.startBet(h);if(f.success){let{actions:w}=f.data,x=w[w.length-1]?.data.keno;if(!x)throw new Error("No keno data found");if(this.multiplier=f.data.multiplier,await this.executeInstantOrAnimated(async()=>{x.resultTiles.forEach((b)=>{if(this.selectedTiles.includes(b))this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/keno/gem.mp3").catch((g)=>console.error(g));else this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/secondary.mp3").catch((g)=>console.error(g))}),this.resultTiles=[...x.resultTiles]},async()=>{for(let b of x.resultTiles){if(this.selectedTiles.includes(b))this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/keno/gem.mp3").catch((g)=>console.error(g));else this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/secondary.mp3").catch((g)=>console.error(g));this.resultTiles=[...this.resultTiles,b],await H0(o)}}),this.gameWinPopupShowing=l(f.data.multiplier).isGreaterThan(0),this.gameWinPopupShowing)this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/win.mp3").catch((b)=>console.error(b));this.payout=l(f.data.payout),this.addToHistory(l(f.data.multiplier).toNumber(),this.gameWinPopupShowing),this.emit("balance-change",{detail:{balance:Number(f.data.afterBalance),currency:this.gameData.currency}})}return f}addToHistory(d,o){let h=[...this.history,{multiplier:d,won:o}];this.history=h.slice(-5)}async executeAutobet(d,o){try{if(!this.gameData?.currency)throw new Error("Currency is not set");if(this.resultTiles=[],this.gameOver=!1,this.gameWinPopupShowing=!1,this.gameData?.instantBetEnabled)await this.forceUIUpdate();if(this.selectedTiles.length===0)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"Please select at least one tile"};let h={amount:o,currency:this.gameData.currency,riskLevel:this.kenoRisk,selectedTiles:this.selectedTiles},f=await this.kenoApi.startBet(h);if(!f.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:f.error||"Error processing bet"};this.multiplier=f.data.multiplier;let w=f.data,x=l(w.payout).minus(w.amount),b=W1(w.multiplier),g=w.actions,i=g[g.length-1]?.data.keno;if(!i)throw new Error("No keno data found");if(await this.executeInstantOrAnimated(async()=>{i.resultTiles.forEach(($)=>{if(this.selectedTiles.includes($))this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/keno/gem.mp3").catch((X)=>console.error(X));else this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/secondary.mp3").catch((X)=>console.error(X))}),this.resultTiles=[...i.resultTiles]},async()=>{for(let $ of i.resultTiles){if(this.selectedTiles.includes($))this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/keno/gem.mp3").catch((X)=>console.error(X));else this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/secondary.mp3").catch((X)=>console.error(X));this.resultTiles=[...this.resultTiles,$],await H0(this.getDelay(200))}}),this.gameWinPopupShowing=l(w.multiplier).isGreaterThan(0),this.gameWinPopupShowing)this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/win.mp3").catch(($)=>console.error($));if(this.payout=l(w.payout),this.addToHistory(w.multiplier,this.gameWinPopupShowing),await this.ensureMinimumDisplayTime(this.gameWinPopupShowing,500,500),!this.gameData?.instantBetEnabled)await H0(this.getDelay(500));return this.gameWinPopupShowing=!1,this.emit("balance-change",{detail:{balance:Number(f.data.afterBalance),currency:this.gameData.currency}}),{pnl:x,gameOutcome:b,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}finally{this.gameOver=!0}}handleTileClick=(d)=>{if(this.gameOver)this.newGame();if(this.autoselectRunning)return;if(this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/click.mp3").catch((h)=>console.error(h)),this.selectedTiles.includes(d.detail.tile))this.selectedTiles=this.selectedTiles.filter((h)=>h!==d.detail.tile);else if(this.selectedTiles.length<v2)this.selectedTiles=[...this.selectedTiles,d.detail.tile]};handleRiskChange=(d)=>{this.kenoRisk=d.detail.value};autoPick=async()=>{if(this.isManualPlaying||this.autoselectRunning)return;if(this.autoselectRunning=!0,this.hadTilesBeforeAutopick=this.selectedTiles.length>0,this.resultTiles=[],this.gameWinPopupShowing=!1,this.selectedTiles.length>=v2)this.selectedTiles=[];let d=v2-this.selectedTiles.length;if(d<=0)return;let h=Array.from({length:40},(x,b)=>b+1).filter((x)=>!this.selectedTiles.includes(x));if(h.length===0)return;let w=[...h].sort(()=>0.5-Math.random()).slice(0,d);await this.executeInstantOrAnimated(async()=>{this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/click.mp3").catch((x)=>console.error(x)),this.selectedTiles=[...this.selectedTiles,...w]},async()=>{for(let x of w)this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/click.mp3").catch((b)=>console.error(b)),await H0(this.getDelay(200)),this.selectedTiles=[...this.selectedTiles,x]}),this.autoselectRunning=!1,this.hadTilesBeforeAutopick=!1};clearTable=()=>{if(this.isManualPlaying||this.autoselectRunning)return;this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/keno/clear.mp3").catch((d)=>console.error(d)),this.gameWinPopupShowing=!1,this.selectedTiles=[],this.resultTiles=[],this.payout=null};newGame=()=>{this.gameWinPopupShowing=!1,this.resultTiles=[],this.payout=null};render(){let d=this.autoselectRunning?10:this.selectedTiles.length,o=this.selectedTiles.length>0||this.autoselectRunning;return M`
6910
6910
  <origami-game-layout>
6911
6911
  <origami-game-sidebar
6912
6912
  ?toggleDisabled=${this.isToggleDisabled}
@@ -7023,7 +7023,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
7023
7023
  <origami-button
7024
7024
  variant="primary"
7025
7025
  ?fullWidth=${!0}
7026
- @button-click=${()=>{this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3"),this.emit("limbo-manual-play")}}
7026
+ @button-click=${()=>{this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3"),this.emit("limbo-manual-play")}}
7027
7027
  ?isLoading=${this.isPlaying}
7028
7028
  ?disabled=${this.isPlaying||!this.isBetAmountValid}
7029
7029
  hotkey=" "
@@ -7171,7 +7171,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
7171
7171
  .targetMultiplier=${this.targetMultiplier}
7172
7172
  ></origami-limbo-content-bottom>
7173
7173
  </div>
7174
- `}}Z([V({type:Number})],Q3.prototype,"targetMultiplier",void 0),Z([V({type:Number})],Q3.prototype,"betTargetMultiplier",void 0),Z([V({type:Array})],Q3.prototype,"history",void 0),Z([V({type:Number})],Q3.prototype,"resultMultiplier",void 0),Z([V({type:Boolean})],Q3.prototype,"isWin",void 0),Z([V({type:String})],Q3.prototype,"betId",void 0),Z([V({type:Boolean})],Q3.prototype,"isPlaying",void 0),Q3=Z([P("origami-limbo-content")],Q3);class N2{static getRandomMultiplier(){return l(Math.max(1,Math.min(+(1/Math.random()),1e6)).toFixed(2)).times(100).toString()}startBet=async(d)=>{let{amount:o,targetMultiplier:h}=d,f=N2.getRandomMultiplier(),w=l(f).gte(h),x=w?l(o).multipliedBy(h).toString():"0",b={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"limbo",currency:"USDC",edge:0.01,amount:o,payout:x,afterBalance:"1000",maxPayoutReached:!1,multiplier:w?h:0,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{limbo:{targetMultiplier:h,resultMultiplier:l(f).toNumber()}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:x}]};return await H0(250),{success:!0,data:b}}}var Y3=100;class D2 extends g1{static soundsToPreload=["/src/assets/sounds/limbo/tick.mp3","/src/assets/sounds/shared/win.mp3"];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get limboApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new k1(this.gameData.authToken,this.gameData.baseUrl):new N2}firstUpdated(){this.gameData?.soundController?.preload("/src/assets/sounds/limbo/tick.mp3")}async limboPlay(){this.isManualPlaying=!0,this.gameData?.soundController?.play("/src/assets/sounds/shared/bet.mp3").catch((d)=>console.error(d));try{let d=await this.handleBetExecution(this.gameData?.amount??"0");if(!d.success){console.error(d.error);return}let o=d.data.id;await new Promise((f)=>{let w=(x)=>{if(x.detail.betId===o)this.removeEventListener("limbo-multiplier-animation-end",w),f()};this.addEventListener("limbo-multiplier-animation-end",w)})}catch(d){console.error("Error in limboPlay:",d)}finally{this.isManualPlaying=!1}}async handleBetExecution(d){if(this.resultMultiplier=null,!this.gameData?.currency)throw new Error("Currency is not set");let o={amount:d,currency:this.gameData.currency,targetMultiplier:this.targetMultiplier*Y3},h=await this.limboApi.startBet(o);if(h.success){this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}});let{actions:f,id:w}=h.data,x=f[f.length-1];if(!x)throw new Error("No action data received");let{limbo:b}=x.data;this.resultMultiplier=b.resultMultiplier/Y3,this.betTargetMultiplier=b.targetMultiplier/Y3,this.isWin=b.targetMultiplier<=b.resultMultiplier,this.betId=w}return h}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._limboManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._limboAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")this.limboPlay();else{let o=this._limboAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};constructor(){super();this.targetMultiplier=2;this.resultMultiplier=null;this.isManualPlaying=!1;this.isWin=!1;this.history=[];this.betTargetMultiplier=2;this.betId="";new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}}])}async executeAutobet(d,o){try{let h=await this.handleBetExecution(o);if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};let f=h.data.id;await new Promise((i)=>{let $=(X)=>{if(X.detail.betId===f)this.removeEventListener("limbo-multiplier-animation-end",$),i()};this.addEventListener("limbo-multiplier-animation-end",$)});let x=h.data,b=l(x.payout).minus(x.amount),g=W1(x.multiplier);return{pnl:b,gameOutcome:g,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}multiplierChange=(d)=>{let o=+d.detail.multiplier;this.targetMultiplier=o};calculateProfitOnWin(){return l(this.gameData?.amount??"0").multipliedBy(this.targetMultiplier).minus(this.gameData?.amount??"0").toFixed(4)}winChanceChange=(d)=>{let o=+d.detail.winChance;this.targetMultiplier=+k1.calculateMultiplier(o)};multiplierAnimationEnd=(d)=>{let{resultMultiplier:o,isWin:h,betId:f}=d.detail;if(h)this.gameData?.soundController?.play("/src/assets/sounds/shared/win.mp3").catch((w)=>console.error(w));this.history=[...this.history.filter((w)=>w.id!==f),{multiplier:o,won:h,id:f}],this.dispatchEvent(new CustomEvent("limbo-multiplier-animation-end",{detail:d.detail,bubbles:!0,composed:!0}))};render(){let d=this.calculateProfitOnWin(),o=k1.calculateMultiplier(this.targetMultiplier),h=this.targetMultiplier<1.01||Number.isNaN(this.targetMultiplier);return M`
7174
+ `}}Z([V({type:Number})],Q3.prototype,"targetMultiplier",void 0),Z([V({type:Number})],Q3.prototype,"betTargetMultiplier",void 0),Z([V({type:Array})],Q3.prototype,"history",void 0),Z([V({type:Number})],Q3.prototype,"resultMultiplier",void 0),Z([V({type:Boolean})],Q3.prototype,"isWin",void 0),Z([V({type:String})],Q3.prototype,"betId",void 0),Z([V({type:Boolean})],Q3.prototype,"isPlaying",void 0),Q3=Z([P("origami-limbo-content")],Q3);class N2{static getRandomMultiplier(){return l(Math.max(1,Math.min(+(1/Math.random()),1e6)).toFixed(2)).times(100).toString()}startBet=async(d)=>{let{amount:o,targetMultiplier:h}=d,f=N2.getRandomMultiplier(),w=l(f).gte(h),x=w?l(o).multipliedBy(h).toString():"0",b={id:crypto.randomUUID(),tenantId:"origami-casino",userId:"mock-user",usdRate:1,gameId:"limbo",currency:"USDC",edge:0.01,amount:o,payout:x,afterBalance:"1000",maxPayoutReached:!1,multiplier:w?h:0,clientSeed:"mock-seed",randomValue:"mock-random",proof:"mock-proof",nonce:"1",completedAt:new Date().toISOString(),actions:[{id:crypto.randomUUID(),data:{limbo:{targetMultiplier:h,resultMultiplier:l(f).toNumber()}},type:"END_BET",actionIndex:0,originalActionId:null,betAmount:o,payoutAmount:x}]};return await H0(250),{success:!0,data:b}}}var Y3=100;class D2 extends g1{static soundsToPreload=["https://assets.betorigami.com/sounds/limbo/tick.mp3","https://assets.betorigami.com/sounds/shared/win.mp3"];get isToggleDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get areInputsDisabled(){return this.isManualPlaying||this.autobetInProgress||this.autobetStopping}get limboApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new k1(this.gameData.authToken,this.gameData.baseUrl):new N2}firstUpdated(){this.gameData?.soundController?.preload("https://assets.betorigami.com/sounds/limbo/tick.mp3")}async limboPlay(){this.isManualPlaying=!0,this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/bet.mp3").catch((d)=>console.error(d));try{let d=await this.handleBetExecution(this.gameData?.amount??"0");if(!d.success){console.error(d.error);return}let o=d.data.id;await new Promise((f)=>{let w=(x)=>{if(x.detail.betId===o)this.removeEventListener("limbo-multiplier-animation-end",w),f()};this.addEventListener("limbo-multiplier-animation-end",w)})}catch(d){console.error("Error in limboPlay:",d)}finally{this.isManualPlaying=!1}}async handleBetExecution(d){if(this.resultMultiplier=null,!this.gameData?.currency)throw new Error("Currency is not set");let o={amount:d,currency:this.gameData.currency,targetMultiplier:this.targetMultiplier*Y3},h=await this.limboApi.startBet(o);if(h.success){this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}});let{actions:f,id:w}=h.data,x=f[f.length-1];if(!x)throw new Error("No action data received");let{limbo:b}=x.data;this.resultMultiplier=b.resultMultiplier/Y3,this.betTargetMultiplier=b.targetMultiplier/Y3,this.isWin=b.targetMultiplier<=b.resultMultiplier,this.betId=w}return h}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._limboManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._limboAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")this.limboPlay();else{let o=this._limboAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};constructor(){super();this.targetMultiplier=2;this.resultMultiplier=null;this.isManualPlaying=!1;this.isWin=!1;this.history=[];this.betTargetMultiplier=2;this.betId="";new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{repeat:!0,repeatInterval:200,disabled:this.isSpacebarDisabled}}])}async executeAutobet(d,o){try{let h=await this.handleBetExecution(o);if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};let f=h.data.id;await new Promise((i)=>{let $=(X)=>{if(X.detail.betId===f)this.removeEventListener("limbo-multiplier-animation-end",$),i()};this.addEventListener("limbo-multiplier-animation-end",$)});let x=h.data,b=l(x.payout).minus(x.amount),g=W1(x.multiplier);return{pnl:b,gameOutcome:g,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}multiplierChange=(d)=>{let o=+d.detail.multiplier;this.targetMultiplier=o};calculateProfitOnWin(){return l(this.gameData?.amount??"0").multipliedBy(this.targetMultiplier).minus(this.gameData?.amount??"0").toFixed(4)}winChanceChange=(d)=>{let o=+d.detail.winChance;this.targetMultiplier=+k1.calculateMultiplier(o)};multiplierAnimationEnd=(d)=>{let{resultMultiplier:o,isWin:h,betId:f}=d.detail;if(h)this.gameData?.soundController?.play("https://assets.betorigami.com/sounds/shared/win.mp3").catch((w)=>console.error(w));this.history=[...this.history.filter((w)=>w.id!==f),{multiplier:o,won:h,id:f}],this.dispatchEvent(new CustomEvent("limbo-multiplier-animation-end",{detail:d.detail,bubbles:!0,composed:!0}))};render(){let d=this.calculateProfitOnWin(),o=k1.calculateMultiplier(this.targetMultiplier),h=this.targetMultiplier<1.01||Number.isNaN(this.targetMultiplier);return M`
7175
7175
  <origami-game-layout>
7176
7176
  <origami-game-sidebar
7177
7177
  ?toggleDisabled=${this.isToggleDisabled}
@@ -7237,7 +7237,7 @@ Please use the static 'html' tag function. See https://lit.dev/docs/templates/ex
7237
7237
  ?hitBomb=${this.hitBomb}
7238
7238
  .loadingTiles=${this.loadingTiles}
7239
7239
  ></origami-mines-grid>
7240
- `}}Z([V({type:Boolean})],X3.prototype,"isAuto",void 0),Z([V({type:Array})],X3.prototype,"autobetSelectedTiles",void 0),Z([V({type:Boolean})],X3.prototype,"autobetInProgress",void 0),Z([V({type:Object})],X3.prototype,"minesState",void 0),Z([V({type:Boolean})],X3.prototype,"showWinPopup",void 0),Z([V({type:Boolean})],X3.prototype,"hitBomb",void 0),Z([V({type:Array})],X3.prototype,"loadingTiles",void 0),X3=Z([P("origami-mines-content")],X3);class X4{previousValues=[];callback;constructor(d){this.callback=d}check(d){if(d.length!==this.previousValues.length||d.some((h,f)=>h!==this.previousValues[f]))this.callback([...d],[...this.previousValues]),this.previousValues=[...d]}}class T2 extends g1{static soundsToPreload=["/src/assets/sounds/mines/bomb.mp3","/src/assets/sounds/mines/gem.mp3","/src/assets/sounds/shared/win.mp3"];_playSound(d){let o={click:"/src/assets/sounds/shared/click.mp3",bet:"/src/assets/sounds/shared/bet.mp3",win:"/src/assets/sounds/shared/win.mp3",bomb:"/src/assets/sounds/mines/bomb.mp3",gem:"/src/assets/sounds/mines/gem.mp3"};this.gameData?.soundController?.play(o[d]).catch((h)=>console.error(h))}authTokenWatcher=new X4(([d],[o])=>{if(d&&d!==o)this.isCheckingForSession=!0,this.getMinesActiveBet()});get isToggleDisabled(){let d=this.getMinesState;return this.autobetInProgress||d?.state==="GAME_IN_PROGRESS"||this.isCheckingForSession||this.isLoading}get areInputsDisabled(){let d=this.getMinesState;return this.autobetInProgress||d?.state==="GAME_IN_PROGRESS"||this.isCheckingForSession||this.isLoading}get isGameActive(){return this.getMinesState?.state==="GAME_IN_PROGRESS"}get minesApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new I0(this.gameData.authToken,this.gameData.baseUrl??""):new x0}addToHistory(d,o,h){if(!h)return;let f=[...this.history,{multiplier:d,won:o,id:h}];this.history=f}async getMinesActiveBet(){try{let d=await this.minesApi.getActiveBet();if(!d.success){this.emit("show-alert",{detail:{type:"error",message:d.error}});return}if(d.data){if(this.gameData?.updateBalance(l(d.data.amount)),this.minesData=d.data,this.manualOrAuto!=="Manual")this.manualOrAuto="Manual"}}finally{this.isCheckingForSession=!1}}async firstUpdated(){super.firstUpdated(),await this.getMinesActiveBet()}updated(d){super.updated(d),this.authTokenWatcher.check([this.gameData?.authToken])}get getMinesState(){if(!this.minesData)return null;return I0.getState(this.minesData)}async executeAutobet(d,o){if(this.minesData=null,this.autobetSelectedTiles.length===0)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"Please select at least one tile to autobet"};try{if(!this.gameData?.currency)throw new Error("Currency is not set");let h=await this.minesApi.autobetPlay({amount:o,currency:this.gameData.currency,minesCount:this.minesCount,selected:this.autobetSelectedTiles});if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};this.minesData=h.data,this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}});let f=h.data,{multiplier:w,id:x}=f,b=l(w).isGreaterThan(0);if(b)this._playSound("win");this.addToHistory(w,b,x);let g=l(f.payout).minus(f.amount),i=W1(f.multiplier);return await this.waitForAnimationsComplete(b),{pnl:g,gameOutcome:i,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}async toggleAutobet(d){if(this.autobetSelectedTiles.length===0){this.emit("show-alert",{detail:{type:"error",message:"Please select at least one tile to autobet"}});return}if(!this.autobetInProgress)this.emit("show-alert",{detail:{id:"autobet-started",type:"warning",message:"Autobet Started",autoCloseDelay:5000}});await super.toggleAutobet(d)}minesClickHandler=async(d)=>{if(this._playSound("click"),this.manualOrAuto==="Auto"){if(this.autobetSelectedTiles.includes(d.detail.tile))this.autobetSelectedTiles=this.autobetSelectedTiles.filter((h)=>h!==d.detail.tile);else if(this.autobetSelectedTiles.length<25-this.minesCount)this.autobetSelectedTiles=[...this.autobetSelectedTiles,d.detail.tile];this.minesData=null;return}let o=d.detail.tile;await this.minesNext(o)};async minesManualStart(){if(this.isLoading=!0,this.minesData=null,this._playSound("bet"),!this.gameData?.currency)throw new Error("Currency is not set");let d={amount:this.gameData?.amount??"0",currency:this.gameData.currency,minesCount:this.minesCount},o=await this.minesApi.startManualBet(d);if(!o.success){this.emit("show-alert",{detail:{type:"error",message:o.error}});return}this.emit("balance-change",{detail:{balance:Number(o.data.afterBalance),currency:this.gameData.currency}}),this.minesData=o.data,this.isLoading=!1}async minesChooseRandomTile(){this.isSelectingRandomTile=!0,this._playSound("click");let o=this.getMinesState?.selectedTiles??[],h=Array.from({length:t0},(w,x)=>x).filter((w)=>!o.includes(w)),f=h[Math.floor(Math.random()*h.length)];if(f!==void 0)await this.minesNext(f);this.isSelectingRandomTile=!1}async minesNext(d){if(this.loadingTiles.includes(d))return;this.loadingTiles=[...this.loadingTiles,d];try{let o=await this.minesApi.selectTile({betId:this.minesData?.id??"",selected:[d]});if(!o.success){this.emit("show-alert",{detail:{type:"error",message:o.error}});return}let h=!!o.data.completedAt;if(this._playSound(h?"bomb":"gem"),this.minesData=o.data,o.data.completedAt){let{multiplier:f,id:w}=o.data,x=l(f).isGreaterThan(0);this.addToHistory(f,x,w)}}finally{this.loadingTiles=this.loadingTiles.filter((o)=>o!==d)}}async minesCashout(){this.isLoading=!0;let d=await this.minesApi.cashout();if(!d.success){this.emit("show-alert",{detail:{type:"error",message:d.error}}),this.isLoading=!1;return}let o=d.data?.afterBalance,h=d.data?.currency;if(o&&h)this.emit("balance-change",{detail:{balance:Number(o),currency:h}});if(this.isLoading=!1,this.minesData=d.data,this.minesData){let{multiplier:f,id:w}=this.minesData,x=l(f).isGreaterThan(0);if(x)this._playSound("win");this.addToHistory(f,x,w)}}onManualOrAutoChange(){this.minesData=null,this.autobetSelectedTiles=[]}onMinesCountChange(){if(this.manualOrAuto==="Auto"&&this.autobetSelectedTiles.length>25-this.minesCount)this.autobetSelectedTiles=[]}onAutobetChange(){if(!this.autobetInProgress)this.minesData=null}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._minesManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._minesAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")if(this.isGameActive)this.minesCashout();else this.minesManualStart();else{let o=this._minesAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};pickRandomTile=()=>{if(!this.isGameActive)return;this.minesChooseRandomTile()};async waitForAnimationsComplete(d){if(await H0(200),d)await H0(150);await H0(200)}constructor(){super();this.minesCount=3;this.autobetSelectedTiles=[];this.minesData=null;this.isLoading=!1;this.isSelectingRandomTile=!1;this.history=[];this.isCheckingForSession=!0;this.loadingTiles=[];new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{disabled:this.isSpacebarDisabled}},{key:"q",callback:this.pickRandomTile.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>!this.isGameActive||this.autobetInProgress&&!this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"w",callback:this.minesCashout.bind(this),options:{disabled:()=>!this.isGameActive||(this.getMinesState?.selectedTiles.length??0)===0||!this.gameData?.hotkeysOpenEnabled}}])}render(){let d=this.getMinesState,o=this.minesData?.multiplier,h=d?.state==="VIEWING_RESULTS"&&d?.outcome==="WIN",f=this.minesData?.payout,w=this.gameData?.currency??"USDC",x=d?.mineLocations?.some((b)=>d?.selectedTiles?.includes(b))??!1;return M`
7240
+ `}}Z([V({type:Boolean})],X3.prototype,"isAuto",void 0),Z([V({type:Array})],X3.prototype,"autobetSelectedTiles",void 0),Z([V({type:Boolean})],X3.prototype,"autobetInProgress",void 0),Z([V({type:Object})],X3.prototype,"minesState",void 0),Z([V({type:Boolean})],X3.prototype,"showWinPopup",void 0),Z([V({type:Boolean})],X3.prototype,"hitBomb",void 0),Z([V({type:Array})],X3.prototype,"loadingTiles",void 0),X3=Z([P("origami-mines-content")],X3);class X4{previousValues=[];callback;constructor(d){this.callback=d}check(d){if(d.length!==this.previousValues.length||d.some((h,f)=>h!==this.previousValues[f]))this.callback([...d],[...this.previousValues]),this.previousValues=[...d]}}class T2 extends g1{static soundsToPreload=["https://assets.betorigami.com/sounds/mines/bomb.mp3","https://assets.betorigami.com/sounds/mines/gem.mp3","https://assets.betorigami.com/sounds/shared/win.mp3"];_playSound(d){let o={click:"https://assets.betorigami.com/sounds/shared/click.mp3",bet:"https://assets.betorigami.com/sounds/shared/bet.mp3",win:"https://assets.betorigami.com/sounds/shared/win.mp3",bomb:"https://assets.betorigami.com/sounds/mines/bomb.mp3",gem:"https://assets.betorigami.com/sounds/mines/gem.mp3"};this.gameData?.soundController?.play(o[d]).catch((h)=>console.error(h))}authTokenWatcher=new X4(([d],[o])=>{if(d&&d!==o)this.isCheckingForSession=!0,this.getMinesActiveBet()});get isToggleDisabled(){let d=this.getMinesState;return this.autobetInProgress||d?.state==="GAME_IN_PROGRESS"||this.isCheckingForSession||this.isLoading}get areInputsDisabled(){let d=this.getMinesState;return this.autobetInProgress||d?.state==="GAME_IN_PROGRESS"||this.isCheckingForSession||this.isLoading}get isGameActive(){return this.getMinesState?.state==="GAME_IN_PROGRESS"}get minesApi(){return!!this.gameData.authToken&&!!this.gameData.baseUrl?new I0(this.gameData.authToken,this.gameData.baseUrl??""):new x0}addToHistory(d,o,h){if(!h)return;let f=[...this.history,{multiplier:d,won:o,id:h}];this.history=f}async getMinesActiveBet(){try{let d=await this.minesApi.getActiveBet();if(!d.success){this.emit("show-alert",{detail:{type:"error",message:d.error}});return}if(d.data){if(this.gameData?.updateBalance(l(d.data.amount)),this.minesData=d.data,this.manualOrAuto!=="Manual")this.manualOrAuto="Manual"}}finally{this.isCheckingForSession=!1}}async firstUpdated(){super.firstUpdated(),await this.getMinesActiveBet()}updated(d){super.updated(d),this.authTokenWatcher.check([this.gameData?.authToken])}get getMinesState(){if(!this.minesData)return null;return I0.getState(this.minesData)}async executeAutobet(d,o){if(this.minesData=null,this.autobetSelectedTiles.length===0)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"Please select at least one tile to autobet"};try{if(!this.gameData?.currency)throw new Error("Currency is not set");let h=await this.minesApi.autobetPlay({amount:o,currency:this.gameData.currency,minesCount:this.minesCount,selected:this.autobetSelectedTiles});if(!h.success)return{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:h.error||"Error processing bet"};this.minesData=h.data,this.emit("balance-change",{detail:{balance:Number(h.data.afterBalance),currency:this.gameData.currency}});let f=h.data,{multiplier:w,id:x}=f,b=l(w).isGreaterThan(0);if(b)this._playSound("win");this.addToHistory(w,b,x);let g=l(f.payout).minus(f.amount),i=W1(f.multiplier);return await this.waitForAnimationsComplete(b),{pnl:g,gameOutcome:i,hasError:!1}}catch(h){return console.error("Error in executeAutobet:",h),{pnl:l(0),gameOutcome:"Draw",hasError:!0,errorMessage:"An unexpected error occurred"}}}async toggleAutobet(d){if(this.autobetSelectedTiles.length===0){this.emit("show-alert",{detail:{type:"error",message:"Please select at least one tile to autobet"}});return}if(!this.autobetInProgress)this.emit("show-alert",{detail:{id:"autobet-started",type:"warning",message:"Autobet Started",autoCloseDelay:5000}});await super.toggleAutobet(d)}minesClickHandler=async(d)=>{if(this._playSound("click"),this.manualOrAuto==="Auto"){if(this.autobetSelectedTiles.includes(d.detail.tile))this.autobetSelectedTiles=this.autobetSelectedTiles.filter((h)=>h!==d.detail.tile);else if(this.autobetSelectedTiles.length<25-this.minesCount)this.autobetSelectedTiles=[...this.autobetSelectedTiles,d.detail.tile];this.minesData=null;return}let o=d.detail.tile;await this.minesNext(o)};async minesManualStart(){if(this.isLoading=!0,this.minesData=null,this._playSound("bet"),!this.gameData?.currency)throw new Error("Currency is not set");let d={amount:this.gameData?.amount??"0",currency:this.gameData.currency,minesCount:this.minesCount},o=await this.minesApi.startManualBet(d);if(!o.success){this.emit("show-alert",{detail:{type:"error",message:o.error}});return}this.emit("balance-change",{detail:{balance:Number(o.data.afterBalance),currency:this.gameData.currency}}),this.minesData=o.data,this.isLoading=!1}async minesChooseRandomTile(){this.isSelectingRandomTile=!0,this._playSound("click");let o=this.getMinesState?.selectedTiles??[],h=Array.from({length:t0},(w,x)=>x).filter((w)=>!o.includes(w)),f=h[Math.floor(Math.random()*h.length)];if(f!==void 0)await this.minesNext(f);this.isSelectingRandomTile=!1}async minesNext(d){if(this.loadingTiles.includes(d))return;this.loadingTiles=[...this.loadingTiles,d];try{let o=await this.minesApi.selectTile({betId:this.minesData?.id??"",selected:[d]});if(!o.success){this.emit("show-alert",{detail:{type:"error",message:o.error}});return}let h=!!o.data.completedAt;if(this._playSound(h?"bomb":"gem"),this.minesData=o.data,o.data.completedAt){let{multiplier:f,id:w}=o.data,x=l(f).isGreaterThan(0);this.addToHistory(f,x,w)}}finally{this.loadingTiles=this.loadingTiles.filter((o)=>o!==d)}}async minesCashout(){this.isLoading=!0;let d=await this.minesApi.cashout();if(!d.success){this.emit("show-alert",{detail:{type:"error",message:d.error}}),this.isLoading=!1;return}let o=d.data?.afterBalance,h=d.data?.currency;if(o&&h)this.emit("balance-change",{detail:{balance:Number(o),currency:h}});if(this.isLoading=!1,this.minesData=d.data,this.minesData){let{multiplier:f,id:w}=this.minesData,x=l(f).isGreaterThan(0);if(x)this._playSound("win");this.addToHistory(f,x,w)}}onManualOrAutoChange(){this.minesData=null,this.autobetSelectedTiles=[]}onMinesCountChange(){if(this.manualOrAuto==="Auto"&&this.autobetSelectedTiles.length>25-this.minesCount)this.autobetSelectedTiles=[]}onAutobetChange(){if(!this.autobetInProgress)this.minesData=null}isSpacebarDisabled=()=>{if(!this.gameData?.hotkeysOpenEnabled)return!0;if(this.manualOrAuto==="Manual")return this._minesManualEl?.shadowRoot?.querySelector("origami-button")?.disabled??!0;else return this._minesAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn")?.disabled??!0};handleSpacebar=()=>{if(this.isSpacebarDisabled())return;if(this.manualOrAuto==="Manual")if(this.isGameActive)this.minesCashout();else this.minesManualStart();else{let o=this._minesAutoEl?.shadowRoot?.querySelector("origami-generic-autobet")?.shadowRoot?.querySelector(".bet-btn");if(o instanceof HTMLElement)o.click()}};pickRandomTile=()=>{if(!this.isGameActive)return;this.minesChooseRandomTile()};async waitForAnimationsComplete(d){if(await H0(200),d)await H0(150);await H0(200)}constructor(){super();this.minesCount=3;this.autobetSelectedTiles=[];this.minesData=null;this.isLoading=!1;this.isSelectingRandomTile=!1;this.history=[];this.isCheckingForSession=!0;this.loadingTiles=[];new u0(this,[{key:" ",callback:this.handleSpacebar.bind(this),options:{disabled:this.isSpacebarDisabled}},{key:"q",callback:this.pickRandomTile.bind(this),options:{repeat:!0,repeatInterval:200,disabled:()=>!this.isGameActive||this.autobetInProgress&&!this.autobetStopping||!this.gameData?.hotkeysOpenEnabled}},{key:"w",callback:this.minesCashout.bind(this),options:{disabled:()=>!this.isGameActive||(this.getMinesState?.selectedTiles.length??0)===0||!this.gameData?.hotkeysOpenEnabled}}])}render(){let d=this.getMinesState,o=this.minesData?.multiplier,h=d?.state==="VIEWING_RESULTS"&&d?.outcome==="WIN",f=this.minesData?.payout,w=this.gameData?.currency??"USDC",x=d?.mineLocations?.some((b)=>d?.selectedTiles?.includes(b))??!1;return M`
7241
7241
  <origami-game-layout>
7242
7242
  <origami-game-sidebar
7243
7243
  ?toggleDisabled=${this.isToggleDisabled}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@betorigami/games",
3
- "version": "0.7.5",
3
+ "version": "0.7.7",
4
4
  "author": "",
5
5
  "license": "UNLICENSED",
6
6
  "description": "",