@everymatrix/casino-engagement-suite-luckywheel 0.6.4 → 0.7.0

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.
@@ -1 +1 @@
1
- import{p as e,b as n}from"./p-7d1170ae.js";export{s as setNonce}from"./p-7d1170ae.js";import{g as i}from"./p-e1255160.js";(()=>{const n=import.meta.url,i={};return""!==n&&(i.resourcesUrl=new URL(".",n).href),e(i)})().then((async e=>(await i(),n([["p-b7afe849",[[1,"casino-engagement-suite-luckywheel",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[1],device:[1],luckywheel:[16],size:[1],contentdirection:[1],limitStylingAppends:[32],isPartitionsCustomableReady:[32],isSpinning:[32],options:[32],radius:[32],speed:[32],settings:[32],svg:[32],spinContainer:[32],spinable:[32],spinner:[32]},[[8,"message","handleEvent"]]]]]],e))));
1
+ import{p as e,b as n}from"./p-7d1170ae.js";export{s as setNonce}from"./p-7d1170ae.js";import{g as i}from"./p-e1255160.js";(()=>{const n=import.meta.url,i={};return""!==n&&(i.resourcesUrl=new URL(".",n).href),e(i)})().then((async e=>(await i(),n([["p-6b36a6f1",[[1,"casino-engagement-suite-luckywheel",{clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],language:[1],device:[1],luckywheel:[16],size:[1],contentdirection:[1],limitStylingAppends:[32],isPartitionsCustomableReady:[32],isSpinning:[32],options:[32],radius:[32],speed:[32],settings:[32],svg:[32],spinContainer:[32],spinable:[32],spinner:[32]},[[8,"message","handleEvent"]]]]]],e))));
@@ -1 +1 @@
1
- export{C as CasinoEngagementSuiteLuckywheel}from"./p-24a65524.js";import"./p-7d1170ae.js";
1
+ export{C as CasinoEngagementSuiteLuckywheel}from"./p-a50d208a.js";import"./p-7d1170ae.js";
@@ -0,0 +1 @@
1
+ export{C as casino_engagement_suite_luckywheel}from"./p-a50d208a.js";import"./p-7d1170ae.js";
@@ -0,0 +1,15 @@
1
+ import{r as t,h as i,g as e}from"./p-7d1170ae.js";
2
+ /*! *****************************************************************************
3
+ Copyright (c) Microsoft Corporation.
4
+
5
+ Permission to use, copy, modify, and/or distribute this software for any
6
+ purpose with or without fee is hereby granted.
7
+
8
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
+ PERFORMANCE OF THIS SOFTWARE.
15
+ ***************************************************************************** */var s,r,n,a,o,h;!function(t){t.Arrow="Arrow",t.Partition="Partition"}(s||(s={})),function(t){t.DownFromTop="DownFromTop",t.UpFromCenter="UpFromCenter",t.DownFromCenter="DownFromCenter",t.UpFromBottom="UpFromBottom"}(r||(r={})),function(t){t.en="en",t.fr="fr",t.de="de",t.tr="tr"}(n||(n={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(a||(a={})),function(t){t.launch="launch",t.loop="loop",t.halt="halt"}(o||(o={})),function(t){t.quad="quad",t.cubic="cubic",t.quart="quart",t.quint="quint",t.expo="expo",t.sine="sine",t.circ="circ"}(h||(h={}));const c=(t,i)=>{Object.keys(i).map((e=>{t.setAttribute(e.split(/(?=[A-Z])/).map((t=>t.toLocaleLowerCase())).join("-"),i[e])}))},l=t=>new Promise((i=>{let e=document.createElementNS("http://www.w3.org/2000/svg","image");e.onload=()=>i(e),e.onerror=()=>i(e),e.href.baseVal=t})),d=t=>({x:t,y:t}),u=(t,i)=>({x:t.x+i.x,y:t.y+i.y}),g={Image:"",Name:"Thank you",PrizeText:"",PrizeImage:""},b=async(t,i)=>{let e=((t,i)=>{const e=t.map((t=>{const e={};return Object.keys(t).map((s=>{"object"==typeof t[s]&&t[s]&&(e["Image1"===s?"Image":s]=t[s][i]||t[s]["*"])})),e}));return(t=>{let i=0;return t.map((t=>{i+=Number(t.probability)})),i})(t)<1&&e.push(g),e})(t.Program.WheelOfFortune.Partitions,i);return e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?e.map((t=>{if(t.Image){const i=document.createElementNS("http://www.w3.org/2000/svg","image");return i.href.baseVal=t.Image,Object.assign(Object.assign({},t),{Image:i})}return t})):await Promise.all(e.map((async t=>Object.assign(Object.assign({},t),await(async t=>t?{Image:await l(t)}:{})(t.Image))))),e},p={in:{quad:t=>Math.pow(t,2),cubic:t=>Math.pow(t,3),quart:t=>Math.pow(t,4),quint:t=>Math.pow(t,5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-Math.pow(t,2))},out:{quad:t=>1-Math.pow(1-t,2),cubic:t=>1-Math.pow(1-t,3),quart:t=>1-Math.pow(1-t,4),quint:t=>1-Math.pow(1-t,5),sine:t=>Math.sin(t*Math.PI/2),expo:t=>1===t?1:1-Math.pow(2,-10*t),circ:t=>Math.sqrt(1-Math.pow(t-1,2))}},f={quad:2,cubic:3,quart:4,quint:5,sine:Math.PI/2,expo:Math.LN2,circ:1/0},m={in:{quad:t=>2*t,cubic:t=>3*t**2,quart:t=>4*t**3,quint:t=>5*t**4,sine:t=>Math.PI/2*Math.sin(Math.PI/2*t),expo:t=>10*Math.LN2*2**(10*t-10),circ:t=>-.5*(1-t**2)**-.5},out:{cubic:t=>3*t**2-6*t+3}},v=[{launchTurns:5,launchSpeed:.2,loopSpeed:15,haltTurns:2,haltSpeed:.16},{launchTurns:2,launchSpeed:.5,loopSpeed:20,haltTurns:2,haltSpeed:.22},{launchTurns:6,launchSpeed:1.38,loopSpeed:45,haltTurns:6,haltSpeed:.5}],y=t=>Object.keys(t).map((i=>t[i]));var x;!function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise"}(x||(x={}));class k{constructor({size:t,radius:i,options:e,themeIndex:s,contentdirection:n}){this.arrowmode=r.DownFromTop,this.convertDegToArc=t=>t*Math.PI/180,this.convertArcToDeg=t=>180*t/Math.PI%360,this.getArcDelta=t=>2*Math.PI/t,this.findDeg=(t,i)=>t*this.convertArcToDeg(this.getArcDelta(i)),this.angleTransform=t=>{switch(t){case r.DownFromTop:case r.UpFromCenter:return-Math.PI/2;case r.DownFromCenter:case r.UpFromBottom:return Math.PI/2}},this.contentdirection=n,this.center=t/2,this.ratio=t/375,this.options=e,this.length=e.length,this.themeIndex=s,this.radius=i}get sizeImage(){const t=t=>48*this.ratio*5/t;if(this.length<=3)return t(4);switch(this.length){case 8:case 7:return 24*this.ratio;case 6:return 36*this.ratio;case 5:return 48*this.ratio;case 4:return 56*this.ratio;default:return t(this.length)}}getSizeImageByPartition(t){return this.options[t].Name?this.sizeImage/2:this.sizeImage}getSvgImageProps(t,i=1.25){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Name?this.radius-e/2-3*this.ratio:(this.radius-e/2)/Number(i)-3*this.ratio,Object.assign(Object.assign({},this.getPropsForPartitionInfo(t,this.getOffsetImage(e),s,a.outward)),{width:e,height:e})}getSvgTextProps(t,i){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].Image?this.radius-e-6*this.ratio:this.radius-6*this.ratio,Object.assign({},this.getPropsForPartitionInfo(t,this.offsetText,s,void 0,i))}getSvgTextPropsAdjustedByImage(t){const i=this.getSvgTextProps(t,this.options[t].Image?80:100);return Object.assign({},i)}get offsetText(){return{center:0,position:{x:0,y:0},transform:{x:0,y:0}}}getOffsetImage(t){return{center:0,position:{x:-1*t/2,y:-1*t/2},transform:{x:0,y:0}}}get direction(){return x.clockwise}getAngleSelf(t,i){return 360*t/this.length*this.direction+90*(void 0!==i?i:a[this.contentdirection])}getPartitionPositions(t,i,e){const s=this.angleTransform(this.arrowmode)+this.direction*t*2*Math.PI/this.length,r=((t,i,e)=>{const s=d(e);return{x:s.x+t*Math.cos(i),y:s.y+t*Math.sin(i)}})(i||this.radius-9*this.ratio,s,this.center+e.center);return{transformOrigin:u(r,e.transform),point:u(r,e.position)}}getPropsForPartitionInfo(t,i,e,s,r){const{point:n,transformOrigin:a}=this.getPartitionPositions(t,e,i);return Object.assign(Object.assign({},n),{style:{"font-size":13*this.ratio+"px",transform:`rotate(${this.getAngleSelf(t,s)}deg) translate(${"clockwise"===this.contentdirection?n.x:n.x-100}px, ${n.y-50}px)`,"transform-origin":`${o=a,Object.keys(o).map((t=>`${o[t]}px`)).join(" ")}`,height:`${r}px`,width:`${r}px`}});var o}getPartitionDraw(t){const i=d(this.center),e=d(this.radius),{point:s,pointNext:r}=((t,i,e,s)=>{const r=t=>((t,i,e,s)=>{const r=Math.PI/180*(360/i*(t-.5)-90),n=d(s),a=d(e);return{x:n.x+a.x*Math.cos(r),y:n.y+a.y*Math.sin(r)}})(t,i,e,s);return{point:r(t),pointNext:r(t+1)}})(t,this.length,this.radius,this.center);return{d:["M",...y(i),"L",...y(s),"A",...y(e),"0 0 1",...y(r),"Z"].join(" ")}}getDeg(t){return this.findDeg(length-(t||this.length-1),length)}getSpinnerProps(){const t=d(this.center);return{"transform-origin":`${t.x} ${t.y}`}}}class w{constructor(t){this.deg=0,this.degTarget=void 0,this.step=void 0,this.easingType=h.cubic,this.param=v[2],this.halt=(t,i=(()=>{}))=>{this.shouldHalt=()=>{this.step=o.halt,this.cb=()=>{i(),this.setDeg(t,0)},this.degTarget=t+360*this.param.haltTurns,this.continueRepeat()}},this.continueRepeat=()=>setTimeout((()=>this.ticker()),30),this.ticker=()=>{const t=this.param.loopSpeed,i=t=>33*f[this.easingType]*t/this.param.loopSpeed,e=()=>{const t=360*this.param.launchTurns-this.deg,e=i(t);this.animateF(e,this.deg,t,p.in[this.easingType],m.in[this.easingType])},s=()=>{const t=i(this.degTarget);this.animateF(t,0,this.degTarget,p.out[this.easingType],m.out[this.easingType])},r=()=>{this.setDeg((this.deg+t)%360,f[this.easingType]),this.continueRepeat()};({[o.launch]:()=>{this.cb=()=>{this.step=o.loop,this.setDeg(t,f[this.easingType]),this.continueRepeat()},e()},[o.loop]:()=>{this.shouldHalt&&0===this.deg?this.shouldHalt():r()},[o.halt]:()=>{this.deg===360-t?s():r()}})[this.step]()},this.setDeg=(t,i)=>{this.deg=t,this.tick(t,i)},this.animateF=(t,i,e,s,r)=>{let n=null;const a=()=>{let o=(new Date).getTime();n||(n=o);const h=o-n,c=e*s(h/t)+i,l=Math.abs(r(h/t));this.setDeg(c,l),h<t?setTimeout((()=>a()),30):this.cb()};a()},this.animate=(t,i,e,s,r)=>{let n=null;window.cancelAnimationFrame(n);let a=null;const o=h=>{a||(a=h);const c=h-a,l=e*s(c/t)+i,d=Math.abs(r(c/t));this.setDeg(l,d),c<t?n=window.requestAnimationFrame(o):this.cb()};n=window.requestAnimationFrame(o)},this.tick=t.tick}launch(){this.shouldHalt=void 0,this.step=o.launch,this.ticker()}}const P=class{constructor(i){t(this,i),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.host.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.host.prepend(i)}),1)})).catch((t=>{console.log("Error ",t)}))},this.renderImage=(t,i)=>{const e=this.options[i].Image;c(e,this.settings.getSvgImageProps(i)),t.innerHTML=null,t.appendChild(e)},this.updateSpinable=()=>{if(this.luckywheel.Current){if(Number(this.luckywheel.Current.RemainingTimes)>0)return void(this.spinable=!0);window.postMessage({type:"ShowNoSpinLeftModal"})}this.spinable=!1},this.eventSpin=()=>{this.updateSpinable(),this.spinable&&!this.isSpinning&&(this.isSpinning=!0,this.spinContainer=this.svg.querySelector("g.PartitionsContainer"),this.spinner.launch(),window.postMessage({type:"SpinLuckyWheel",data:{lotteryProgramID:this.luckywheel.Program.Id}}))},this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.luckywheel=void 0,this.size="440",this.contentdirection="anticlockwise",this.limitStylingAppends=!1,this.isPartitionsCustomableReady=!1,this.isSpinning=!1,this.options=void 0,this.radius=.85*Number(this.size)/2,this.speed=0,this.settings=void 0,this.svg=void 0,this.spinContainer=void 0,this.spinable=void 0,this.spinner=void 0}handleEvent(t){const i=null==t?void 0:t.data,{type:e}=i,s=function(t,i){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)i.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(e[s[r]]=t[s[r]])}return e}(i,["type"]);if("SpinLuckyWheelRes"===e){const t=!1===s.success,i=+s.data.Result.WheelOfFortunePartitionIndex;this.spinner.halt(this.settings.getDeg(i),(()=>{var e;this.isSpinning=!1,this.updateSpinable();let s="";if(!t){const t=null===(e=this.luckywheel.Program.WheelOfFortune.Partitions[i])||void 0===e?void 0:e.PrizeText;s=t[this.language]||t["*"],this.luckywheel.Current.RemainingTimes=+this.luckywheel.Current.RemainingTimes-1}window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeMessage:s,HasError:t}})}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}async componentWillLoad(){this.options=await b(this.luckywheel,n.en),this.settings=new k({size:this.size,radius:this.radius,options:this.options,themeIndex:1,contentdirection:this.contentdirection}),this.spinner=new w({tick:(t,i)=>{c(this.spinContainer,{style:[`transform: rotate(${t}deg)`,`height: ${this.size}px`,`width: ${this.size}px`].join(";")}),this.speed=.5*i}})}defineGeneralVariables(){return{"--length":`${this.options.length}`,"--radius":`${this.radius}`,"--ratio":""+Number(this.size)/480,"--size":`${this.size}`}}render(){const t={height:this.size,width:this.size},e={height:`${this.size}px`,width:`${this.size}px`};return i("div",{key:"ea47ff81b5aa4173b448295e474f94e8c2799aec",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"6c486c941b63b79a0e33ef2a078b225869080b9d",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",Object.assign({key:"4dd2fc761bc1914e3e5104fdfaf03c126f481e5d"},t,{style:e,class:"Bottom Customable"}),i("div",{key:"621ea705e477cadafa8be17108e0ccab3a8833f3",style:e})),i("g",Object.assign({key:"61642e6056a75a114c8d3d4bab22bde7fe17afff",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"53cc83c283e3d7eb625c4d9687c2862173bdee86",class:"PartitionsBackgrounds"},this.options.map(((t,s)=>i("foreignObject",{"clip-path":`url(#clip${s})`,class:"PartitionBackground Customable",style:Object.assign({"--index":s.toString()},e)},i("div",{style:e}))))),i("g",{key:"51ca18f5b7c877357a60d2ceb8f9b99cafcf6818",class:"PartitionsBackgroundStrokes"},this.options.map(((t,e)=>i("path",Object.assign({class:"PartitionBackgroundStroke"},this.settings.getPartitionDraw(e),{width:this.size,height:this.size}))))),i("g",{key:"cc81bbe2e72960ced6562702ab7be1dc7973480c",class:"Partitions",style:{filter:this.speed>.3?`blur(${this.speed}px)`:""}},this.options.map(((t,e)=>[t.Image&&i("g",{class:`PartitionImage PartitionImage${e}`,ref:t=>this.renderImage(t,e)}),t.Name&&i("foreignObject",Object.assign({class:"PartitionText"},this.settings.getSvgTextPropsAdjustedByImage(e)),i("div",{class:"PartitionTextEntityContainer"},i("p",{class:"PartitionTextEntity"+("clockwise"===this.settings.contentdirection?"":" Anticlockwise"),innerHTML:t.Name})))])))),i("g",{key:"d126a5bde2af4b31f32ec029c117637fa5983e20",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable1:!0}},this.options.map(((s,r)=>i("foreignObject",Object.assign({class:"Partition1 Customable",style:{"--index":r.toString()}},t),i("div",{style:e}))))),i("g",{key:"abb7544782eb40d08fa1304612f69ed389e10dcf",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable2:!0}},this.options.map(((s,r)=>i("foreignObject",Object.assign({class:"Partition2 Customable",style:{"--index":r.toString()}},t),i("div",{style:e}))))),i("foreignObject",Object.assign({key:"a76b670602be3050180ab71b2e4e424937865358",class:"Middle Customable"},t,{style:e}),i("div",{key:"1d074b872c29092a51ce7a8c2c8cf2e4a84c1381",style:e})),i("foreignObject",Object.assign({key:"b8525ca3463cbde5a12f47655bc82451ef648012",class:"Top Customable"},t,{style:e}),i("div",{key:"ddbe297ea9947778975248dd111faed457bb9433",style:e})),i("g",{key:"0d247fcbc8734643bc36f9f457876d3b4cb462fa",class:{spinning:this.isSpinning,Center:!0},onClick:this.eventSpin},i("foreignObject",{key:"b63e7d4e9f73c101305c4854565ad9ce9c11c171",style:{width:"100px",height:"100px",transform:`translate(${Number(this.size)/2-50}px, ${Number(this.size)/2-50}px)`}})),i("g",{key:"d3e9be9a11f4c6d8c6abff35936c33ff5cf8c26d"},this.options.map(((t,e)=>i("clipPath",{id:`clip${e}`},i("path",Object.assign({},this.settings.getPartitionDraw(e)))))))))}get host(){return e(this)}};P.style=':host{font-family:system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"}*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.LotteryProgramWof{background:var(--emw--color-contrast, #07072A);display:flex;align-items:center;flex-direction:column;padding:20px 0}main{max-width:600px;width:100%;display:flex;justify-content:space-around;min-height:200px}svg{transition:opacity 0.3s}.WheelContainer{text-align:center}.FortuneContainer{width:100%;display:flex;align-items:center;flex-direction:column}.Center{cursor:pointer;transition:filter;transition-duration:1s}.Center.disabled{filter:grayscale(80%)}.Center .CenterCircle{fill:#3CE4BB;stroke:rgb(150, 54, 88);stroke-width:2px;cursor:pointer;transition:fill;transition-duration:1s}.Center .CenterText{fill:#FFFFFF}.PointerPartition{opacity:0.3;fill:lightgoldenrodyellow;stroke:red;stroke-width:6px;stroke-dasharray:12}.Current{color:#FFFFFF}.PartitionText{color:#FFFFFF;font-style:normal;font-weight:700;text-anchor:end;text-shadow:0px 3px #000;dominant-baseline:central}.PartitionsShadow{background-blend-mode:multiply;mix-blend-mode:multiply}.PartitionTextEntityContainer{height:100%;display:flex;align-items:center}.PartitionTextEntity{width:100%}.PartitionTextEntity.Anticlockwise{text-align:end}foreignObject.Bottom div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-bg.svg");background-size:calc(var(--radius) * 2px + var(--ratio) * 20px);background-position:center}foreignObject.Middle div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-spin.svg"), url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-pointer.svg");background-position:center, center 5px}foreignObject.Top{mix-blend-mode:multiply}foreignObject.Top div{background-image:var(--img-theme-shadow);background-position:center;background-size:calc(var(--radius) * 2px)}foreignObject.Partition1 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc(var(--index) * 360deg / var(--length)))}foreignObject.Partition2 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc((var(--index) + 0.5) * 360deg / var(--length)))}foreignObject.PointerArea{mix-blend-mode:screen}foreignObject.PointerArea div{background-image:var(--img-theme-pointer-area);background-position:center -3px;background-size:51%}foreignObject.Partition1 div,foreignObject.Partition2 div{transform-origin:center}.PartitionsCustomable1 div,.PartitionsCustomable2 div{visibility:hidden}.PartitionsCustomable1 div.active,.PartitionsCustomable2 div.active{visibility:visible}foreignObject.Customable{overflow:visible}foreignObject.Customable div{background-repeat:no-repeat}.PartitionBackground div{background-size:calc(var(--radius) * 2 / var(--size) * 100%) calc(var(--radius) * 2 / var(--size) * 100%);background-position:center}.PartitionBackground:nth-child(2n) div{background:var(--emw--color-primary, #3F2E75)}.PartitionBackground:nth-child(2n+1) div{background:var(--emw--color-secondary, #9482CE)}.PartitionBackground div{transform-origin:center}.PartitionBackgroundStroke{fill:transparent;stroke:var(--emw--color-background-secondary, #251D3E);stroke-width:3px;stroke-dasharray:none}.PointerPartitionFrame{stroke:#FFDD64;fill:transparent;stroke-dasharray:var(--radius) calc(6.2831853072 / var(--length) * var(--radius));stroke-width:0px}.PointerPartitionFrame.active{stroke-width:3px}.WheelContainer.Mobile foreignObject.Middle div{background-size:95px, 38px}.PartitionText .PartitionTextEntityContainer .PartitionTextEntity{text-align:center;text-transform:uppercase;text-shadow:none;font-size:var(--emw--font-size-small, 14px);font-weight:900}';export{P as C}
@@ -254,7 +254,7 @@ const params = [
254
254
  },
