@everymatrix/lottery-ticket 0.1.24 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-f01e4770.js +1303 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/lottery-bullet_3.cjs.entry.js +402 -440
  5. package/dist/cjs/lottery-ticket.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/lottery-ticket/index.js +1 -0
  8. package/dist/collection/components/lottery-ticket/lottery-ticket.js +435 -485
  9. package/dist/collection/utils/locale.utils.js +53 -43
  10. package/dist/esm/app-globals-0f993ce5.js +3 -0
  11. package/dist/esm/index-cde6554c.js +1276 -0
  12. package/dist/esm/loader.js +7 -13
  13. package/dist/esm/lottery-bullet_3.entry.js +402 -440
  14. package/dist/esm/lottery-ticket.js +14 -11
  15. package/dist/lottery-ticket/lottery-ticket.esm.js +1 -1
  16. package/dist/lottery-ticket/p-174b5b05.entry.js +1 -0
  17. package/dist/lottery-ticket/p-73c1e1fd.js +2 -0
  18. package/dist/lottery-ticket/p-e1255160.js +1 -0
  19. package/dist/stencil.config.dev.js +17 -0
  20. package/dist/stencil.config.js +14 -19
  21. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.d.ts +2 -0
  22. package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/lottery-ticket/.stencil/packages/stencil/lottery-ticket/stencil.config.dev.d.ts +2 -0
  23. package/dist/types/components/lottery-ticket/index.d.ts +1 -0
  24. package/dist/types/components/lottery-ticket/lottery-ticket.d.ts +78 -78
  25. package/dist/types/components/lottery-ticket/lottery-ticket.types.d.ts +31 -31
  26. package/dist/types/components.d.ts +24 -5
  27. package/dist/types/stencil-public-runtime.d.ts +142 -33
  28. package/loader/cdn.js +1 -3
  29. package/loader/index.cjs.js +1 -3
  30. package/loader/index.d.ts +13 -1
  31. package/loader/index.es2017.js +1 -3
  32. package/loader/index.js +1 -3
  33. package/loader/package.json +1 -0
  34. package/package.json +10 -3
  35. package/dist/cjs/index-6033a99f.js +0 -1272
  36. package/dist/components/index.d.ts +0 -26
  37. package/dist/components/index.js +0 -1
  38. package/dist/components/lottery-bullet.js +0 -6
  39. package/dist/components/lottery-bullet2.js +0 -91
  40. package/dist/components/lottery-grid.js +0 -6
  41. package/dist/components/lottery-grid2.js +0 -236
  42. package/dist/components/lottery-ticket.d.ts +0 -11
  43. package/dist/components/lottery-ticket.js +0 -266
  44. package/dist/esm/index-7790b5a7.js +0 -1246
  45. package/dist/esm/polyfills/core-js.js +0 -11
  46. package/dist/esm/polyfills/css-shim.js +0 -1
  47. package/dist/esm/polyfills/dom.js +0 -79
  48. package/dist/esm/polyfills/es5-html-element.js +0 -1
  49. package/dist/esm/polyfills/index.js +0 -34
  50. package/dist/esm/polyfills/system.js +0 -6
  51. package/dist/lottery-ticket/p-4e7976c5.entry.js +0 -1
  52. package/dist/lottery-ticket/p-913d0cce.js +0 -1
  53. package/dist/types/Users/dragos.bodea/Documents/everymatrix-prjs/stencil/widgets-stencil/packages/lottery-ticket/.stencil/packages/lottery-ticket/stencil.config.d.ts +0 -2
@@ -1,479 +1,441 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-7790b5a7.js';
1
+ import { r as registerInstance, c as createEvent, h } from './index-cde6554c.js';
2
2
 