255
255
  ];
256
256
 
257
- const mapObjectValueToTuple = (object) => Object.keys(object).map(key => object[key]);
257
+ const mapObjectValueToTuple = (object) => Object.keys(object).map((key) => object[key]);
258
258
  var RotateDirection;
259
259
  (function (RotateDirection) {
260
260
  RotateDirection[RotateDirection["clockwise"] = 1] = "clockwise";
@@ -263,12 +263,12 @@ var RotateDirection;
263
263
  class SvgCalc {
264
264
  constructor({ size, radius, options, themeIndex, contentdirection }) {
265
265
  this.arrowmode = ArrowMode.DownFromTop;
266
- this.convertDegToArc = (deg) => deg * Math.PI / 180;
267
- this.convertArcToDeg = (arc) => arc * 180 / Math.PI % 360;
268
- this.getArcDelta = (n) => 2 * Math.PI / n;
266
+ this.convertDegToArc = (deg) => (deg * Math.PI) / 180;
267
+ this.convertArcToDeg = (arc) => ((arc * 180) / Math.PI) % 360;
268
+ this.getArcDelta = (n) => (2 * Math.PI) / n;
269
269
  this.findDeg = (index, n) => {
270
270
  const degDelta = this.convertArcToDeg(this.getArcDelta(n));
271
- return (index) * degDelta;
271
+ return index * degDelta;
272
272
  };
273
273
  this.angleTransform = (arrowmode) => {
274
274
  switch (arrowmode) {
@@ -280,7 +280,7 @@ class SvgCalc {
280
280
  return Math.PI / 2;
281
281
  }
282
282
  };
283
- this.contentdirection = contentdirection || 'anticlockwise';
283
+ this.contentdirection = contentdirection;
284
284
  // size
285
285
  this.center = size / 2;
286
286
  this.ratio = size / 375;
@@ -293,20 +293,25 @@ class SvgCalc {
293
293
  this.radius = radius;
294
294
  }
295
295
  get sizeImage() {
296
- const getSize = (length) => this.ratio * 48 * 5 / length;
296
+ const getSize = (length) => (this.ratio * 48 * 5) / length;
297
297
  if (this.length <= 3)
298
298
  return getSize(4);
299
299
  switch (this.length) {
300
300
  case 8:
301
- case 7: return this.ratio * 24;
302
- case 6: return this.ratio * 36;
303
- case 5: return this.ratio * 48;
304
- case 4: return this.ratio * 56;
305
- default: return getSize(this.length);
301
+ case 7:
302
+ return this.ratio * 24;
303
+ case 6:
304
+ return this.ratio * 36;
305
+ case 5:
306
+ return this.ratio * 48;
307
+ case 4:
308
+ return this.ratio * 56;
309
+ default:
310
+ return getSize(this.length);
306
311
  }
307
312
  }
308
313
  getSizeImageByPartition(index) {
309
- if (this.options[index].name) {
314
+ if (this.options[index].Name) {
310
315
  return this.sizeImage / 2;
311
316
  }
312
317
  else {
@@ -316,7 +321,7 @@ class SvgCalc {
316
321
  getSvgImageProps(index, partitionDivisor = 1.25) {
317
322
  const sizeImage = this.getSizeImageByPartition(index);
318
323
  let baseRadius;
319
- if (this.options[index].name) {
324
+ if (this.options[index].Name) {
320
325
  baseRadius = this.radius - sizeImage / 2 - 3 * this.ratio;
321
326
  }
322
327
  else {
@@ -324,25 +329,21 @@ class SvgCalc {
324
329
  }
325
330
  return Object.assign(Object.assign({}, this.getPropsForPartitionInfo(index, this.getOffsetImage(sizeImage), baseRadius, ContentDirection.outward)), { width: sizeImage, height: sizeImage });
326
331
  }
327
- getSvgTextProps(index) {
332
+ getSvgTextProps(index, size) {
328
333
  const sizeImage = this.getSizeImageByPartition(index);
329
334
  let baseRadius;
330
- if (this.options[index].image) {
335
+ if (this.options[index].Image) {
331
336
  baseRadius = this.radius - sizeImage - 6 * this.ratio;
332
337
  }
333
338
  else {
334
339
  baseRadius = this.radius - 6 * this.ratio;
335
340
  }
336
- return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius));
341
+ return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius, undefined, size));
337
342
  }
338
343
  getSvgTextPropsAdjustedByImage(index) {
339
- const props = this.getSvgTextProps(index);
340
- const size = this.options[index].image ? 80 : 100;
341
- const objectSize = {
342
- width: size,
343
- height: size
344
- };
345
- return Object.assign(Object.assign(Object.assign({}, props), objectSize), { x: this.contentdirection === 'clockwise' ? props.x : props.x - objectSize.width, y: props.y - objectSize.height / 2 });
344
+ const size = this.options[index].Image ? 80 : 100;
345
+ const props = this.getSvgTextProps(index, size);
346
+ return Object.assign({}, props);
346
347
  }
347
348
  get offsetText() {
348
349
  return {
@@ -361,8 +362,8 @@ class SvgCalc {
361
362
  return {
362
363
  center: 0,
363
364
  position: {
364
- x: -1 * sizeImage / 2,
365
- y: -1 * sizeImage / 2
365
+ x: (-1 * sizeImage) / 2,
366
+ y: (-1 * sizeImage) / 2
366
367
  },
367
368
  transform: {
368
369
  x: 0,
@@ -374,14 +375,13 @@ class SvgCalc {
374
375
  return RotateDirection.clockwise;
375
376
  }
376
377
  getAngleSelf(index, contentDirection) {
377
- const baseAngle = 360 * index / this.length * this.direction;
378
+ const baseAngle = ((360 * index) / this.length) * this.direction;
378
379
  const fixerAngle = 90 * (contentDirection !== undefined ? contentDirection : ContentDirection[this.contentdirection]);
379
380
  const resultAngle = baseAngle + fixerAngle;
380
381
  return resultAngle;
381
382
  }
382
383
  getPartitionPositions(index, baseRadius, offset) {
383
- const angle = this.angleTransform(this.arrowmode) +
384
- this.direction * index * 2 * Math.PI / this.length;
384
+ const angle = this.angleTransform(this.arrowmode) + (this.direction * index * 2 * Math.PI) / this.length;
385
385
  const point = getPointOnCircle(baseRadius || this.radius - 9 * this.ratio, angle, this.center + offset.center);
386
386
  const transformOrigin = pointPlus(point, offset.transform);
387
387
  const pointResult = pointPlus(point, offset.position);
@@ -390,13 +390,17 @@ class SvgCalc {
390
390
  point: pointResult
391
391
  };
392
392
  }
393
- getPropsForPartitionInfo(index, offset, baseRadius, contentDirection) {
393
+ getPropsForPartitionInfo(index, offset, baseRadius, contentDirection, size) {
394
394
  const { point, transformOrigin } = this.getPartitionPositions(index, baseRadius, offset);
395
- const getTransformOriginString = (vector) => Object.keys(vector).map(axis => `${vector[axis]}px`).join(' ');
395
+ const getTransformOriginString = (vector) => Object.keys(vector)
396
+ .map((axis) => `${vector[axis]}px`)
397
+ .join(' ');
396
398
  return Object.assign(Object.assign({}, point), { style: {
397
399
  'font-size': `${13 * this.ratio}px`,
398
- 'transform': `rotate(${this.getAngleSelf(index, contentDirection)}deg)`,
399
- 'transform-origin': `${getTransformOriginString(transformOrigin)}`
400
+ transform: `rotate(${this.getAngleSelf(index, contentDirection)}deg) translate(${this.contentdirection === 'clockwise' ? point.x : point.x - 100}px, ${point.y - 100 / 2}px)`,
401
+ 'transform-origin': `${getTransformOriginString(transformOrigin)}`,
402
+ height: `${size}px`,
403
+ width: `${size}px`
400
404
  } });
401
405
  }
402
406
  getPartitionDraw(index) {
@@ -404,8 +408,10 @@ class SvgCalc {
404
408
  const rRingInnerPoint = getSymmetricalPointFromScalar(this.radius);
405
409
  const { point, pointNext } = getPointWithNext(index, this.length, this.radius, this.center);
406
410
  const ds = [
407
- 'M', ...mapObjectValueToTuple(rPoint),
408
- 'L', ...mapObjectValueToTuple(point),
411
+ 'M',
412
+ ...mapObjectValueToTuple(rPoint),
413
+ 'L',
414
+ ...mapObjectValueToTuple(point),
409
415
  'A',
410
416
  ...mapObjectValueToTuple(rRingInnerPoint),
411
417
  '0 0 1',
@@ -565,7 +571,9 @@ const CasinoEngagementSuiteLuckywheel = class {
565
571
  .then((res) => res.text())
566
572
  .then((data) => {
567
573
  cssFile.innerHTML = data;
568
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
574
+ setTimeout(() => {
575
+ this.host.prepend(cssFile);
576
+ }, 1);
569
577
  })
570
578
  .catch((err) => {
571
579
  console.log('Error ', err);
@@ -600,7 +608,7 @@ const CasinoEngagementSuiteLuckywheel = class {
600
608
  window.postMessage({
601
609
  type: 'SpinLuckyWheel',
602
610
  data: {
603
- lotteryProgramID: this.luckywheel.Program.Id,
611
+ lotteryProgramID: this.luckywheel.Program.Id
604
612
  }
605
613
  });
606
614
  };
@@ -615,7 +623,7 @@ const CasinoEngagementSuiteLuckywheel = class {
615
623
  this.isPartitionsCustomableReady = false;
616
624
  this.isSpinning = false;
617
625
  this.options = undefined;
618
- this.radius = 0.85 * Number(this.size) / 2;
626
+ this.radius = (0.85 * Number(this.size)) / 2;
619
627
  this.speed = 0;
620
628
  this.settings = undefined;
621
629
  this.svg = undefined;
@@ -630,11 +638,12 @@ const CasinoEngagementSuiteLuckywheel = class {
630
638
  const hasError = rest.success === false;
631
639
  const index = +rest.data.Result.WheelOfFortunePartitionIndex;
632
640
  this.spinner.halt(this.settings.getDeg(index), () => {
641
+ var _a;
633
642
  this.isSpinning = false;
634
643
  this.updateSpinable();
635
644
  let prizeText = '';
636
645
  if (!hasError) {
637
- const partition = this.luckywheel.Program.WheelOfFortune.Partitions[index];
646
+ const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
638
647
  prizeText = partition[this.language] || partition['*'];
639
648
  this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
640
649
  }
@@ -642,7 +651,7 @@ const CasinoEngagementSuiteLuckywheel = class {
642
651
  type: 'ShowLuckywheelRewardModal',
643
652
  data: {
644
653
  PrizeMessage: prizeText,
645
- HasError: hasError,
654
+ HasError: hasError
646
655
  }
647
656
  });
648
657
  });
@@ -670,11 +679,7 @@ const CasinoEngagementSuiteLuckywheel = class {
670
679
  this.spinner = new Spinner({
671
680
  tick: (deg, speed) => {
672
681
  setProps(this.spinContainer, {
673
- style: [
674
- `transform: rotate(${deg}deg)`,
675
- `height: ${this.size}px`,
676
- `width: ${this.size}px`,
677
- ].join(';'),
682
+ style: [`transform: rotate(${deg}deg)`, `height: ${this.size}px`, `width: ${this.size}px`].join(';')
678
683
  });
679
684
  this.speed = speed * 0.5;
680
685
  }
@@ -685,26 +690,32 @@ const CasinoEngagementSuiteLuckywheel = class {
685
690
  '--length': `${this.options.length}`,
686
691
  '--radius': `${this.radius}`,
687
692
  '--ratio': `${Number(this.size) / 480}`,
688
- '--size': `${this.size}`,
693
+ '--size': `${this.size}`
689
694
  };
690
695
  }
691
696
  render() {
692
697
  const sizeProps = { height: this.size, width: this.size };
693
- const foreignObjectAgentProps = { 'height': `${this.size}px`, 'width': `${this.size}px` };
694
- return (index.h("div", { key: 'b2c5ec30fc58e6758a2bdf6703055bdddddd99af', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, index.h("svg", { key: '5176b473af31b7f96c211d5be56b4dfcd67681a6', width: this.size, height: this.size, ref: (el) => { this.svg = el; } }, index.h("foreignObject", Object.assign({ key: 'aa80be601163398a24f4aa77007e971cffbfd238' }, sizeProps, { class: "Bottom Customable" }), index.h("div", { key: 'a24e0f121d43ccfbf6457e0ddbdf5f9d051eed00', style: foreignObjectAgentProps })), index.h("g", Object.assign({ key: '63926d76e820cceed585510f960c37991d187a20', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), index.h("g", { key: '6ae912f06d75f3c3f3d35b66f806940f6ded8b87', class: "PartitionsBackgrounds" }, this.options.map((_el, index$1) => {
695
- return (index.h("foreignObject", { "clip-path": `url(#clip${index$1})`, class: "PartitionBackground Customable", style: { '--index': index$1.toString() }, width: this.size, height: this.size }, index.h("div", { style: foreignObjectAgentProps })));
696
- })), index.h("g", { key: '971611dc5b132701679595ec5ee317d97121029d', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index$1) => {
698
+ const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
699
+ return (index.h("div", { key: 'ea47ff81b5aa4173b448295e474f94e8c2799aec', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, index.h("svg", { key: '6c486c941b63b79a0e33ef2a078b225869080b9d', width: this.size, height: this.size, ref: (el) => {
700
+ this.svg = el;
701
+ } }, index.h("foreignObject", Object.assign({ key: '4dd2fc761bc1914e3e5104fdfaf03c126f481e5d' }, sizeProps, { style: foreignObjectAgentProps, class: "Bottom Customable" }), index.h("div", { key: '621ea705e477cadafa8be17108e0ccab3a8833f3', style: foreignObjectAgentProps })), index.h("g", Object.assign({ key: '61642e6056a75a114c8d3d4bab22bde7fe17afff', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), index.h("g", { key: '53cc83c283e3d7eb625c4d9687c2862173bdee86', class: "PartitionsBackgrounds" }, this.options.map((_el, index$1) => {
702
+ return (index.h("foreignObject", { "clip-path": `url(#clip${index$1})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index$1.toString() }, foreignObjectAgentProps) }, index.h("div", { style: foreignObjectAgentProps })));
703
+ })), index.h("g", { key: '51ca18f5b7c877357a60d2ceb8f9b99cafcf6818', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index$1) => {
697
704
  return (index.h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index$1), { width: this.size, height: this.size })));
698
- })), index.h("g", { key: '51b1c3319cf8db82e73008df9dd45bcddfe349fe', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index$1) => {
699
- return ([
705
+ })), index.h("g", { key: 'cc81bbe2e72960ced6562702ab7be1dc7973480c', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index$1) => {
706
+ return [
700
707
  el.Image && (index.h("g", { class: `PartitionImage PartitionImage${index$1}`, ref: (el) => this.renderImage(el, index$1) })),
701
708
  el.Name && (index.h("foreignObject", Object.assign({ class: "PartitionText" }, this.settings.getSvgTextPropsAdjustedByImage(index$1)), index.h("div", { class: "PartitionTextEntityContainer" }, index.h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
702
- ]);
703
- }))), index.h("g", { key: 'b892a4cc21a37e7981a5dfabf1f7e16d2f0493f7', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable1': true } }, this.options.map((_el, index$1) => {
709
+ ];
710
+ }))), index.h("g", { key: 'd126a5bde2af4b31f32ec029c117637fa5983e20', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index$1) => {
704
711
  return (index.h("foreignObject", Object.assign({ class: "Partition1 Customable", style: { '--index': index$1.toString() } }, sizeProps), index.h("div", { style: foreignObjectAgentProps })));
705
- })), index.h("g", { key: '6d572edae8f005204257154eafa77e2fa1f54356', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable2': true } }, this.options.map((_el, index$1) => {
712
+ })), index.h("g", { key: 'abb7544782eb40d08fa1304612f69ed389e10dcf', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index$1) => {
706
713
  return (index.h("foreignObject", Object.assign({ class: "Partition2 Customable", style: { '--index': index$1.toString() } }, sizeProps), index.h("div", { style: foreignObjectAgentProps })));
707
- })), index.h("foreignObject", Object.assign({ key: 'd1a8bb686fe1d76301a6fe824b13dd212b1ce060', class: "Middle Customable" }, sizeProps), index.h("div", { key: 'f5fb21485fd3c8bd3f127a6714c65d488e51d6f5', style: foreignObjectAgentProps })), index.h("foreignObject", Object.assign({ key: '3ccd35ea0ed62a3d23e85af0008ac9bc236dfc2d', class: "Top Customable" }, sizeProps), index.h("div", { key: '60abed1d4fb4d57dfa20bf5ff7368b47dd32629c', style: foreignObjectAgentProps })), index.h("g", { key: '758e906615752e067e94cb33242c60c1a811e78e', class: { 'spinning': this.isSpinning, 'Center': true }, onClick: this.eventSpin }, index.h("foreignObject", { key: '3064736e103ecd1b9b0cb3a0582283e146bab4b5', x: Number(this.size) / 2 - 100 / 2, y: Number(this.size) / 2 - 100 / 2, width: 100, height: 100 })), index.h("g", { key: '277f36735b58e24e424179ca7082851adf470af1' }, this.options.map((_el, index$1) => {
714
+ })), index.h("foreignObject", Object.assign({ key: 'a76b670602be3050180ab71b2e4e424937865358', class: "Middle Customable" }, sizeProps, { style: foreignObjectAgentProps }), index.h("div", { key: '1d074b872c29092a51ce7a8c2c8cf2e4a84c1381', style: foreignObjectAgentProps })), index.h("foreignObject", Object.assign({ key: 'b8525ca3463cbde5a12f47655bc82451ef648012', class: "Top Customable" }, sizeProps, { style: foreignObjectAgentProps }), index.h("div", { key: 'ddbe297ea9947778975248dd111faed457bb9433', style: foreignObjectAgentProps })), index.h("g", { key: '0d247fcbc8734643bc36f9f457876d3b4cb462fa', class: { spinning: this.isSpinning, Center: true }, onClick: this.eventSpin }, index.h("foreignObject", { key: 'b63e7d4e9f73c101305c4854565ad9ce9c11c171', style: {
715
+ width: '100px',
716
+ height: '100px',
717
+ transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
718
+ } })), index.h("g", { key: 'd3e9be9a11f4c6d8c6abff35936c33ff5cf8c26d' }, this.options.map((_el, index$1) => {
708
719
  return (index.h("clipPath", { id: `clip${index$1}` }, index.h("path", Object.assign({}, this.settings.getPartitionDraw(index$1)))));
709
720
  })))));
710
721
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-757e058b.js');
5
+ const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-2b06fa4a.js');
6
6
  require('./index-6096cc4b.js');
7
7
 
8
8
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-757e058b.js');
5
+ const casinoEngagementSuiteLuckywheel = require('./casino-engagement-suite-luckywheel-2b06fa4a.js');
6
6
  require('./index-6096cc4b.js');
7
7
 
8
8
 
@@ -18,7 +18,9 @@ export class CasinoEngagementSuiteLuckywheel {
18
18
  .then((res) => res.text())
19
19
  .then((data) => {
20
20
  cssFile.innerHTML = data;
21
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
21
+ setTimeout(() => {
22
+ this.host.prepend(cssFile);
23
+ }, 1);
22
24
  })
23
25
  .catch((err) => {
24
26
  console.log('Error ', err);
@@ -53,7 +55,7 @@ export class CasinoEngagementSuiteLuckywheel {
53
55
  window.postMessage({
54
56
  type: 'SpinLuckyWheel',
55
57
  data: {
56
- lotteryProgramID: this.luckywheel.Program.Id,
58
+ lotteryProgramID: this.luckywheel.Program.Id
57
59
  }
58
60
  });
59
61
  };
@@ -68,7 +70,7 @@ export class CasinoEngagementSuiteLuckywheel {
68
70
  this.isPartitionsCustomableReady = false;
69
71
  this.isSpinning = false;
70
72
  this.options = undefined;
71
- this.radius = 0.85 * Number(this.size) / 2;
73
+ this.radius = (0.85 * Number(this.size)) / 2;
72
74
  this.speed = 0;
73
75
  this.settings = undefined;
74
76
  this.svg = undefined;
@@ -83,11 +85,12 @@ export class CasinoEngagementSuiteLuckywheel {
83
85
  const hasError = rest.success === false;
84
86
  const index = +rest.data.Result.WheelOfFortunePartitionIndex;
85
87
  this.spinner.halt(this.settings.getDeg(index), () => {
88
+ var _a;
86
89
  this.isSpinning = false;
87
90
  this.updateSpinable();
88
91
  let prizeText = '';
89
92
  if (!hasError) {
90
- const partition = this.luckywheel.Program.WheelOfFortune.Partitions[index];
93
+ const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
91
94
  prizeText = partition[this.language] || partition['*'];
92
95
  this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
93
96
  }
@@ -95,7 +98,7 @@ export class CasinoEngagementSuiteLuckywheel {
95
98
  type: 'ShowLuckywheelRewardModal',
96
99
  data: {
97
100
  PrizeMessage: prizeText,
98
- HasError: hasError,
101
+ HasError: hasError
99
102
  }
100
103
  });
101
104
  });
@@ -123,11 +126,7 @@ export class CasinoEngagementSuiteLuckywheel {
123
126
  this.spinner = new Spinner({
124
127
  tick: (deg, speed) => {
125
128
  setProps(this.spinContainer, {
126
- style: [
127
- `transform: rotate(${deg}deg)`,
128
- `height: ${this.size}px`,
129
- `width: ${this.size}px`,
130
- ].join(';'),
129
+ style: [`transform: rotate(${deg}deg)`, `height: ${this.size}px`, `width: ${this.size}px`].join(';')
131
130
  });
132
131
  this.speed = speed * 0.5;
133
132
  }
@@ -138,26 +137,32 @@ export class CasinoEngagementSuiteLuckywheel {
138
137
  '--length': `${this.options.length}`,
139
138
  '--radius': `${this.radius}`,
140
139
  '--ratio': `${Number(this.size) / 480}`,
141
- '--size': `${this.size}`,
140
+ '--size': `${this.size}`
142
141
  };
143
142
  }
144
143
  render() {
145
144
  const sizeProps = { height: this.size, width: this.size };
146
- const foreignObjectAgentProps = { 'height': `${this.size}px`, 'width': `${this.size}px` };
147
- return (h("div", { key: 'b2c5ec30fc58e6758a2bdf6703055bdddddd99af', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '5176b473af31b7f96c211d5be56b4dfcd67681a6', width: this.size, height: this.size, ref: (el) => { this.svg = el; } }, h("foreignObject", Object.assign({ key: 'aa80be601163398a24f4aa77007e971cffbfd238' }, sizeProps, { class: "Bottom Customable" }), h("div", { key: 'a24e0f121d43ccfbf6457e0ddbdf5f9d051eed00', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '63926d76e820cceed585510f960c37991d187a20', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '6ae912f06d75f3c3f3d35b66f806940f6ded8b87', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
148
- return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: { '--index': index.toString() }, width: this.size, height: this.size }, h("div", { style: foreignObjectAgentProps })));
149
- })), h("g", { key: '971611dc5b132701679595ec5ee317d97121029d', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
145
+ const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
146
+ return (h("div", { key: 'ea47ff81b5aa4173b448295e474f94e8c2799aec', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '6c486c941b63b79a0e33ef2a078b225869080b9d', width: this.size, height: this.size, ref: (el) => {
147
+ this.svg = el;
148
+ } }, h("foreignObject", Object.assign({ key: '4dd2fc761bc1914e3e5104fdfaf03c126f481e5d' }, sizeProps, { style: foreignObjectAgentProps, class: "Bottom Customable" }), h("div", { key: '621ea705e477cadafa8be17108e0ccab3a8833f3', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '61642e6056a75a114c8d3d4bab22bde7fe17afff', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '53cc83c283e3d7eb625c4d9687c2862173bdee86', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
149
+ return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index.toString() }, foreignObjectAgentProps) }, h("div", { style: foreignObjectAgentProps })));
150
+ })), h("g", { key: '51ca18f5b7c877357a60d2ceb8f9b99cafcf6818', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
150
151
  return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
151
- })), h("g", { key: '51b1c3319cf8db82e73008df9dd45bcddfe349fe', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
152
- return ([
152
+ })), h("g", { key: 'cc81bbe2e72960ced6562702ab7be1dc7973480c', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
153
+ return [
153
154
  el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
154
155
  el.Name && (h("foreignObject", Object.assign({ class: "PartitionText" }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
155
- ]);
156
- }))), h("g", { key: 'b892a4cc21a37e7981a5dfabf1f7e16d2f0493f7', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable1': true } }, this.options.map((_el, index) => {
156
+ ];
157
+ }))), h("g", { key: 'd126a5bde2af4b31f32ec029c117637fa5983e20', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
157
158
  return (h("foreignObject", Object.assign({ class: "Partition1 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
158
- })), h("g", { key: '6d572edae8f005204257154eafa77e2fa1f54356', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable2': true } }, this.options.map((_el, index) => {
159
+ })), h("g", { key: 'abb7544782eb40d08fa1304612f69ed389e10dcf', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
159
160
  return (h("foreignObject", Object.assign({ class: "Partition2 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
160
- })), h("foreignObject", Object.assign({ key: 'd1a8bb686fe1d76301a6fe824b13dd212b1ce060', class: "Middle Customable" }, sizeProps), h("div", { key: 'f5fb21485fd3c8bd3f127a6714c65d488e51d6f5', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: '3ccd35ea0ed62a3d23e85af0008ac9bc236dfc2d', class: "Top Customable" }, sizeProps), h("div", { key: '60abed1d4fb4d57dfa20bf5ff7368b47dd32629c', style: foreignObjectAgentProps })), h("g", { key: '758e906615752e067e94cb33242c60c1a811e78e', class: { 'spinning': this.isSpinning, 'Center': true }, onClick: this.eventSpin }, h("foreignObject", { key: '3064736e103ecd1b9b0cb3a0582283e146bab4b5', x: Number(this.size) / 2 - 100 / 2, y: Number(this.size) / 2 - 100 / 2, width: 100, height: 100 })), h("g", { key: '277f36735b58e24e424179ca7082851adf470af1' }, this.options.map((_el, index) => {
161
+ })), h("foreignObject", Object.assign({ key: 'a76b670602be3050180ab71b2e4e424937865358', class: "Middle Customable" }, sizeProps, { style: foreignObjectAgentProps }), h("div", { key: '1d074b872c29092a51ce7a8c2c8cf2e4a84c1381', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: 'b8525ca3463cbde5a12f47655bc82451ef648012', class: "Top Customable" }, sizeProps, { style: foreignObjectAgentProps }), h("div", { key: 'ddbe297ea9947778975248dd111faed457bb9433', style: foreignObjectAgentProps })), h("g", { key: '0d247fcbc8734643bc36f9f457876d3b4cb462fa', class: { spinning: this.isSpinning, Center: true }, onClick: this.eventSpin }, h("foreignObject", { key: 'b63e7d4e9f73c101305c4854565ad9ce9c11c171', style: {
162
+ width: '100px',
163
+ height: '100px',
164
+ transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
165
+ } })), h("g", { key: 'd3e9be9a11f4c6d8c6abff35936c33ff5cf8c26d' }, this.options.map((_el, index) => {
161
166
  return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
162
167
  })))));
163
168
  }
@@ -1,6 +1,6 @@
1
1
  import { ArrowMode, ContentDirection } from "./types.js";
2
2
  import { getPointOnCircle, pointPlus, getSymmetricalPointFromScalar, getPointWithNext } from "./utils.js";
3
- export const mapObjectValueToTuple = (object) => Object.keys(object).map(key => object[key]);
3
+ export const mapObjectValueToTuple = (object) => Object.keys(object).map((key) => object[key]);
4
4
  var RotateDirection;
5
5
  (function (RotateDirection) {
6
6
  RotateDirection[RotateDirection["clockwise"] = 1] = "clockwise";
@@ -9,12 +9,12 @@ var RotateDirection;
9
9
  export class SvgCalc {
10
10
  constructor({ size, radius, options, themeIndex, contentdirection }) {
11
11
  this.arrowmode = ArrowMode.DownFromTop;
12
- this.convertDegToArc = (deg) => deg * Math.PI / 180;
13
- this.convertArcToDeg = (arc) => arc * 180 / Math.PI % 360;
14
- this.getArcDelta = (n) => 2 * Math.PI / n;
12
+ this.convertDegToArc = (deg) => (deg * Math.PI) / 180;
13
+ this.convertArcToDeg = (arc) => ((arc * 180) / Math.PI) % 360;
14
+ this.getArcDelta = (n) => (2 * Math.PI) / n;
15
15
  this.findDeg = (index, n) => {
16
16
  const degDelta = this.convertArcToDeg(this.getArcDelta(n));
17
- return (index) * degDelta;
17
+ return index * degDelta;
18
18
  };
19
19
  this.angleTransform = (arrowmode) => {
20
20
  switch (arrowmode) {
@@ -26,7 +26,7 @@ export class SvgCalc {
26
26
  return Math.PI / 2;
27
27
  }
28
28
  };
29
- this.contentdirection = contentdirection || 'anticlockwise';
29
+ this.contentdirection = contentdirection;
30
30
  // size
31
31
  this.center = size / 2;
32
32
  this.ratio = size / 375;
@@ -39,20 +39,25 @@ export class SvgCalc {
39
39
  this.radius = radius;
40
40
  }
41
41
  get sizeImage() {
42
- const getSize = (length) => this.ratio * 48 * 5 / length;
42
+ const getSize = (length) => (this.ratio * 48 * 5) / length;
43
43
  if (this.length <= 3)
44
44
  return getSize(4);
45
45
  switch (this.length) {
46
46
  case 8:
47
- case 7: return this.ratio * 24;
48
- case 6: return this.ratio * 36;
49
- case 5: return this.ratio * 48;
50
- case 4: return this.ratio * 56;
51
- default: return getSize(this.length);
47
+ case 7:
48
+ return this.ratio * 24;
49
+ case 6:
50
+ return this.ratio * 36;
51
+ case 5:
52
+ return this.ratio * 48;
53
+ case 4:
54
+ return this.ratio * 56;
55
+ default:
56
+ return getSize(this.length);
52
57
  }
53
58
  }
54
59
  getSizeImageByPartition(index) {
55
- if (this.options[index].name) {
60
+ if (this.options[index].Name) {
56
61
  return this.sizeImage / 2;
57
62
  }
58
63
  else {
@@ -62,7 +67,7 @@ export class SvgCalc {
62
67
  getSvgImageProps(index, partitionDivisor = 1.25) {
63
68
  const sizeImage = this.getSizeImageByPartition(index);
64
69
  let baseRadius;
65
- if (this.options[index].name) {
70
+ if (this.options[index].Name) {
66
71
  baseRadius = this.radius - sizeImage / 2 - 3 * this.ratio;
67
72
  }
68
73
  else {
@@ -70,25 +75,21 @@ export class SvgCalc {
70
75
  }
71
76
  return Object.assign(Object.assign({}, this.getPropsForPartitionInfo(index, this.getOffsetImage(sizeImage), baseRadius, ContentDirection.outward)), { width: sizeImage, height: sizeImage });
72
77
  }
73
- getSvgTextProps(index) {
78
+ getSvgTextProps(index, size) {
74
79
  const sizeImage = this.getSizeImageByPartition(index);
75
80
  let baseRadius;
76
- if (this.options[index].image) {
81
+ if (this.options[index].Image) {
77
82
  baseRadius = this.radius - sizeImage - 6 * this.ratio;
78
83
  }
79
84
  else {
80
85
  baseRadius = this.radius - 6 * this.ratio;
81
86
  }
82
- return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius));
87
+ return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius, undefined, size));
83
88
  }
84
89
  getSvgTextPropsAdjustedByImage(index) {
85
- const props = this.getSvgTextProps(index);
86
- const size = this.options[index].image ? 80 : 100;
87
- const objectSize = {
88
- width: size,
89
- height: size
90
- };
91
- return Object.assign(Object.assign(Object.assign({}, props), objectSize), { x: this.contentdirection === 'clockwise' ? props.x : props.x - objectSize.width, y: props.y - objectSize.height / 2 });
90
+ const size = this.options[index].Image ? 80 : 100;
91
+ const props = this.getSvgTextProps(index, size);
92
+ return Object.assign({}, props);
92
93
  }
93
94
  get offsetText() {
94
95
  return {
@@ -107,8 +108,8 @@ export class SvgCalc {
107
108
  return {
108
109
  center: 0,
109
110
  position: {
110
- x: -1 * sizeImage / 2,
111
- y: -1 * sizeImage / 2
111
+ x: (-1 * sizeImage) / 2,
112
+ y: (-1 * sizeImage) / 2
112
113
  },
113
114
  transform: {
114
115
  x: 0,
@@ -120,14 +121,13 @@ export class SvgCalc {
120
121
  return RotateDirection.clockwise;
121
122
  }
122
123
  getAngleSelf(index, contentDirection) {
123
- const baseAngle = 360 * index / this.length * this.direction;
124
+ const baseAngle = ((360 * index) / this.length) * this.direction;
124
125
  const fixerAngle = 90 * (contentDirection !== undefined ? contentDirection : ContentDirection[this.contentdirection]);
125
126
  const resultAngle = baseAngle + fixerAngle;
126
127
  return resultAngle;
127
128
  }
128
129
  getPartitionPositions(index, baseRadius, offset) {
129
- const angle = this.angleTransform(this.arrowmode) +
130
- this.direction * index * 2 * Math.PI / this.length;
130
+ const angle = this.angleTransform(this.arrowmode) + (this.direction * index * 2 * Math.PI) / this.length;
131
131
  const point = getPointOnCircle(baseRadius || this.radius - 9 * this.ratio, angle, this.center + offset.center);
132
132
  const transformOrigin = pointPlus(point, offset.transform);
133
133
  const pointResult = pointPlus(point, offset.position);
@@ -136,13 +136,17 @@ export class SvgCalc {
136
136
  point: pointResult
137
137
  };
138
138
  }
139
- getPropsForPartitionInfo(index, offset, baseRadius, contentDirection) {
139
+ getPropsForPartitionInfo(index, offset, baseRadius, contentDirection, size) {
140
140
  const { point, transformOrigin } = this.getPartitionPositions(index, baseRadius, offset);
141
- const getTransformOriginString = (vector) => Object.keys(vector).map(axis => `${vector[axis]}px`).join(' ');
141
+ const getTransformOriginString = (vector) => Object.keys(vector)
142
+ .map((axis) => `${vector[axis]}px`)
143
+ .join(' ');
142
144
  return Object.assign(Object.assign({}, point), { style: {
143
145
  'font-size': `${13 * this.ratio}px`,
144
- 'transform': `rotate(${this.getAngleSelf(index, contentDirection)}deg)`,
145
- 'transform-origin': `${getTransformOriginString(transformOrigin)}`
146
+ transform: `rotate(${this.getAngleSelf(index, contentDirection)}deg) translate(${this.contentdirection === 'clockwise' ? point.x : point.x - 100}px, ${point.y - 100 / 2}px)`,
147
+ 'transform-origin': `${getTransformOriginString(transformOrigin)}`,
148
+ height: `${size}px`,
149
+ width: `${size}px`
146
150
  } });
147
151
  }
148
152
  getPartitionDraw(index) {
@@ -150,8 +154,10 @@ export class SvgCalc {
150
154
  const rRingInnerPoint = getSymmetricalPointFromScalar(this.radius);
151
155
  const { point, pointNext } = getPointWithNext(index, this.length, this.radius, this.center);
152
156
  const ds = [
153
- 'M', ...mapObjectValueToTuple(rPoint),
154
- 'L', ...mapObjectValueToTuple(point),
157
+ 'M',
158
+ ...mapObjectValueToTuple(rPoint),
159
+ 'L',
160
+ ...mapObjectValueToTuple(point),
155
161
  'A',
156
162
  ...mapObjectValueToTuple(rRingInnerPoint),
157
163
  '0 0 1',
@@ -252,7 +252,7 @@ const params = [
252
252
  },
253
253
  ];
254
254
 
255
- const mapObjectValueToTuple = (object) => Object.keys(object).map(key => object[key]);
255
+ const mapObjectValueToTuple = (object) => Object.keys(object).map((key) => object[key]);
256
256
  var RotateDirection;
257
257
  (function (RotateDirection) {
258
258
  RotateDirection[RotateDirection["clockwise"] = 1] = "clockwise";
@@ -261,12 +261,12 @@ var RotateDirection;
261
261
  class SvgCalc {
262
262
  constructor({ size, radius, options, themeIndex, contentdirection }) {
263
263
  this.arrowmode = ArrowMode.DownFromTop;
264
- this.convertDegToArc = (deg) => deg * Math.PI / 180;
265
- this.convertArcToDeg = (arc) => arc * 180 / Math.PI % 360;
266
- this.getArcDelta = (n) => 2 * Math.PI / n;
264
+ this.convertDegToArc = (deg) => (deg * Math.PI) / 180;
265
+ this.convertArcToDeg = (arc) => ((arc * 180) / Math.PI) % 360;
266
+ this.getArcDelta = (n) => (2 * Math.PI) / n;
267
267
  this.findDeg = (index, n) => {
268
268
  const degDelta = this.convertArcToDeg(this.getArcDelta(n));
269
- return (index) * degDelta;
269
+ return index * degDelta;
270
270
  };
271
271
  this.angleTransform = (arrowmode) => {
272
272
  switch (arrowmode) {
@@ -278,7 +278,7 @@ class SvgCalc {
278
278
  return Math.PI / 2;
279
279
  }
280
280
  };
281
- this.contentdirection = contentdirection || 'anticlockwise';
281
+ this.contentdirection = contentdirection;
282
282
  // size
283
283
  this.center = size / 2;
284
284
  this.ratio = size / 375;
@@ -291,20 +291,25 @@ class SvgCalc {
291
291
  this.radius = radius;
292
292
  }
293
293
  get sizeImage() {
294
- const getSize = (length) => this.ratio * 48 * 5 / length;
294
+ const getSize = (length) => (this.ratio * 48 * 5) / length;
295
295
  if (this.length <= 3)
296
296
  return getSize(4);
297
297
  switch (this.length) {
298
298
  case 8:
299
- case 7: return this.ratio * 24;
300
- case 6: return this.ratio * 36;
301
- case 5: return this.ratio * 48;
302
- case 4: return this.ratio * 56;
303
- default: return getSize(this.length);
299
+ case 7:
300
+ return this.ratio * 24;
301
+ case 6:
302
+ return this.ratio * 36;
303
+ case 5:
304
+ return this.ratio * 48;
305
+ case 4:
306
+ return this.ratio * 56;
307
+ default:
308
+ return getSize(this.length);
304
309
  }
305
310
  }
306
311
  getSizeImageByPartition(index) {
307
- if (this.options[index].name) {
312
+ if (this.options[index].Name) {
308
313
  return this.sizeImage / 2;
309
314
  }
310
315
  else {
@@ -314,7 +319,7 @@ class SvgCalc {
314
319
  getSvgImageProps(index, partitionDivisor = 1.25) {
315
320
  const sizeImage = this.getSizeImageByPartition(index);
316
321
  let baseRadius;
317
- if (this.options[index].name) {
322
+ if (this.options[index].Name) {
318
323
  baseRadius = this.radius - sizeImage / 2 - 3 * this.ratio;
319
324
  }
320
325
  else {
@@ -322,25 +327,21 @@ class SvgCalc {
322
327
  }
323
328
  return Object.assign(Object.assign({}, this.getPropsForPartitionInfo(index, this.getOffsetImage(sizeImage), baseRadius, ContentDirection.outward)), { width: sizeImage, height: sizeImage });
324
329
  }
325
- getSvgTextProps(index) {
330
+ getSvgTextProps(index, size) {
326
331
  const sizeImage = this.getSizeImageByPartition(index);
327
332
  let baseRadius;
328
- if (this.options[index].image) {
333
+ if (this.options[index].Image) {
329
334
  baseRadius = this.radius - sizeImage - 6 * this.ratio;
330
335
  }
331
336
  else {
332
337
  baseRadius = this.radius - 6 * this.ratio;
333
338
  }
334
- return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius));
339
+ return Object.assign({}, this.getPropsForPartitionInfo(index, this.offsetText, baseRadius, undefined, size));
335
340
  }
336
341
  getSvgTextPropsAdjustedByImage(index) {
337
- const props = this.getSvgTextProps(index);
338
- const size = this.options[index].image ? 80 : 100;
339
- const objectSize = {
340
- width: size,
341
- height: size
342
- };
343
- return Object.assign(Object.assign(Object.assign({}, props), objectSize), { x: this.contentdirection === 'clockwise' ? props.x : props.x - objectSize.width, y: props.y - objectSize.height / 2 });
342
+ const size = this.options[index].Image ? 80 : 100;
343
+ const props = this.getSvgTextProps(index, size);
344
+ return Object.assign({}, props);
344
345
  }
345
346
  get offsetText() {
346
347
  return {
@@ -359,8 +360,8 @@ class SvgCalc {
359
360
  return {
360
361
  center: 0,
361
362
  position: {
362
- x: -1 * sizeImage / 2,
363
- y: -1 * sizeImage / 2
363
+ x: (-1 * sizeImage) / 2,
364
+ y: (-1 * sizeImage) / 2
364
365
  },
365
366
  transform: {
366
367
  x: 0,
@@ -372,14 +373,13 @@ class SvgCalc {
372
373
  return RotateDirection.clockwise;
373
374
  }
374
375
  getAngleSelf(index, contentDirection) {
375
- const baseAngle = 360 * index / this.length * this.direction;
376
+ const baseAngle = ((360 * index) / this.length) * this.direction;
376
377
  const fixerAngle = 90 * (contentDirection !== undefined ? contentDirection : ContentDirection[this.contentdirection]);
377
378
  const resultAngle = baseAngle + fixerAngle;
378
379
  return resultAngle;
379
380
  }
380
381
  getPartitionPositions(index, baseRadius, offset) {
381
- const angle = this.angleTransform(this.arrowmode) +
382
- this.direction * index * 2 * Math.PI / this.length;
382
+ const angle = this.angleTransform(this.arrowmode) + (this.direction * index * 2 * Math.PI) / this.length;
383
383
  const point = getPointOnCircle(baseRadius || this.radius - 9 * this.ratio, angle, this.center + offset.center);
384
384
  const transformOrigin = pointPlus(point, offset.transform);
385
385
  const pointResult = pointPlus(point, offset.position);
@@ -388,13 +388,17 @@ class SvgCalc {
388
388
  point: pointResult
389
389
  };
390
390
  }
391
- getPropsForPartitionInfo(index, offset, baseRadius, contentDirection) {
391
+ getPropsForPartitionInfo(index, offset, baseRadius, contentDirection, size) {
392
392
  const { point, transformOrigin } = this.getPartitionPositions(index, baseRadius, offset);
393
- const getTransformOriginString = (vector) => Object.keys(vector).map(axis => `${vector[axis]}px`).join(' ');
393
+ const getTransformOriginString = (vector) => Object.keys(vector)
394
+ .map((axis) => `${vector[axis]}px`)
395
+ .join(' ');
394
396
  return Object.assign(Object.assign({}, point), { style: {
395
397
  'font-size': `${13 * this.ratio}px`,
396
- 'transform': `rotate(${this.getAngleSelf(index, contentDirection)}deg)`,
397
- 'transform-origin': `${getTransformOriginString(transformOrigin)}`
398
+ transform: `rotate(${this.getAngleSelf(index, contentDirection)}deg) translate(${this.contentdirection === 'clockwise' ? point.x : point.x - 100}px, ${point.y - 100 / 2}px)`,
399
+ 'transform-origin': `${getTransformOriginString(transformOrigin)}`,
400
+ height: `${size}px`,
401
+ width: `${size}px`
398
402
  } });
399
403
  }
400
404
  getPartitionDraw(index) {
@@ -402,8 +406,10 @@ class SvgCalc {
402
406
  const rRingInnerPoint = getSymmetricalPointFromScalar(this.radius);
403
407
  const { point, pointNext } = getPointWithNext(index, this.length, this.radius, this.center);
404
408
  const ds = [
405
- 'M', ...mapObjectValueToTuple(rPoint),
406
- 'L', ...mapObjectValueToTuple(point),
409
+ 'M',
410
+ ...mapObjectValueToTuple(rPoint),
411
+ 'L',
412
+ ...mapObjectValueToTuple(point),
407
413
  'A',
408
414
  ...mapObjectValueToTuple(rRingInnerPoint),
409
415
  '0 0 1',
@@ -563,7 +569,9 @@ const CasinoEngagementSuiteLuckywheel = class {
563
569
  .then((res) => res.text())
564
570
  .then((data) => {
565
571
  cssFile.innerHTML = data;
566
- setTimeout(() => { this.host.prepend(cssFile); }, 1);
572
+ setTimeout(() => {
573
+ this.host.prepend(cssFile);
574
+ }, 1);
567
575
  })
568
576
  .catch((err) => {
569
577
  console.log('Error ', err);
@@ -598,7 +606,7 @@ const CasinoEngagementSuiteLuckywheel = class {
598
606
  window.postMessage({
599
607
  type: 'SpinLuckyWheel',
600
608
  data: {
601
- lotteryProgramID: this.luckywheel.Program.Id,
609
+ lotteryProgramID: this.luckywheel.Program.Id
602
610
  }
603
611
  });
604
612
  };
@@ -613,7 +621,7 @@ const CasinoEngagementSuiteLuckywheel = class {
613
621
  this.isPartitionsCustomableReady = false;
614
622
  this.isSpinning = false;
615
623
  this.options = undefined;
616
- this.radius = 0.85 * Number(this.size) / 2;
624
+ this.radius = (0.85 * Number(this.size)) / 2;
617
625
  this.speed = 0;
618
626
  this.settings = undefined;
619
627
  this.svg = undefined;
@@ -628,11 +636,12 @@ const CasinoEngagementSuiteLuckywheel = class {
628
636
  const hasError = rest.success === false;
629
637
  const index = +rest.data.Result.WheelOfFortunePartitionIndex;
630
638
  this.spinner.halt(this.settings.getDeg(index), () => {
639
+ var _a;
631
640
  this.isSpinning = false;
632
641
  this.updateSpinable();
633
642
  let prizeText = '';
634
643
  if (!hasError) {
635
- const partition = this.luckywheel.Program.WheelOfFortune.Partitions[index];
644
+ const partition = (_a = this.luckywheel.Program.WheelOfFortune.Partitions[index]) === null || _a === void 0 ? void 0 : _a.PrizeText;
636
645
  prizeText = partition[this.language] || partition['*'];
637
646
  this.luckywheel.Current.RemainingTimes = +this.luckywheel.Current.RemainingTimes - 1;
638
647
  }
@@ -640,7 +649,7 @@ const CasinoEngagementSuiteLuckywheel = class {
640
649
  type: 'ShowLuckywheelRewardModal',
641
650
  data: {
642
651
  PrizeMessage: prizeText,
643
- HasError: hasError,
652
+ HasError: hasError
644
653
  }
645
654
  });
646
655
  });
@@ -668,11 +677,7 @@ const CasinoEngagementSuiteLuckywheel = class {
668
677
  this.spinner = new Spinner({
669
678
  tick: (deg, speed) => {
670
679
  setProps(this.spinContainer, {
671
- style: [
672
- `transform: rotate(${deg}deg)`,
673
- `height: ${this.size}px`,
674
- `width: ${this.size}px`,
675
- ].join(';'),
680
+ style: [`transform: rotate(${deg}deg)`, `height: ${this.size}px`, `width: ${this.size}px`].join(';')
676
681
  });
677
682
  this.speed = speed * 0.5;
678
683
  }
@@ -683,26 +688,32 @@ const CasinoEngagementSuiteLuckywheel = class {
683
688
  '--length': `${this.options.length}`,
684
689
  '--radius': `${this.radius}`,
685
690
  '--ratio': `${Number(this.size) / 480}`,
686
- '--size': `${this.size}`,
691
+ '--size': `${this.size}`
687
692
  };
688
693
  }
689
694
  render() {
690
695
  const sizeProps = { height: this.size, width: this.size };
691
- const foreignObjectAgentProps = { 'height': `${this.size}px`, 'width': `${this.size}px` };
692
- return (h("div", { key: 'b2c5ec30fc58e6758a2bdf6703055bdddddd99af', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '5176b473af31b7f96c211d5be56b4dfcd67681a6', width: this.size, height: this.size, ref: (el) => { this.svg = el; } }, h("foreignObject", Object.assign({ key: 'aa80be601163398a24f4aa77007e971cffbfd238' }, sizeProps, { class: "Bottom Customable" }), h("div", { key: 'a24e0f121d43ccfbf6457e0ddbdf5f9d051eed00', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '63926d76e820cceed585510f960c37991d187a20', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '6ae912f06d75f3c3f3d35b66f806940f6ded8b87', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
693
- return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: { '--index': index.toString() }, width: this.size, height: this.size }, h("div", { style: foreignObjectAgentProps })));
694
- })), h("g", { key: '971611dc5b132701679595ec5ee317d97121029d', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
696
+ const foreignObjectAgentProps = { height: `${this.size}px`, width: `${this.size}px` };
697
+ return (h("div", { key: 'ea47ff81b5aa4173b448295e474f94e8c2799aec', class: `WheelContainer ${this.device}`, style: this.defineGeneralVariables() }, h("svg", { key: '6c486c941b63b79a0e33ef2a078b225869080b9d', width: this.size, height: this.size, ref: (el) => {
698
+ this.svg = el;
699
+ } }, h("foreignObject", Object.assign({ key: '4dd2fc761bc1914e3e5104fdfaf03c126f481e5d' }, sizeProps, { style: foreignObjectAgentProps, class: "Bottom Customable" }), h("div", { key: '621ea705e477cadafa8be17108e0ccab3a8833f3', style: foreignObjectAgentProps })), h("g", Object.assign({ key: '61642e6056a75a114c8d3d4bab22bde7fe17afff', class: "PartitionsContainer" }, this.settings.getSpinnerProps()), h("g", { key: '53cc83c283e3d7eb625c4d9687c2862173bdee86', class: "PartitionsBackgrounds" }, this.options.map((_el, index) => {
700
+ return (h("foreignObject", { "clip-path": `url(#clip${index})`, class: "PartitionBackground Customable", style: Object.assign({ '--index': index.toString() }, foreignObjectAgentProps) }, h("div", { style: foreignObjectAgentProps })));
701
+ })), h("g", { key: '51ca18f5b7c877357a60d2ceb8f9b99cafcf6818', class: "PartitionsBackgroundStrokes" }, this.options.map((_el, index) => {
695
702
  return (h("path", Object.assign({ class: "PartitionBackgroundStroke" }, this.settings.getPartitionDraw(index), { width: this.size, height: this.size })));
696
- })), h("g", { key: '51b1c3319cf8db82e73008df9dd45bcddfe349fe', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
697
- return ([
703
+ })), h("g", { key: 'cc81bbe2e72960ced6562702ab7be1dc7973480c', class: "Partitions", style: { filter: this.speed > 0.3 ? `blur(${this.speed}px)` : '' } }, this.options.map((el, index) => {
704
+ return [
698
705
  el.Image && (h("g", { class: `PartitionImage PartitionImage${index}`, ref: (el) => this.renderImage(el, index) })),
699
706
  el.Name && (h("foreignObject", Object.assign({ class: "PartitionText" }, this.settings.getSvgTextPropsAdjustedByImage(index)), h("div", { class: "PartitionTextEntityContainer" }, h("p", { class: `PartitionTextEntity${this.settings.contentdirection === 'clockwise' ? '' : ' Anticlockwise'}`, innerHTML: el.Name }))))
700
- ]);
701
- }))), h("g", { key: 'b892a4cc21a37e7981a5dfabf1f7e16d2f0493f7', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable1': true } }, this.options.map((_el, index) => {
707
+ ];
708
+ }))), h("g", { key: 'd126a5bde2af4b31f32ec029c117637fa5983e20', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable1: true } }, this.options.map((_el, index) => {
702
709
  return (h("foreignObject", Object.assign({ class: "Partition1 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
703
- })), h("g", { key: '6d572edae8f005204257154eafa77e2fa1f54356', class: { 'active': this.isPartitionsCustomableReady, 'PartitionsCustomable2': true } }, this.options.map((_el, index) => {
710
+ })), h("g", { key: 'abb7544782eb40d08fa1304612f69ed389e10dcf', class: { active: this.isPartitionsCustomableReady, PartitionsCustomable2: true } }, this.options.map((_el, index) => {
704
711
  return (h("foreignObject", Object.assign({ class: "Partition2 Customable", style: { '--index': index.toString() } }, sizeProps), h("div", { style: foreignObjectAgentProps })));
705
- })), h("foreignObject", Object.assign({ key: 'd1a8bb686fe1d76301a6fe824b13dd212b1ce060', class: "Middle Customable" }, sizeProps), h("div", { key: 'f5fb21485fd3c8bd3f127a6714c65d488e51d6f5', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: '3ccd35ea0ed62a3d23e85af0008ac9bc236dfc2d', class: "Top Customable" }, sizeProps), h("div", { key: '60abed1d4fb4d57dfa20bf5ff7368b47dd32629c', style: foreignObjectAgentProps })), h("g", { key: '758e906615752e067e94cb33242c60c1a811e78e', class: { 'spinning': this.isSpinning, 'Center': true }, onClick: this.eventSpin }, h("foreignObject", { key: '3064736e103ecd1b9b0cb3a0582283e146bab4b5', x: Number(this.size) / 2 - 100 / 2, y: Number(this.size) / 2 - 100 / 2, width: 100, height: 100 })), h("g", { key: '277f36735b58e24e424179ca7082851adf470af1' }, this.options.map((_el, index) => {
712
+ })), h("foreignObject", Object.assign({ key: 'a76b670602be3050180ab71b2e4e424937865358', class: "Middle Customable" }, sizeProps, { style: foreignObjectAgentProps }), h("div", { key: '1d074b872c29092a51ce7a8c2c8cf2e4a84c1381', style: foreignObjectAgentProps })), h("foreignObject", Object.assign({ key: 'b8525ca3463cbde5a12f47655bc82451ef648012', class: "Top Customable" }, sizeProps, { style: foreignObjectAgentProps }), h("div", { key: 'ddbe297ea9947778975248dd111faed457bb9433', style: foreignObjectAgentProps })), h("g", { key: '0d247fcbc8734643bc36f9f457876d3b4cb462fa', class: { spinning: this.isSpinning, Center: true }, onClick: this.eventSpin }, h("foreignObject", { key: 'b63e7d4e9f73c101305c4854565ad9ce9c11c171', style: {
713
+ width: '100px',
714
+ height: '100px',
715
+ transform: `translate(${Number(this.size) / 2 - 100 / 2}px, ${Number(this.size) / 2 - 100 / 2}px)`
716
+ } })), h("g", { key: 'd3e9be9a11f4c6d8c6abff35936c33ff5cf8c26d' }, this.options.map((_el, index) => {
706
717
  return (h("clipPath", { id: `clip${index}` }, h("path", Object.assign({}, this.settings.getPartitionDraw(index)))));
707
718
  })))));
708
719
  }
@@ -1,2 +1,2 @@
1
- export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-61c38863.js';
1
+ export { C as casino_engagement_suite_luckywheel } from './casino-engagement-suite-luckywheel-45c7f146.js';
2
2
  import './index-48c42d04.js';
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { C as CasinoEngagementSuiteLuckywheel } from './casino-engagement-suite-luckywheel-61c38863.js';
1
+ export { C as CasinoEngagementSuiteLuckywheel } from './casino-engagement-suite-luckywheel-45c7f146.js';
2
2
  import './index-48c42d04.js';
@@ -1,5 +1,5 @@
1
- import { ArrowMode, ContentDirection } from "./types.js";
2
- import type { Point } from "./types.js";
1
+ import { ArrowMode, ContentDirection } from './types.js';
2
+ import type { Point } from './types.js';
3
3
  type MapObjectValueToTuple<T extends Object> = T[keyof T][];
4
4
  export declare const mapObjectValueToTuple: <T>(object: T) => MapObjectValueToTuple<T>;
5
5
  declare enum RotateDirection {
@@ -36,29 +36,33 @@ export declare class SvgCalc {
36
36
  'font-size': string;
37
37
  transform: string;
38
38
  'transform-origin': string;
39
+ height: string;
40
+ width: string;
39
41
  };
40
42
  x: number;
41
43
  y: number;
42
44
  };
43
- getSvgTextProps(index: any): {
45
+ getSvgTextProps(index: any, size: any): {
44
46
  style: {
45
47
  'font-size': string;
46
48
  transform: string;
47
49
  'transform-origin': string;
50
+ height: string;
51
+ width: string;
48
52
  };
49
53
  x: number;
50
54
  y: number;
51
55
  };
52
56
  getSvgTextPropsAdjustedByImage(index: any): {
53
- x: number;
54
- y: number;
55
- width: number;
56
- height: number;
57
57
  style: {
58
58
  'font-size': string;
59
59
  transform: string;
60
60
  'transform-origin': string;
61
+ height: string;
62
+ width: string;
61
63
  };
64
+ x: number;
65
+ y: number;
62
66
  };
63
67
  get offsetText(): {
64
68
  center: number;
@@ -88,11 +92,13 @@ export declare class SvgCalc {
88
92
  transformOrigin: Point;
89
93
  point: Point;
90
94
  };
91
- getPropsForPartitionInfo(index: number, offset: any, baseRadius?: number, contentDirection?: ContentDirection): {
95
+ getPropsForPartitionInfo(index: number, offset: any, baseRadius?: number, contentDirection?: ContentDirection, size?: string): {
92
96
  style: {
93
97
  'font-size': string;
94
98
  transform: string;
95
99
  'transform-origin': string;
100
+ height: string;
101
+ width: string;
96
102
  };
97
103
  x: number;
98
104
  y: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/casino-engagement-suite-luckywheel",
3
- "version": "0.6.4",
3
+ "version": "0.7.0",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1,15 +0,0 @@
1
- import{r as t,h as i,g as e}from"./p-7d1170ae.js";
2
- /*! *****************************************************************************
3
- Copyright (c) Microsoft Corporation.
4
-
5
- Permission to use, copy, modify, and/or distribute this software for any
6
- purpose with or without fee is hereby granted.
7
-
8
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
9
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
10
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
11
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
12
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
13
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
14
- PERFORMANCE OF THIS SOFTWARE.
15
- ***************************************************************************** */var s,r,n,a,o,h;!function(t){t.Arrow="Arrow",t.Partition="Partition"}(s||(s={})),function(t){t.DownFromTop="DownFromTop",t.UpFromCenter="UpFromCenter",t.DownFromCenter="DownFromCenter",t.UpFromBottom="UpFromBottom"}(r||(r={})),function(t){t.en="en",t.fr="fr",t.de="de",t.tr="tr"}(n||(n={})),function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise",t[t.outward=0]="outward"}(a||(a={})),function(t){t.launch="launch",t.loop="loop",t.halt="halt"}(o||(o={})),function(t){t.quad="quad",t.cubic="cubic",t.quart="quart",t.quint="quint",t.expo="expo",t.sine="sine",t.circ="circ"}(h||(h={}));const c=(t,i)=>{Object.keys(i).map((e=>{t.setAttribute(e.split(/(?=[A-Z])/).map((t=>t.toLocaleLowerCase())).join("-"),i[e])}))},d=t=>new Promise((i=>{let e=document.createElementNS("http://www.w3.org/2000/svg","image");e.onload=()=>i(e),e.onerror=()=>i(e),e.href.baseVal=t})),l=t=>({x:t,y:t}),u=(t,i)=>({x:t.x+i.x,y:t.y+i.y}),g={Image:"",Name:"Thank you",PrizeText:"",PrizeImage:""},b=async(t,i)=>{let e=((t,i)=>{const e=t.map((t=>{const e={};return Object.keys(t).map((s=>{"object"==typeof t[s]&&t[s]&&(e["Image1"===s?"Image":s]=t[s][i]||t[s]["*"])})),e}));return(t=>{let i=0;return t.map((t=>{i+=Number(t.probability)})),i})(t)<1&&e.push(g),e})(t.Program.WheelOfFortune.Partitions,i);return e=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)?e.map((t=>{if(t.Image){const i=document.createElementNS("http://www.w3.org/2000/svg","image");return i.href.baseVal=t.Image,Object.assign(Object.assign({},t),{Image:i})}return t})):await Promise.all(e.map((async t=>Object.assign(Object.assign({},t),await(async t=>t?{Image:await d(t)}:{})(t.Image))))),e},f={in:{quad:t=>Math.pow(t,2),cubic:t=>Math.pow(t,3),quart:t=>Math.pow(t,4),quint:t=>Math.pow(t,5),sine:t=>1-Math.cos(t*Math.PI/2),expo:t=>0===t?0:Math.pow(2,10*t-10),circ:t=>1-Math.sqrt(1-Math.pow(t,2))},out:{quad:t=>1-Math.pow(1-t,2),cubic:t=>1-Math.pow(1-t,3),quart:t=>1-Math.pow(1-t,4),quint:t=>1-Math.pow(1-t,5),sine:t=>Math.sin(t*Math.PI/2),expo:t=>1===t?1:1-Math.pow(2,-10*t),circ:t=>Math.sqrt(1-Math.pow(t-1,2))}},m={quad:2,cubic:3,quart:4,quint:5,sine:Math.PI/2,expo:Math.LN2,circ:1/0},p={in:{quad:t=>2*t,cubic:t=>3*t**2,quart:t=>4*t**3,quint:t=>5*t**4,sine:t=>Math.PI/2*Math.sin(Math.PI/2*t),expo:t=>10*Math.LN2*2**(10*t-10),circ:t=>-.5*(1-t**2)**-.5},out:{cubic:t=>3*t**2-6*t+3}},y=[{launchTurns:5,launchSpeed:.2,loopSpeed:15,haltTurns:2,haltSpeed:.16},{launchTurns:2,launchSpeed:.5,loopSpeed:20,haltTurns:2,haltSpeed:.22},{launchTurns:6,launchSpeed:1.38,loopSpeed:45,haltTurns:6,haltSpeed:.5}],v=t=>Object.keys(t).map((i=>t[i]));var x;!function(t){t[t.clockwise=1]="clockwise",t[t.anticlockwise=-1]="anticlockwise"}(x||(x={}));class k{constructor({size:t,radius:i,options:e,themeIndex:s,contentdirection:n}){this.arrowmode=r.DownFromTop,this.convertDegToArc=t=>t*Math.PI/180,this.convertArcToDeg=t=>180*t/Math.PI%360,this.getArcDelta=t=>2*Math.PI/t,this.findDeg=(t,i)=>t*this.convertArcToDeg(this.getArcDelta(i)),this.angleTransform=t=>{switch(t){case r.DownFromTop:case r.UpFromCenter:return-Math.PI/2;case r.DownFromCenter:case r.UpFromBottom:return Math.PI/2}},this.contentdirection=n||"anticlockwise",this.center=t/2,this.ratio=t/375,this.options=e,this.length=e.length,this.themeIndex=s,this.radius=i}get sizeImage(){const t=t=>48*this.ratio*5/t;if(this.length<=3)return t(4);switch(this.length){case 8:case 7:return 24*this.ratio;case 6:return 36*this.ratio;case 5:return 48*this.ratio;case 4:return 56*this.ratio;default:return t(this.length)}}getSizeImageByPartition(t){return this.options[t].name?this.sizeImage/2:this.sizeImage}getSvgImageProps(t,i=1.25){const e=this.getSizeImageByPartition(t);let s;return s=this.options[t].name?this.radius-e/2-3*this.ratio:(this.radius-e/2)/Number(i)-3*this.ratio,Object.assign(Object.assign({},this.getPropsForPartitionInfo(t,this.getOffsetImage(e),s,a.outward)),{width:e,height:e})}getSvgTextProps(t){const i=this.getSizeImageByPartition(t);let e;return e=this.options[t].image?this.radius-i-6*this.ratio:this.radius-6*this.ratio,Object.assign({},this.getPropsForPartitionInfo(t,this.offsetText,e))}getSvgTextPropsAdjustedByImage(t){const i=this.getSvgTextProps(t),e=this.options[t].image?80:100,s={width:e,height:e};return Object.assign(Object.assign(Object.assign({},i),s),{x:"clockwise"===this.contentdirection?i.x:i.x-s.width,y:i.y-s.height/2})}get offsetText(){return{center:0,position:{x:0,y:0},transform:{x:0,y:0}}}getOffsetImage(t){return{center:0,position:{x:-1*t/2,y:-1*t/2},transform:{x:0,y:0}}}get direction(){return x.clockwise}getAngleSelf(t,i){return 360*t/this.length*this.direction+90*(void 0!==i?i:a[this.contentdirection])}getPartitionPositions(t,i,e){const s=this.angleTransform(this.arrowmode)+this.direction*t*2*Math.PI/this.length,r=((t,i,e)=>{const s=l(e);return{x:s.x+t*Math.cos(i),y:s.y+t*Math.sin(i)}})(i||this.radius-9*this.ratio,s,this.center+e.center);return{transformOrigin:u(r,e.transform),point:u(r,e.position)}}getPropsForPartitionInfo(t,i,e,s){const{point:r,transformOrigin:n}=this.getPartitionPositions(t,e,i);return Object.assign(Object.assign({},r),{style:{"font-size":13*this.ratio+"px",transform:`rotate(${this.getAngleSelf(t,s)}deg)`,"transform-origin":`${a=n,Object.keys(a).map((t=>`${a[t]}px`)).join(" ")}`}});var a}getPartitionDraw(t){const i=l(this.center),e=l(this.radius),{point:s,pointNext:r}=((t,i,e,s)=>{const r=t=>((t,i,e,s)=>{const r=Math.PI/180*(360/i*(t-.5)-90),n=l(s),a=l(e);return{x:n.x+a.x*Math.cos(r),y:n.y+a.y*Math.sin(r)}})(t,i,e,s);return{point:r(t),pointNext:r(t+1)}})(t,this.length,this.radius,this.center);return{d:["M",...v(i),"L",...v(s),"A",...v(e),"0 0 1",...v(r),"Z"].join(" ")}}getDeg(t){return this.findDeg(length-(t||this.length-1),length)}getSpinnerProps(){const t=l(this.center);return{"transform-origin":`${t.x} ${t.y}`}}}class w{constructor(t){this.deg=0,this.degTarget=void 0,this.step=void 0,this.easingType=h.cubic,this.param=y[2],this.halt=(t,i=(()=>{}))=>{this.shouldHalt=()=>{this.step=o.halt,this.cb=()=>{i(),this.setDeg(t,0)},this.degTarget=t+360*this.param.haltTurns,this.continueRepeat()}},this.continueRepeat=()=>setTimeout((()=>this.ticker()),30),this.ticker=()=>{const t=this.param.loopSpeed,i=t=>33*m[this.easingType]*t/this.param.loopSpeed,e=()=>{const t=360*this.param.launchTurns-this.deg,e=i(t);this.animateF(e,this.deg,t,f.in[this.easingType],p.in[this.easingType])},s=()=>{const t=i(this.degTarget);this.animateF(t,0,this.degTarget,f.out[this.easingType],p.out[this.easingType])},r=()=>{this.setDeg((this.deg+t)%360,m[this.easingType]),this.continueRepeat()};({[o.launch]:()=>{this.cb=()=>{this.step=o.loop,this.setDeg(t,m[this.easingType]),this.continueRepeat()},e()},[o.loop]:()=>{this.shouldHalt&&0===this.deg?this.shouldHalt():r()},[o.halt]:()=>{this.deg===360-t?s():r()}})[this.step]()},this.setDeg=(t,i)=>{this.deg=t,this.tick(t,i)},this.animateF=(t,i,e,s,r)=>{let n=null;const a=()=>{let o=(new Date).getTime();n||(n=o);const h=o-n,c=e*s(h/t)+i,d=Math.abs(r(h/t));this.setDeg(c,d),h<t?setTimeout((()=>a()),30):this.cb()};a()},this.animate=(t,i,e,s,r)=>{let n=null;window.cancelAnimationFrame(n);let a=null;const o=h=>{a||(a=h);const c=h-a,d=e*s(c/t)+i,l=Math.abs(r(c/t));this.setDeg(d,l),c<t?n=window.requestAnimationFrame(o):this.cb()};n=window.requestAnimationFrame(o)},this.tick=t.tick}launch(){this.shouldHalt=void 0,this.step=o.launch,this.ticker()}}const P=class{constructor(i){t(this,i),this.setClientStyling=()=>{let t=document.createElement("style");t.innerHTML=this.clientStyling,this.host.prepend(t)},this.setClientStylingURL=()=>{let t=new URL(this.clientStylingUrl),i=document.createElement("style");fetch(t.href).then((t=>t.text())).then((t=>{i.innerHTML=t,setTimeout((()=>{this.host.prepend(i)}),1)})).catch((t=>{console.log("Error ",t)}))},this.renderImage=(t,i)=>{const e=this.options[i].Image;c(e,this.settings.getSvgImageProps(i)),t.innerHTML=null,t.appendChild(e)},this.updateSpinable=()=>{if(this.luckywheel.Current){if(Number(this.luckywheel.Current.RemainingTimes)>0)return void(this.spinable=!0);window.postMessage({type:"ShowNoSpinLeftModal"})}this.spinable=!1},this.eventSpin=()=>{this.updateSpinable(),this.spinable&&!this.isSpinning&&(this.isSpinning=!0,this.spinContainer=this.svg.querySelector("g.PartitionsContainer"),this.spinner.launch(),window.postMessage({type:"SpinLuckyWheel",data:{lotteryProgramID:this.luckywheel.Program.Id}}))},this.clientStyling="",this.clientStylingUrl="",this.language="en",this.device="Mobile",this.luckywheel=void 0,this.size="440",this.contentdirection="anticlockwise",this.limitStylingAppends=!1,this.isPartitionsCustomableReady=!1,this.isSpinning=!1,this.options=void 0,this.radius=.85*Number(this.size)/2,this.speed=0,this.settings=void 0,this.svg=void 0,this.spinContainer=void 0,this.spinable=void 0,this.spinner=void 0}handleEvent(t){const i=null==t?void 0:t.data,{type:e}=i,s=function(t,i){var e={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&i.indexOf(s)<0&&(e[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(s=Object.getOwnPropertySymbols(t);r<s.length;r++)i.indexOf(s[r])<0&&Object.prototype.propertyIsEnumerable.call(t,s[r])&&(e[s[r]]=t[s[r]])}return e}(i,["type"]);if("SpinLuckyWheelRes"===e){const t=!1===s.success,i=+s.data.Result.WheelOfFortunePartitionIndex;this.spinner.halt(this.settings.getDeg(i),(()=>{this.isSpinning=!1,this.updateSpinable();let e="";if(!t){const t=this.luckywheel.Program.WheelOfFortune.Partitions[i];e=t[this.language]||t["*"],this.luckywheel.Current.RemainingTimes=+this.luckywheel.Current.RemainingTimes-1}window.postMessage({type:"ShowLuckywheelRewardModal",data:{PrizeMessage:e,HasError:t}})}))}}componentDidRender(){!this.limitStylingAppends&&this.host&&(this.clientStyling&&this.setClientStyling(),this.clientStylingUrl&&this.setClientStylingURL(),this.limitStylingAppends=!0)}async componentWillLoad(){this.options=await b(this.luckywheel,n.en),this.settings=new k({size:this.size,radius:this.radius,options:this.options,themeIndex:1,contentdirection:this.contentdirection}),this.spinner=new w({tick:(t,i)=>{c(this.spinContainer,{style:[`transform: rotate(${t}deg)`,`height: ${this.size}px`,`width: ${this.size}px`].join(";")}),this.speed=.5*i}})}defineGeneralVariables(){return{"--length":`${this.options.length}`,"--radius":`${this.radius}`,"--ratio":""+Number(this.size)/480,"--size":`${this.size}`}}render(){const t={height:this.size,width:this.size},e={height:`${this.size}px`,width:`${this.size}px`};return i("div",{key:"b2c5ec30fc58e6758a2bdf6703055bdddddd99af",class:`WheelContainer ${this.device}`,style:this.defineGeneralVariables()},i("svg",{key:"5176b473af31b7f96c211d5be56b4dfcd67681a6",width:this.size,height:this.size,ref:t=>{this.svg=t}},i("foreignObject",Object.assign({key:"aa80be601163398a24f4aa77007e971cffbfd238"},t,{class:"Bottom Customable"}),i("div",{key:"a24e0f121d43ccfbf6457e0ddbdf5f9d051eed00",style:e})),i("g",Object.assign({key:"63926d76e820cceed585510f960c37991d187a20",class:"PartitionsContainer"},this.settings.getSpinnerProps()),i("g",{key:"6ae912f06d75f3c3f3d35b66f806940f6ded8b87",class:"PartitionsBackgrounds"},this.options.map(((t,s)=>i("foreignObject",{"clip-path":`url(#clip${s})`,class:"PartitionBackground Customable",style:{"--index":s.toString()},width:this.size,height:this.size},i("div",{style:e}))))),i("g",{key:"971611dc5b132701679595ec5ee317d97121029d",class:"PartitionsBackgroundStrokes"},this.options.map(((t,e)=>i("path",Object.assign({class:"PartitionBackgroundStroke"},this.settings.getPartitionDraw(e),{width:this.size,height:this.size}))))),i("g",{key:"51b1c3319cf8db82e73008df9dd45bcddfe349fe",class:"Partitions",style:{filter:this.speed>.3?`blur(${this.speed}px)`:""}},this.options.map(((t,e)=>[t.Image&&i("g",{class:`PartitionImage PartitionImage${e}`,ref:t=>this.renderImage(t,e)}),t.Name&&i("foreignObject",Object.assign({class:"PartitionText"},this.settings.getSvgTextPropsAdjustedByImage(e)),i("div",{class:"PartitionTextEntityContainer"},i("p",{class:"PartitionTextEntity"+("clockwise"===this.settings.contentdirection?"":" Anticlockwise"),innerHTML:t.Name})))])))),i("g",{key:"b892a4cc21a37e7981a5dfabf1f7e16d2f0493f7",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable1:!0}},this.options.map(((s,r)=>i("foreignObject",Object.assign({class:"Partition1 Customable",style:{"--index":r.toString()}},t),i("div",{style:e}))))),i("g",{key:"6d572edae8f005204257154eafa77e2fa1f54356",class:{active:this.isPartitionsCustomableReady,PartitionsCustomable2:!0}},this.options.map(((s,r)=>i("foreignObject",Object.assign({class:"Partition2 Customable",style:{"--index":r.toString()}},t),i("div",{style:e}))))),i("foreignObject",Object.assign({key:"d1a8bb686fe1d76301a6fe824b13dd212b1ce060",class:"Middle Customable"},t),i("div",{key:"f5fb21485fd3c8bd3f127a6714c65d488e51d6f5",style:e})),i("foreignObject",Object.assign({key:"3ccd35ea0ed62a3d23e85af0008ac9bc236dfc2d",class:"Top Customable"},t),i("div",{key:"60abed1d4fb4d57dfa20bf5ff7368b47dd32629c",style:e})),i("g",{key:"758e906615752e067e94cb33242c60c1a811e78e",class:{spinning:this.isSpinning,Center:!0},onClick:this.eventSpin},i("foreignObject",{key:"3064736e103ecd1b9b0cb3a0582283e146bab4b5",x:Number(this.size)/2-50,y:Number(this.size)/2-50,width:100,height:100})),i("g",{key:"277f36735b58e24e424179ca7082851adf470af1"},this.options.map(((t,e)=>i("clipPath",{id:`clip${e}`},i("path",Object.assign({},this.settings.getPartitionDraw(e)))))))))}get host(){return e(this)}};P.style=':host{font-family:system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"}*,*::before,*::after{margin:0;padding:0;list-style:none;text-decoration:none;outline:none;box-sizing:border-box}.LotteryProgramWof{background:var(--emw--color-contrast, #07072A);display:flex;align-items:center;flex-direction:column;padding:20px 0}main{max-width:600px;width:100%;display:flex;justify-content:space-around;min-height:200px}svg{transition:opacity 0.3s}.WheelContainer{text-align:center}.FortuneContainer{width:100%;display:flex;align-items:center;flex-direction:column}.Center{cursor:pointer;transition:filter;transition-duration:1s}.Center.disabled{filter:grayscale(80%)}.Center .CenterCircle{fill:#3CE4BB;stroke:rgb(150, 54, 88);stroke-width:2px;cursor:pointer;transition:fill;transition-duration:1s}.Center .CenterText{fill:#FFFFFF}.PointerPartition{opacity:0.3;fill:lightgoldenrodyellow;stroke:red;stroke-width:6px;stroke-dasharray:12}.Current{color:#FFFFFF}.PartitionText{color:#FFFFFF;font-style:normal;font-weight:700;text-anchor:end;text-shadow:0px 3px #000;dominant-baseline:central}.PartitionsShadow{background-blend-mode:multiply;mix-blend-mode:multiply}.PartitionTextEntityContainer{height:100%;display:flex;align-items:center}.PartitionTextEntity{width:100%}.PartitionTextEntity.Anticlockwise{text-align:end}foreignObject.Bottom div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-bg.svg");background-size:calc(var(--radius) * 2px + var(--ratio) * 20px);background-position:center}foreignObject.Middle div{background-image:url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-spin.svg"), url("https://static.everymatrix.com/gic/img/engagement-suite/bar/luckywheel/luckywheel-pointer.svg");background-position:center, center 5px}foreignObject.Top{mix-blend-mode:multiply}foreignObject.Top div{background-image:var(--img-theme-shadow);background-position:center;background-size:calc(var(--radius) * 2px)}foreignObject.Partition1 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc(var(--index) * 360deg / var(--length)))}foreignObject.Partition2 div{background-image:var(--img-theme-partition-light);background-position:center calc((var(--size) / 2 - var(--radius)) * 1px - var(--ratio) * 22px);transform:rotate(calc((var(--index) + 0.5) * 360deg / var(--length)))}foreignObject.PointerArea{mix-blend-mode:screen}foreignObject.PointerArea div{background-image:var(--img-theme-pointer-area);background-position:center -3px;background-size:51%}foreignObject.Partition1 div,foreignObject.Partition2 div{transform-origin:center}.PartitionsCustomable1 div,.PartitionsCustomable2 div{visibility:hidden}.PartitionsCustomable1 div.active,.PartitionsCustomable2 div.active{visibility:visible}foreignObject.Customable{overflow:visible}foreignObject.Customable div{background-repeat:no-repeat}.PartitionBackground div{background-size:calc(var(--radius) * 2 / var(--size) * 100%) calc(var(--radius) * 2 / var(--size) * 100%);background-position:center}.PartitionBackground:nth-child(2n) div{background:var(--emw--color-primary, #3F2E75)}.PartitionBackground:nth-child(2n+1) div{background:var(--emw--color-secondary, #9482CE)}.PartitionBackground div{transform-origin:center}.PartitionBackgroundStroke{fill:transparent;stroke:var(--emw--color-background-secondary, #251D3E);stroke-width:3px;stroke-dasharray:none}.PointerPartitionFrame{stroke:#FFDD64;fill:transparent;stroke-dasharray:var(--radius) calc(6.2831853072 / var(--length) * var(--radius));stroke-width:0px}.PointerPartitionFrame.active{stroke-width:3px}.WheelContainer.Mobile foreignObject.Middle div{background-size:95px, 38px}.PartitionText .PartitionTextEntityContainer .PartitionTextEntity{text-align:center;text-transform:uppercase;text-shadow:none;font-size:var(--emw--font-size-small, 14px);font-weight:900}';export{P as C}
@@ -1 +0,0 @@
1
- export{C as casino_engagement_suite_luckywheel}from"./p-24a65524.js";import"./p-7d1170ae.js";