3
- const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, white 0%, white 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, white 0%, #f1f1f1 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
3
+ const lotteryBulletCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}@-webkit-keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@keyframes Circle{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}@-webkit-keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.22) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@keyframes hover-rotate{0%{-webkit-transform:scale(1) rotateZ(0);transform:scale(1) rotateZ(0)}50%{-webkit-transform:scale(1.2) rotateZ(180deg);transform:scale(1.2) rotateZ(180deg)}100%{-webkit-transform:scale(1) rotateZ(360deg);transform:scale(1) rotateZ(360deg)}}@-webkit-keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1.2);transform:scale(1.2)}}@keyframes selected-scaleUp{0%{-webkit-transform:scale(0.5);transform:scale(0.5)}100%{-webkit-transform:scale(1);transform:scale(1)}}.Circle{-webkit-animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:Circle 0.8s cubic-bezier(0.39, 0.575, 0.565, 1) both;cursor:pointer;color:#000000;display:block;height:30px;width:30px;margin:0;display:flex;align-items:center;justify-content:center;justify-content:center;align-items:center;border:solid 2px #ffffff;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 100%);font-weight:bold;border-radius:50%;box-shadow:0 2px 4px 0 rgba(0, 0, 0, 0.5);user-select:none;font-size:16px;line-height:16px;font-weight:600;position:relative}.Circle:hover{-webkit-animation:hover-rotate 0.4s linear both;animation:hover-rotate 0.4s linear both;background:radial-gradient(circle at top, rgb(255, 255, 255) 0%, rgb(241, 241, 241) 100%)}.Circle.Selected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#ffffff;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #00958f}.Circle.Disabled{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#D4D4D4;border:solid 2px #D4D4D4;cursor:default}.Circle.DisabledSelected{-webkit-animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;animation:selected-scaleUp 0.4s cubic-bezier(0.39, 0.575, 0.565, 1) both;color:#f1f1f1;background:#9EC258;background:-webkit-radial-gradient(top, #00958f, #004D4A);background:-moz-radial-gradient(top, #00958f, #004D4A);background:radial-gradient(to bottom, #00958f, #004D4A);border:solid 2px #D4D4D4;cursor:default}";
4
+ const LotteryBulletStyle0 = lotteryBulletCss;
4
5
 
5
6
  const LotteryBullet = class {
6
- constructor(hostRef) {
7
- registerInstance(this, hostRef);
8
- this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
9
- /**
10
- * Value of the bullet
11
- */
12
- this.value = '0';
13
- /**
14
- * Marks if the bullet should be selectable
15
- */
16
- this.selectable = true;
17
- /**
18
- * Marks if the bullet should be selected
19
- */
20
- this.isSelected = false;
21
- /**
22
- * Client custom styling via string
23
- */
24
- this.clientStyling = '';
25
- /**
26
- * Client custom styling via url content
27
- */
28
- this.clientStylingUrlContent = '';
29
- this.limitStylingAppends = false;
30
- this.select = () => {
31
- if (this.selectable) {
32
- this.isSelected = !this.isSelected;
33
- this.bulletEvent.emit({
34
- value: this.value,
35
- selected: this.isSelected
36
- });
37
- }
38
- };
39
- this.setClientStyling = () => {
40
- let sheet = document.createElement('style');
41
- sheet.innerHTML = this.clientStyling;
42
- this.stylingContainer.prepend(sheet);
43
- };
44
- this.setClientStylingURL = () => {
45
- let cssFile = document.createElement('style');
46
- setTimeout(() => {
47
- cssFile.innerHTML = this.clientStylingUrlContent;
48
- this.stylingContainer.prepend(cssFile);
49
- }, 1);
50
- };
51
- }
52
- componentDidRender() {
53
- // start custom styling area
54
- if (!this.limitStylingAppends && this.stylingContainer) {
55
- if (this.clientStyling)
56
- this.setClientStyling();
57
- if (this.clientStylingUrlContent)
58
- this.setClientStylingURL();
59
- this.limitStylingAppends = true;
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ this.bulletEvent = createEvent(this, "lotteryBulletSelection", 7);
10
+ this.select = () => {
11
+ if (this.selectable) {
12
+ this.isSelected = !this.isSelected;
13
+ this.bulletEvent.emit({
14
+ value: this.value,
15
+ selected: this.isSelected
16
+ });
17
+ }
18
+ };
19
+ this.setClientStyling = () => {
20
+ let sheet = document.createElement('style');
21
+ sheet.innerHTML = this.clientStyling;
22
+ this.stylingContainer.prepend(sheet);
23
+ };
24
+ this.setClientStylingURL = () => {
25
+ let cssFile = document.createElement('style');
26
+ setTimeout(() => {
27
+ cssFile.innerHTML = this.clientStylingUrlContent;
28
+ this.stylingContainer.prepend(cssFile);
29
+ }, 1);
30
+ };
31
+ this.value = '0';
32
+ this.selectable = true;
33
+ this.isSelected = false;
34
+ this.clientStyling = '';
35
+ this.clientStylingUrlContent = '';
36
+ this.limitStylingAppends = false;
37
+ }
38
+ componentDidRender() {
39
+ // start custom styling area
40
+ if (!this.limitStylingAppends && this.stylingContainer) {
41
+ if (this.clientStyling)
42
+ this.setClientStyling();
43
+ if (this.clientStylingUrlContent)
44
+ this.setClientStylingURL();
45
+ this.limitStylingAppends = true;
46
+ }
47
+ // end custom styling area
48
+ }
49
+ render() {
50
+ return (h("div", { key: 'af3601684ecf1f39d65fc9461430cba96b9e4b8c', class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
60
51
  }
61
- // end custom styling area
62
- }
63
- render() {
64
- return (h("div", { class: 'Circle ' + (this.selectable ? '' : 'Disabled') + (this.isSelected ? 'Selected' : ''), onClick: () => this.select(), ref: el => this.stylingContainer = el }, this.value));
65
- }
66
52
  };
67
- LotteryBullet.style = lotteryBulletCss;
53
+ LotteryBullet.style = LotteryBulletStyle0;
68
54
 
69
55
  const lotteryGridCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.GridContainer{display:flex;flex-direction:column;max-width:1200px}.Grid{margin-top:10px 0 10px 0;display:flex;flex-direction:row;flex-wrap:wrap;gap:20px}.Grid.TicketGrid{gap:5px}";
56
+ const LotteryGridStyle0 = lotteryGridCss;
70
57
 
71
58
  const LotteryGrid = class {
72
- constructor(hostRef) {
73
- registerInstance(this, hostRef);
74
- this.gridFilledEvent = createEvent(this, "gridFilled", 7);
75
- this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
76
- /**
77
- * Number of bullets of grid
78
- */
79
- this.totalNumbers = 0;
80
- /**
81
- * Number of maximum bullets that can be selected
82
- */
83
- this.maximumAllowed = 0;
84
- /**
85
- * Minimum allowed of bullets
86
- */
87
- this.minimumAllowed = 1;
88
- /**
89
- * Allows the user to select numbers on the grid
90
- */
91
- this.selectable = true;
92
- /**
93
- * Numbers that should be showed as selected on the grid (as a string of those numbers e.g. '1,2,3,4,5,6')
94
- */
95
- this.selectedNumbers = '';
96
- /**
97
- * Show only selected numbers
98
- */
99
- this.displaySelected = false;
100
- /**
101
- * Language
102
- */
103
- this.language = 'en';
104
- /**
105
- * Personalize grid for ticket
106
- */
107
- this.gridType = '';
108
- /**
109
- * Client custom styling via string
110
- */
111
- this.clientStyling = '';
112
- /**
113
- * Client custom styling via url content
114
- */
115
- this.clientStylingUrlContent = '';
116
- this.numbers = [];
117
- this.limitStylingAppends = false;
118
- this.selectedCounter = 0;
119
- this.setClientStyling = () => {
120
- let sheet = document.createElement('style');
121
- sheet.innerHTML = this.clientStyling;
122
- this.stylingContainer.prepend(sheet);
123
- };
124
- this.setClientStylingURL = () => {
125
- let cssFile = document.createElement('style');
126
- setTimeout(() => {
127
- cssFile.innerHTML = this.clientStylingUrlContent;
128
- this.stylingContainer.prepend(cssFile);
129
- }, 1);
130
- };
131
- }
132
- connectedCallback() {
133
- let selected = [];
134
- if (this.selectedNumbers.length > 0) {
135
- selected = this.selectedNumbers.split(',');
136
- this.selectedCounter = selected.length;
59
+ constructor(hostRef) {
60
+ registerInstance(this, hostRef);
61
+ this.gridFilledEvent = createEvent(this, "gridFilled", 7);
62
+ this.gridDirtyEvent = createEvent(this, "gridDirty", 7);
63
+ this.selectedCounter = 0;
64
+ this.setClientStyling = () => {
65
+ let sheet = document.createElement('style');
66
+ sheet.innerHTML = this.clientStyling;
67
+ this.stylingContainer.prepend(sheet);
68
+ };
69
+ this.setClientStylingURL = () => {
70
+ let cssFile = document.createElement('style');
71
+ setTimeout(() => {
72
+ cssFile.innerHTML = this.clientStylingUrlContent;
73
+ this.stylingContainer.prepend(cssFile);
74
+ }, 1);
75
+ };
76
+ this.ticketId = undefined;
77
+ this.totalNumbers = 0;
78
+ this.gameId = undefined;
79
+ this.maximumAllowed = 0;
80
+ this.minimumAllowed = 1;
81
+ this.selectable = true;
82
+ this.selectedNumbers = '';
83
+ this.displaySelected = false;
84
+ this.language = 'en';
85
+ this.gridIndex = undefined;
86
+ this.gridType = '';
87
+ this.clientStyling = '';
88
+ this.clientStylingUrlContent = '';
89
+ this.numbers = [];
90
+ this.limitStylingAppends = false;
137
91
  }
138
- if (this.displaySelected) {
139
- selected.forEach((item) => {
140
- this.numbers.push({
141
- number: item,
142
- selected: true,
143
- selectable: this.selectable
144
- });
145
- });
92
+ connectedCallback() {
93
+ let selected = [];
94
+ if (this.selectedNumbers.length > 0) {
95
+ selected = this.selectedNumbers.split(',');
96
+ this.selectedCounter = selected.length;
97
+ }
98
+ if (this.displaySelected) {
99
+ selected.forEach((item) => {
100
+ this.numbers.push({
101
+ number: item,
102
+ selected: true,
103
+ selectable: this.selectable
104
+ });
105
+ });
106
+ }
107
+ else {
108
+ [...Array(this.totalNumbers).keys()]
109
+ .map(number => (number + 1).toString())
110
+ .forEach((number) => {
111
+ this.numbers.push({
112
+ number,
113
+ selected: selected.indexOf(number) >= 0 ? true : false,
114
+ selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
115
+ });
116
+ });
117
+ }
146
118
  }
147
- else {
148
- [...Array(this.totalNumbers).keys()]
149
- .map(number => (number + 1).toString())
150
- .forEach((number) => {
151
- this.numbers.push({
152
- number,
153
- selected: selected.indexOf(number) >= 0 ? true : false,
154
- selectable: this.selectedCounter == this.maximumAllowed ? false : this.selectable
155
- });
156
- });
119
+ componentDidRender() {
120
+ // start custom styling area
121
+ if (!this.limitStylingAppends && this.stylingContainer) {
122
+ if (this.clientStyling)
123
+ this.setClientStyling();
124
+ if (this.clientStylingUrlContent)
125
+ this.setClientStylingURL();
126
+ this.limitStylingAppends = true;
127
+ }
128
+ // end custom styling area
157
129
  }
158
- }
159
- componentDidRender() {
160
- // start custom styling area
161
- if (!this.limitStylingAppends && this.stylingContainer) {
162
- if (this.clientStyling)
163
- this.setClientStyling();
164
- if (this.clientStylingUrlContent)
165
- this.setClientStylingURL();
166
- this.limitStylingAppends = true;
130
+ // wrote this because the classic .sort(() => 0.5 - Math.random()) method yielded low entropy shuffles for some reason on certain devices
131
+ shuffleArray(array) {
132
+ const result = [];
133
+ while (array.length > 0) {
134
+ const randomIndex = Math.floor(Math.random() * (array.length));
135
+ result.push(array.splice(randomIndex, 1)[0]);
136
+ }
137
+ return result;
167
138
  }
168
- // end custom styling area
169
- }
170
- lotteryBulletSelectionHandler(event) {
171
- this.numbers = this.numbers.map((item) => {
172
- if (item.number == event.detail.value) {
173
- return {
174
- number: item.number,
175
- selected: event.detail.selected,
176
- selectable: item.selectable
177
- };
178
- }
179
- return {
180
- number: item.number,
181
- selected: item.selected,
182
- selectable: item.selectable
183
- };
184
- });
185
- if (event.detail.selected) {
186
- this.selectedCounter += 1;
187
- if (this.selectedCounter == this.maximumAllowed) {
139
+ lotteryBulletSelectionHandler(event) {
188
140
  this.numbers = this.numbers.map((item) => {
189
- return {
190
- number: item.number,
191
- selected: item.selected,
192
- selectable: item.selected ? true : false
193
- };
194
- });
195
- this.gridFilledEvent.emit({
196
- id: this.ticketId,
197
- index: this.gridIndex,
198
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
141
+ if (item.number == event.detail.value) {
142
+ return {
143
+ number: item.number,
144
+ selected: event.detail.selected,
145
+ selectable: item.selectable
146
+ };
147
+ }
148
+ return {
149
+ number: item.number,
150
+ selected: item.selected,
151
+ selectable: item.selectable
152
+ };
199
153
  });
200
- }
154
+ if (event.detail.selected) {
155
+ this.selectedCounter += 1;
156
+ if (this.selectedCounter == this.maximumAllowed) {
157
+ this.numbers = this.numbers.map((item) => {
158
+ return {
159
+ number: item.number,
160
+ selected: item.selected,
161
+ selectable: item.selected ? true : false
162
+ };
163
+ });
164
+ this.gridFilledEvent.emit({
165
+ id: this.ticketId,
166
+ index: this.gridIndex,
167
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
168
+ });
169
+ }
170
+ }
171
+ else {
172
+ if (this.selectedCounter == this.maximumAllowed) {
173
+ this.numbers = this.numbers.map((item) => {
174
+ return {
175
+ number: item.number,
176
+ selected: item.selected,
177
+ selectable: true
178
+ };
179
+ });
180
+ this.gridDirtyEvent.emit({
181
+ id: this.ticketId,
182
+ index: this.gridIndex,
183
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
184
+ });
185
+ }
186
+ this.selectedCounter -= 1;
187
+ }
201
188
  }
202
- else {
203
- if (this.selectedCounter == this.maximumAllowed) {
204
- this.numbers = this.numbers.map((item) => {
205
- return {
206
- number: item.number,
207
- selected: item.selected,
208
- selectable: true
209
- };
210
- });
211
- this.gridDirtyEvent.emit({
212
- id: this.ticketId,
213
- index: this.gridIndex,
214
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
215
- });
216
- }
217
- this.selectedCounter -= 1;
189
+ async resetSelectionHandler(event) {
190
+ if (event.detail && event.detail == this.ticketId) {
191
+ this.selectedCounter = 0;
192
+ this.numbers = this.numbers.map((item) => {
193
+ return {
194
+ number: item.number,
195
+ selected: false,
196
+ selectable: this.selectable
197
+ };
198
+ });
199
+ this.gridDirtyEvent.emit({
200
+ id: this.ticketId,
201
+ index: this.gridIndex,
202
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
203
+ });
204
+ }
218
205
  }
219
- }
220
- async resetSelectionHandler(event) {
221
- if (event.detail && event.detail == this.ticketId) {
222
- this.selectedCounter = 0;
223
- this.numbers = this.numbers.map((item) => {
224
- return {
225
- number: item.number,
226
- selected: false,
227
- selectable: this.selectable
228
- };
229
- });
230
- this.gridDirtyEvent.emit({
231
- id: this.ticketId,
232
- index: this.gridIndex,
233
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
234
- });
206
+ async autoSelectionHandler(event) {
207
+ if (event.detail && event.detail == this.ticketId) {
208
+ this.resetSelectionHandler(event);
209
+ let array = [...Array(this.totalNumbers).keys()]
210
+ .map(number => number + 1);
211
+ array = this.shuffleArray(array);
212
+ array = array.slice(0, this.minimumAllowed);
213
+ this.numbers = this.numbers.map((item) => {
214
+ return {
215
+ number: item.number,
216
+ selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
217
+ selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
218
+ };
219
+ });
220
+ this.gridFilledEvent.emit({
221
+ id: this.ticketId,
222
+ index: this.gridIndex,
223
+ selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
224
+ });
225
+ this.selectedCounter = this.maximumAllowed;
226
+ }
235
227
  }
236
- }
237
- async autoSelectionHandler(event) {
238
- if (event.detail && event.detail == this.ticketId) {
239
- this.resetSelectionHandler(event);
240
- let array = [...Array(this.totalNumbers).keys()]
241
- .map(number => number + 1)
242
- .sort(() => 0.5 - Math.random());
243
- array = array.slice(0, this.minimumAllowed);
244
- this.numbers = this.numbers.map((item) => {
245
- return {
246
- number: item.number,
247
- selected: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
248
- selectable: array.indexOf(parseInt(item.number, 10)) >= 0 ? true : false,
249
- };
250
- });
251
- this.gridFilledEvent.emit({
252
- id: this.ticketId,
253
- index: this.gridIndex,
254
- selectedNumbers: this.numbers.filter((item) => item.selected).map((item) => item.number)
255
- });
256
- this.selectedCounter = this.maximumAllowed;
228
+ render() {
229
+ return (h("div", { key: '54b9187146b5d2625fd5ce7f53f38abf091cd943', class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { key: 'e7e8570557ebaa78edf881cdbc1ed720028cdf6e', class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
257
230
  }
258
- }
259
- render() {
260
- return (h("div", { class: "GridContainer", ref: el => this.stylingContainer = el }, h("div", { class: this.gridType === 'ticket' ? 'Grid TicketGrid' : 'Grid' }, this.numbers.map((item) => h("div", null, h("lottery-bullet", { value: item.number, selectable: item.selectable, "is-selected": item.selected, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))))));
261
- }
262
231
  };
263
- LotteryGrid.style = lotteryGridCss;
232
+ LotteryGrid.style = LotteryGridStyle0;
264
233
 
265
234
  const DEFAULT_LANGUAGE = 'en';
266
- const SUPPORTED_LANGUAGES = ['ro', 'en'];
235
+ const SUPPORTED_LANGUAGES = ['ro', 'en', 'hr'];
267
236
  const TRANSLATIONS = {
268
- en: {
269
- loading: 'Loading, please wait ...',
270
- error: 'It was an error while trying to fetch the data',
271
- grid: 'Grid',
272
- multiplier: 'Multiplier',
273
- numberOfDraws: 'Number of draws',
274
- wagerPerDraw: 'Wager per draw',
275
- resetButton: 'Reset',
276
- autoButton: 'I feel lucky'
277
- },
278
- ro: {
279
- loading: 'Se incarca, va rugam asteptati ...',
280
- error: 'A fost o eroare in timp ce asteptam datele',
281
- grid: 'Grid',
282
- multiplier: 'Multiplicator',
283
- numberOfDraws: 'Numarul de extrageri',
284
- wagerPerDraw: 'Pariul per extragere',
285
- resetButton: 'Reseteaza',
286
- autoButton: 'Ma simt norocos'
287
- },
288
- fr: {
289
- loading: 'Loading, please wait ...',
290
- error: 'It was an error while trying to fetch the data',
291
- grid: 'Grid',
292
- multiplier: 'Multiplier',
293
- numberOfDraws: 'Number of draws',
294
- wagerPerDraw: 'Wager per draw',
295
- resetButton: 'Reset',
296
- autoButton: 'I feel lucky'
297
- },
298
- ar: {
299
- loading: 'Loading, please wait ...',
300
- error: 'It was an error while trying to fetch the data',
301
- grid: 'Grid',
302
- multiplier: 'Multiplier',
303
- numberOfDraws: 'Number of draws',
304
- wagerPerDraw: 'Wager per draw',
305
- resetButton: 'Reset',
306
- autoButton: 'I feel lucky'
307
- }
237
+ en: {
238
+ loading: 'Loading, please wait ...',
239
+ error: 'It was an error while trying to fetch the data',
240
+ grid: 'Grid',
241
+ multiplier: 'Multiplier',
242
+ numberOfDraws: 'Number of draws',
243
+ wagerPerDraw: 'Wager per draw',
244
+ resetButton: 'Reset',
245
+ autoButton: 'I feel lucky'
246
+ },
247
+ ro: {
248
+ loading: 'Se incarca, va rugam asteptati ...',
249
+ error: 'A fost o eroare in timp ce asteptam datele',
250
+ grid: 'Grid',
251
+ multiplier: 'Multiplicator',
252
+ numberOfDraws: 'Numarul de extrageri',
253
+ wagerPerDraw: 'Pariul per extragere',
254
+ resetButton: 'Reseteaza',
255
+ autoButton: 'Ma simt norocos'
256
+ },
257
+ fr: {
258
+ loading: 'Loading, please wait ...',
259
+ error: 'It was an error while trying to fetch the data',
260
+ grid: 'Grid',
261
+ multiplier: 'Multiplier',
262
+ numberOfDraws: 'Number of draws',
263
+ wagerPerDraw: 'Wager per draw',
264
+ resetButton: 'Reset',
265
+ autoButton: 'I feel lucky'
266
+ },
267
+ ar: {
268
+ loading: 'Loading, please wait ...',
269
+ error: 'It was an error while trying to fetch the data',
270
+ grid: 'Grid',
271
+ multiplier: 'Multiplier',
272
+ numberOfDraws: 'Number of draws',
273
+ wagerPerDraw: 'Wager per draw',
274
+ resetButton: 'Reset',
275
+ autoButton: 'I feel lucky'
276
+ },
277
+ hr: {
278
+ loading: 'Učitavanje, molimo pričekajte ...',
279
+ error: 'Došlo je do pogreške prilikom pokušaja dohvaćanja podataka',
280
+ grid: 'Tablica',
281
+ multiplier: 'Multiplikator',
282
+ numberOfDraws: 'Broj izvlačenja',
283
+ wagerPerDraw: 'Ulog po izvlačenju',
284
+ resetButton: 'Resetiraj',
285
+ autoButton: 'Osjećam se sretno'
286
+ }
308
287
  };
309
288
  const translate = (key, customLang) => {
310
- const lang = customLang;
311
- return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
289
+ const lang = customLang;
290
+ return TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
312
291
  };
313
292
 
314
293
  const lotteryTicketCss = "@import url(\"https://fonts.googleapis.com/css2?family=Roboto:wght@100&display=swap\");:host{display:block;font-family:\"Roboto\", sans-serif}.TicketTitle{font-size:16px;font-weight:bold}.ButtonContainer{display:flex;justify-content:flex-end}.Toggle{cursor:pointer;margin-top:20px;display:inline-block}.ToggleSwitch{display:inline-block;background:#707070;border-radius:16px;width:58px;height:24px;position:relative;vertical-align:middle;transition:background 0.25s}.ToggleSwitch:before,.ToggleSwitch:after{content:\"\"}.ToggleSwitch:before{display:block;background:linear-gradient(to bottom, #fff 0%, #F1F1F1 100%);border-radius:50%;box-shadow:0 0 0 1px rgba(0, 0, 0, 0.25);width:16px;height:16px;position:absolute;top:4px;left:4px;transition:left 0.25s}.Toggle:hover .ToggleSwitch:before{background:linear-gradient(to bottom, #fff 0%, #fff 100%);box-shadow:0 0 0 1px rgba(0, 0, 0, 0.5)}.ToggleCheckbox:checked+.ToggleSwitch{background:#00ABA4}.ToggleCheckbox:checked+.ToggleSwitch:before{left:38px}.ToggleCheckbox{position:absolute;visibility:hidden}.Label{margin-right:5px;position:relative;top:2px;font-size:14px;font-weight:lighter;color:#000}input[type=number]{-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield}input[type=number]::-webkit-inner-spin-button,input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.NumberInput,.WagerInput{margin-top:10px;display:inline-flex;align-items:center}.NumberInput,.NumberInput *{box-sizing:border-box}.NumberInput button{cursor:pointer;outline:none;-webkit-appearance:none;border:none;align-items:center;justify-content:center;height:20px;position:relative}.NumberInput button:after{display:inline-block;position:absolute;transform:translate(-50%, -50%) rotate(180deg);align-items:center;text-align:center}.NumberInput button.Plus:after{transform:translate(-50%, -50%) rotate(0deg);width:30px;display:inline-flex;align-items:center;text-align:center}.NumberInput input[type=number],.WagerInput input[type=number]{max-width:50px;display:inline-flex;align-items:center;padding:4px 10px;text-align:center}.NumberInput input[type=number] .WagerInputTitle,.WagerInput input[type=number] .WagerInputTitle{font-size:14px;color:#000;padding:10px}.InputDefault{background-color:#F1F1F1;border-radius:4px;padding:5px;border:solid 1px #D4D4D4;color:#707070}.AutoButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;border:1px solid #00958f;background:#FFF;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0}.AutoButton:active{background:#00958f;color:#FFF}.ResetButton{cursor:pointer;display:inline-block;border-radius:4px;padding:8px 20px;width:max-content;margin:5px 0;color:#000;font-size:12px;transition:all 0.2s linear;text-transform:uppercase;text-align:center;letter-spacing:0;background:#FF3D00;border:1px solid #FF3D00;color:#FFF}.ResetButton:hover{background:#FF6536;border:1px solid #FF3D00}.TicketGridBullets{background:#f1f1f1;border-radius:4px;padding:20px;margin-top:5px}.TicketGridBullets .TicketGridTitle{margin-top:0px}.Minus{border-radius:4px;width:30px;height:24px !important;margin-right:10px;color:#FFF;background:#009993}.Plus{border-radius:4px;width:30px;height:24px !important;margin-left:10px;color:#FFF;background:#009993}.SelectWrapper{width:auto;padding:5px;margin:0 auto;border:1px solid #ccc;border-radius:5px;position:relative}.SelectButton,.SelectOptions li{display:flex;align-items:center;cursor:pointer}.SelectButton{display:flex;padding:0 5px;border-radius:7px;align-items:center;justify-content:space-between;font-size:14px}.SelectButton span:first-child{padding-right:10px}.SelectExpand{transition:transform 0.3s linear;font-size:12px}.SelectActive .SelectExpand{transform:rotate(180deg)}.SelectContent{display:none;padding:5px;border-radius:7px}.SelectWrapper.SelectActive .SelectContent{width:100%;display:block;position:absolute;left:0;top:32px;padding:0;border:1px solid #ccc;overflow:hidden;background:#fff}.SelectContent .SelectOptions{max-height:100px;margin:0;overflow-y:auto;padding:0}.SelectContent .SelectOptions .SelectedValue{background-color:#009993;color:#fff}.SelectOptions::-webkit-scrollbar{width:7px}.SelectOptions::-webkit-scrollbar-track{background:#f1f1f1;border-radius:25px}.SelectOptions::-webkit-scrollbar-thumb{background:#ccc;border-radius:25px}.SelectOptions li{height:20px;padding:0 13px;font-size:14px}.SelectOptions li:hover{background:#f2f2f2}";
294
+ const LotteryTicketStyle0 = lotteryTicketCss;
315
295
 
316
296
  const LotteryTicket = class {
317
- constructor(hostRef) {
318
- registerInstance(this, hostRef);
319
- this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
320
- this.autoSelection = createEvent(this, "autoSelection", 7);
321
- this.resetSelection = createEvent(this, "resetSelection", 7);
322
- this.stakeChange = createEvent(this, "stakeChange", 7);
323
- this.multiplierChange = createEvent(this, "multiplierChange", 7);
324
- /**
325
- * Number of grids of a ticket
326
- */
327
- this.numberOfGrids = 1;
328
- /**
329
- * Option to have the ticket registered for multiple draws
330
- */
331
- this.multipleDraws = true;
332
- /**
333
- * Shows the reset button
334
- */
335
- this.resetButton = false;
336
- /**
337
- * Shows the auto-pick button
338
- */
339
- this.autoPick = false;
340
- /**
341
- * Language
342
- */
343
- this.language = 'en';
344
- /**
345
- * Client custom styling via string
346
- */
347
- this.clientStyling = '';
297
+ constructor(hostRef) {
298
+ registerInstance(this, hostRef);
299
+ this.ticketCompleted = createEvent(this, "ticketCompleted", 7);
300
+ this.autoSelection = createEvent(this, "autoSelection", 7);
301
+ this.resetSelection = createEvent(this, "resetSelection", 7);
302
+ this.stakeChange = createEvent(this, "stakeChange", 7);
303
+ this.multiplierChange = createEvent(this, "multiplierChange", 7);
304
+ this.setClientStyling = () => {
305
+ let sheet = document.createElement('style');
306
+ sheet.innerHTML = this.clientStyling;
307
+ this.stylingContainer.prepend(sheet);
308
+ };
309
+ this.setClientStylingURL = () => {
310
+ let cssFile = document.createElement('style');
311
+ setTimeout(() => {
312
+ cssFile.innerHTML = this.clientStylingUrlContent;
313
+ this.stylingContainer.prepend(cssFile);
314
+ }, 1);
315
+ };
316
+ this.endpoint = undefined;
317
+ this.gameId = undefined;
318
+ this.numberOfGrids = 1;
319
+ this.multipleDraws = true;
320
+ this.ticketId = undefined;
321
+ this.resetButton = false;
322
+ this.autoPick = false;
323
+ this.language = 'en';
324
+ this.clientStyling = '';
325
+ this.clientStylingUrlContent = '';
326
+ this.multiplier = false;
327
+ this.numberOfDraws = 1;
328
+ this.isLoading = true;
329
+ this.hasErrors = false;
330
+ this.ticketDone = false;
331
+ this.isCustomSelect = false;
332
+ this.amountInfo = {};
333
+ this.limitStylingAppends = false;
334
+ }
348
335
  /**
349
- * Client custom styling via url content
336
+ * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
350
337
  */
351
- this.clientStylingUrlContent = '';
352
- this.multiplier = false;
353
- this.numberOfDraws = 1;
354
- this.isLoading = true;
355
- this.hasErrors = false;
356
- this.ticketDone = false;
357
- this.isCustomSelect = false;
358
- this.amountInfo = {};
359
- this.limitStylingAppends = false;
360
- this.setClientStyling = () => {
361
- let sheet = document.createElement('style');
362
- sheet.innerHTML = this.clientStyling;
363
- this.stylingContainer.prepend(sheet);
364
- };
365
- this.setClientStylingURL = () => {
366
- let cssFile = document.createElement('style');
367
- setTimeout(() => {
368
- cssFile.innerHTML = this.clientStylingUrlContent;
369
- this.stylingContainer.prepend(cssFile);
370
- }, 1);
371
- };
372
- }
373
- /**
374
- * @TODO find a better way to implement click outside the custom select, so that we don't have to use the 'data-cluster' attribute on each element
375
- */
376
- checkForClickOutside(ev) {
377
- if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
378
- this.isCustomSelect = false;
338
+ checkForClickOutside(ev) {
339
+ if (ev.composedPath()[0].getAttribute('data-cluster') !== 'SelectComponent') {
340
+ this.isCustomSelect = false;
341
+ }
342
+ }
343
+ connectedCallback() {
344
+ let url = new URL(`${this.endpoint}/games/${this.gameId}`);
345
+ fetch(url.href)
346
+ .then((response) => {
347
+ if (response.ok) {
348
+ return response.json();
349
+ }
350
+ else {
351
+ // Throw error
352
+ this.hasErrors = true;
353
+ }
354
+ })
355
+ .then((data) => {
356
+ this.isLoading = false;
357
+ this.gameData = data;
358
+ this.grids = [...Array(this.gameData.type.boards.length).keys()];
359
+ this.amountInfo = this.gameData.type.stakes[0]; // initial value for select
360
+ })
361
+ .catch((err) => {
362
+ this.isLoading = false;
363
+ this.hasErrors = true;
364
+ console.error('Error!', err);
365
+ });
379
366
  }
380
- }
381
- connectedCallback() {
382
- let url = new URL(`${this.endpoint}/games/${this.gameId}`);
383
- fetch(url.href)
384
- .then((response) => {
385
- if (response.ok) {
386
- return response.json();
387
- }
388
- else {
389
- // Throw error
390
- this.hasErrors = true;
391
- }
392
- })
393
- .then((data) => {
394
- this.isLoading = false;
395
- this.gameData = data;
396
- this.grids = [...Array(data.rules.boards.length).keys()];
397
- this.amountInfo = this.gameData.rules.stakes[0]; // initial value for select
398
- })
399
- .catch((err) => {
400
- this.isLoading = false;
401
- this.hasErrors = true;
402
- console.error('Error!', err);
403
- });
404
- }
405
- componentDidRender() {
406
- // start custom styling area
407
- if (!this.limitStylingAppends && this.stylingContainer) {
408
- if (this.clientStyling)
409
- this.setClientStyling();
410
- if (this.clientStylingUrlContent)
411
- this.setClientStylingURL();
412
- this.limitStylingAppends = true;
367
+ componentDidRender() {
368
+ // start custom styling area
369
+ if (!this.limitStylingAppends && this.stylingContainer) {
370
+ if (this.clientStyling)
371
+ this.setClientStyling();
372
+ if (this.clientStylingUrlContent)
373
+ this.setClientStylingURL();
374
+ this.limitStylingAppends = true;
375
+ }
376
+ // end custom styling area
413
377
  }
414
- // end custom styling area
415
- }
416
- multiplierChangeHandler(e) {
417
- this.multiplier = e.target ? e.target.checked : false;
418
- this.multiplierChange.emit(this.multiplier);
419
- }
420
- drawsChangeHandler(event) {
421
- this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
422
- this.ticketCompleted.emit(this.ticket);
423
- }
424
- gridFilledHandler(event) {
425
- this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
426
- this.ticketDone = true;
427
- this.ticketCompleted.emit(this.ticket);
428
- }
429
- toggleAutoSelection() {
430
- this.ticketDone = true;
431
- this.autoSelection.emit(this.ticketId);
432
- }
433
- toggleResetSelection() {
434
- this.ticketDone = false;
435
- this.resetSelection.emit(this.ticketId);
436
- }
437
- changeStake(ticketid, amount) {
438
- this.stakeChange.emit({
439
- ticketId: ticketid,
440
- stake: amount
441
- });
442
- }
443
- toggleClass() {
444
- this.isCustomSelect = !this.isCustomSelect;
445
- }
446
- setDropdownItem(item) {
447
- this.amountInfo = {
448
- amount: item.amount,
449
- currency: item.currency
450
- };
451
- this.isCustomSelect = false;
452
- this.changeStake(this.ticketId, item.amount);
453
- }
454
- render() {
455
- if (this.isLoading) {
456
- return (h("div", null, h("p", null, translate('loading', this.language))));
378
+ multiplierChangeHandler(e) {
379
+ this.multiplier = e.target ? e.target.checked : false;
380
+ this.multiplierChange.emit(this.multiplier);
381
+ }
382
+ drawsChangeHandler(event) {
383
+ this.ticket = Object.assign(Object.assign({}, this.ticket), { draws: event });
384
+ this.ticketCompleted.emit(this.ticket);
385
+ }
386
+ gridFilledHandler(event) {
387
+ this.ticket = Object.assign(Object.assign({}, event.detail), { draws: this.numberOfDraws });
388
+ this.ticketDone = true;
389
+ this.ticketCompleted.emit(this.ticket);
390
+ }
391
+ toggleAutoSelection() {
392
+ this.ticketDone = true;
393
+ this.autoSelection.emit(this.ticketId);
394
+ }
395
+ toggleResetSelection() {
396
+ this.ticketDone = false;
397
+ this.resetSelection.emit(this.ticketId);
398
+ }
399
+ changeStake(ticketid, amount) {
400
+ this.stakeChange.emit({
401
+ ticketId: ticketid,
402
+ stake: amount
403
+ });
404
+ }
405
+ toggleClass() {
406
+ this.isCustomSelect = !this.isCustomSelect;
407
+ }
408
+ setDropdownItem(item) {
409
+ this.amountInfo = {
410
+ value: item.value,
411
+ currency: item.currency
412
+ };
413
+ this.isCustomSelect = false;
414
+ this.changeStake(this.ticketId, item.amount);
457
415
  }
458
- else {
459
- if (this.hasErrors) {
460
- return (h("div", null, h("p", null, translate('error', this.language))));
461
- }
462
- else {
463
- const { rules } = this.gameData;
464
- return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
465
- h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
466
- h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((item, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", item), h("lottery-grid", { "grid-index": index, "maximum-allowed": rules.boards[index].maximumAllowed, "minimum-allowed": rules.boards[index].minimumAllowed, "total-numbers": rules.boards[index].totalNumbers, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), rules.multiplier &&
467
- h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
468
- h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, rules.stakes.length > 1 ?
469
- (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.amount, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, rules.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.amount == item.amount ? 'SelectedValue' : '', value: item.amount, onClick: () => this.setDropdownItem(item) }, item.amount, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: rules.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, rules.stakes[0].currency)))))));
470
- }
416
+ render() {
417
+ if (this.isLoading) {
418
+ return (h("div", null, h("p", null, translate('loading', this.language))));
419
+ }
420
+ else {
421
+ if (this.hasErrors) {
422
+ return (h("div", null, h("p", null, translate('error', this.language))));
423
+ }
424
+ else {
425
+ const { type } = this.gameData;
426
+ return (h("div", { class: "TicketContainer", ref: el => this.stylingContainer = el }, h("p", { class: "TicketTitle" }, this.gameData.name), this.resetButton && this.ticketDone &&
427
+ h("div", { class: "ButtonContainer" }, h("a", { class: "ResetButton", onClick: () => this.toggleResetSelection() }, translate('resetButton', this.language))), this.autoPick && !this.ticketDone &&
428
+ h("div", { class: "ButtonContainer" }, h("a", { class: "AutoButton", onClick: () => this.toggleAutoSelection() }, translate('autoButton', this.language))), this.grids.map((_, index) => h("div", { class: "TicketGridBullets" }, h("p", { class: "TicketGridTitle" }, translate('grid', this.language), " ", index + 1), h("lottery-grid", { "grid-index": index, "maximum-allowed": type.boards[index].maximumAllowed, "minimum-allowed": type.boards[index].minimumAllowed, "total-numbers": type.boards[index].highNumber - type.boards[index].lowNumber + 1, selectable: true, "reset-button": true, "auto-pick": true, "game-id": this.gameId, "ticket-id": this.ticketId, language: this.language, "client-styling": this.clientStyling, "client-styling-url-content": this.clientStylingUrlContent }))), type.multiplier &&
429
+ h("div", null, h("label", { class: "Toggle" }, h("label", { class: "Label" }, translate('multiplier', this.language), ": "), h("input", { class: "ToggleCheckbox", type: "checkbox", onInput: (e) => this.multiplierChangeHandler(e) }), h("div", { class: "ToggleSwitch" }))), this.multipleDraws &&
430
+ h("div", { class: "TicketDraws" }, h("label", { class: "Label" }, translate('numberOfDraws', this.language), ": "), h("div", { class: "NumberInput" }, h("button", { onClick: () => this.numberOfDraws > 1 ? this.numberOfDraws-- : this.numberOfDraws = 1, class: "Minus" }, "-"), h("input", { class: "InputDefault", min: "1", value: this.numberOfDraws, type: "number" }), h("button", { onClick: () => this.numberOfDraws++, class: "Plus" }, "+"))), h("div", null, h("label", { class: "Label" }, translate('wagerPerDraw', this.language), ": "), h("div", { class: "WagerInput" }, type.stakes.length > 1 ?
431
+ (h("div", { "data-cluster": "SelectComponent", class: this.isCustomSelect ? "SelectWrapper SelectActive" : "SelectWrapper" }, h("div", { "data-cluster": "SelectComponent", class: "SelectButton", onClick: () => this.toggleClass() }, h("span", { "data-cluster": "SelectComponent" }, this.amountInfo.value, " ", this.amountInfo.currency), h("span", { "data-cluster": "SelectComponent", class: "SelectExpand" }, "\u25BC")), h("div", { "data-cluster": "SelectComponent", class: "SelectContent" }, h("ul", { "data-cluster": "SelectComponent", class: "SelectOptions" }, type.stakes.map((item) => h("li", { "data-cluster": "SelectComponent", class: this.amountInfo.value == item.value ? 'SelectedValue' : '', value: item.value, onClick: () => this.setDropdownItem(item) }, item.value, " ", item.currency)))))) : (h("div", null, h("input", { min: "1", value: type.stakes[0].amount, type: "number", disabled: true }), h("p", { class: "WagerInputTitle" }, type.stakes[0].currency)))))));
432
+ }
433
+ }
471
434
  }
472
- }
473
- static get watchers() { return {
474
- "numberOfDraws": ["drawsChangeHandler"]
475
- }; }
435
+ static get watchers() { return {
436
+ "numberOfDraws": ["drawsChangeHandler"]
437
+ }; }
476
438
  };
477
- LotteryTicket.style = lotteryTicketCss;
439
+ LotteryTicket.style = LotteryTicketStyle0;
478
440
 
479
441
  export { LotteryBullet as lottery_bullet, LotteryGrid as lottery_grid, LotteryTicket as lottery_ticket };