@everymatrix/lottery-button 0.0.5 → 0.0.6

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.
@@ -21,7 +21,7 @@ function _interopNamespace(e) {
21
21
  }
22
22
 
23
23
  const NAMESPACE = 'lottery-button';
24
- const BUILD = /* lottery-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
24
+ const BUILD = /* lottery-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
25
25
 
26
26
  /*
27
27
  Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -730,6 +730,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
730
730
  );
731
731
  }
732
732
  let maybePromise;
733
+ if (isInitialLoad) {
734
+ {
735
+ maybePromise = safeCall(instance, "componentWillLoad");
736
+ }
737
+ }
733
738
  endSchedule();
734
739
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
735
740
  };
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryButton = require('./lottery-button-18510b14.js');
6
- require('./index-236aaf98.js');
5
+ const lotteryButton = require('./lottery-button-0d33e95d.js');
6
+ require('./index-429abf5d.js');
7
7
 
8
8
 
9
9
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-236aaf98.js');
5
+ const index = require('./index-429abf5d.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  const defineCustomElements = async (win, options) => {
9
9
  if (typeof window === 'undefined') return undefined;
10
10
  await appGlobals.globalScripts();
11
- return index.bootstrapLazy([["lottery-button.cjs",[[1,"lottery-button",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"language":[513],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
11
+ return index.bootstrapLazy([["lottery-button.cjs",[[1,"lottery-button",{"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
12
12
  };
13
13
 
14
14
  exports.setNonce = index.setNonce;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const index = require('./index-236aaf98.js');
3
+ const index = require('./index-429abf5d.js');
4
4
 
5
5
  /**
6
6
  * @name setClientStyling
@@ -80,6 +80,28 @@ const translate = (key, customLang, replacements) => {
80
80
  }
81
81
  return translation;
82
82
  };
83
+ const getTranslations = (data) => {
84
+ Object.keys(data).forEach((item) => {
85
+ for (let key in data[item]) {
86
+ TRANSLATIONS[item][key] = data[item][key];
87
+ }
88
+ });
89
+ };
90
+ const resolveTranslationUrl = async (translationUrl) => {
91
+ if (translationUrl) {
92
+ try {
93
+ const response = await fetch(translationUrl);
94
+ if (!response.ok) {
95
+ throw new Error(`HTTP error! status: ${response.status}`);
96
+ }
97
+ const translations = await response.json();
98
+ getTranslations(translations);
99
+ }
100
+ catch (error) {
101
+ console.error('Failed to fetch or parse translations from URL:', error);
102
+ }
103
+ }
104
+ };
83
105
 
84
106
  const lotteryButtonCss = ":host{display:inline-block;font-family:\"PingFang SC\", \"Microsoft YaHei\", \"Helvetica Neue\", Helvetica, Arial, sans-serif}.btn{position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;font-weight:500;cursor:pointer;outline:none;overflow:hidden;transition:background-color 0.2s, border-color 0.2s, color 0.2s;user-select:none;-webkit-tap-highlight-color:transparent}.btn .content{position:relative}.btn:disabled{cursor:not-allowed;opacity:0.5}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:white;animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:#08104a}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:rgba(0, 0, 0, 0.2)}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:#dcdcdc;color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:#a6a6a6}.btn--outline:active:not(:disabled){background-color:#e6e6e6}.btn--dashed{background-color:transparent;border-style:dashed;border-color:#dcdcdc;color:#333}.btn--dashed:hover:not(:disabled){border-color:#a6a6a6;color:#0052d9}.btn--text{background-color:transparent;color:#0052d9;border-color:transparent}.btn--text:hover:not(:disabled){background-color:#f2f2f2}.btn--text:active:not(:disabled){background-color:#e6e6e6}.btn--small{height:28px;font-size:12px;padding:0 12px}.btn--medium{height:34px;font-size:14px;padding:0 18px}.btn--large{height:40px;font-size:16px;padding:0 24px}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:rgba(255, 255, 255, 0.3);transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:rgba(0, 0, 0, 0.1)}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
85
107
  const LotteryButtonStyle0 = lotteryButtonCss;
@@ -108,15 +130,16 @@ const LotteryButton = class {
108
130
  this.ripples = this.ripples.filter((r) => r !== newRipple);
109
131
  }, 600); // This duration should match the CSS animation duration
110
132
  };
111
- this.mbSource = undefined;
112
- this.clientStyling = undefined;
113
- this.clientStylingUrl = undefined;
114
133
  this.variant = 'primary';
115
134
  this.size = 'medium';
116
135
  this.disabled = false;
117
136
  this.loading = false;
118
137
  this.text = undefined;
138
+ this.mbSource = undefined;
119
139
  this.language = 'en';
140
+ this.clientStyling = undefined;
141
+ this.clientStylingUrl = undefined;
142
+ this.translationUrl = '';
120
143
  this.ripples = [];
121
144
  }
122
145
  handleClientStylingChange(newValue, oldValue) {
@@ -134,6 +157,9 @@ const LotteryButton = class {
134
157
  setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
135
158
  }
136
159
  }
160
+ disconnectedCallback() {
161
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
162
+ }
137
163
  componentDidLoad() {
138
164
  if (this.stylingContainer) {
139
165
  if (this.mbSource)
@@ -144,18 +170,20 @@ const LotteryButton = class {
144
170
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
145
171
  }
146
172
  }
147
- disconnectedCallback() {
148
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
173
+ componentWillLoad() {
174
+ if (this.translationUrl) {
175
+ resolveTranslationUrl(this.translationUrl);
176
+ }
149
177
  }
150
178
  render() {
151
179
  const { variant, disabled, size } = this;
152
180
  const isDisabled = disabled || this.loading;
153
- return (index.h("button", { key: '01f92ec117f679466c30ea86cdc8af7caf8f8e6d', class: {
181
+ return (index.h("button", { key: '19094b8ffd0d13c7e3cdc7139d559214803f0e73', class: {
154
182
  btn: true,
155
183
  [`btn--${variant}`]: true,
156
184
  [`btn--${size}`]: true,
157
185
  'btn--loading': this.loading
158
- }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, this.text)), index.h("div", { key: '918ddc7bbcd8aba1f2c194aa73f311b63016d2ec', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
186
+ }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (index.h("div", { class: "loading-container" }, index.h("span", { class: "content" }, this.text || translate('loading', this.language)), index.h("span", { class: "spinner" }))) : (index.h("span", { class: "content" }, this.text)), index.h("div", { key: 'e7e7542f0b79c5bf8e41969e23dd77d9fdec4462', class: "ripple-container" }, this.ripples.map((ripple, index$1) => (index.h("span", { key: index$1, class: "ripple", style: {
159
187
  top: `${ripple.top}px`,
160
188
  left: `${ripple.left}px`,
161
189
  width: `${ripple.size}px`,
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryButton = require('./lottery-button-18510b14.js');
6
- require('./index-236aaf98.js');
5
+ const lotteryButton = require('./lottery-button-0d33e95d.js');
6
+ require('./index-429abf5d.js');
7
7
 
8
8
 
9
9
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-236aaf98.js');
5
+ const index = require('./index-429abf5d.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
21
  await appGlobals.globalScripts();
22
- return index.bootstrapLazy([["lottery-button.cjs",[[1,"lottery-button",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"language":[513],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
22
+ return index.bootstrapLazy([["lottery-button.cjs",[[1,"lottery-button",{"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -1,6 +1,6 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
3
- import { translate } from "../../utils/locale.utils";
3
+ import { translate, resolveTranslationUrl } from "../../utils/locale.utils";
4
4
  export class LotteryButton {
5
5
  constructor() {
6
6
  this.handleClick = (event) => {
@@ -24,15 +24,16 @@ export class LotteryButton {
24
24
  this.ripples = this.ripples.filter((r) => r !== newRipple);
25
25
  }, 600); // This duration should match the CSS animation duration
26
26
  };
27
- this.mbSource = undefined;
28
- this.clientStyling = undefined;
29
- this.clientStylingUrl = undefined;
30
27
  this.variant = 'primary';
31
28
  this.size = 'medium';
32
29
  this.disabled = false;
33
30
  this.loading = false;
34
31
  this.text = undefined;
32
+ this.mbSource = undefined;
35
33
  this.language = 'en';
34
+ this.clientStyling = undefined;
35
+ this.clientStylingUrl = undefined;
36
+ this.translationUrl = '';
36
37
  this.ripples = [];
37
38
  }
38
39
  handleClientStylingChange(newValue, oldValue) {
@@ -50,6 +51,9 @@ export class LotteryButton {
50
51
  setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
51
52
  }
52
53
  }
54
+ disconnectedCallback() {
55
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
56
+ }
53
57
  componentDidLoad() {
54
58
  if (this.stylingContainer) {
55
59
  if (this.mbSource)
@@ -60,18 +64,20 @@ export class LotteryButton {
60
64
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
61
65
  }
62
66
  }
63
- disconnectedCallback() {
64
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
67
+ componentWillLoad() {
68
+ if (this.translationUrl) {
69
+ resolveTranslationUrl(this.translationUrl);
70
+ }
65
71
  }
66
72
  render() {
67
73
  const { variant, disabled, size } = this;
68
74
  const isDisabled = disabled || this.loading;
69
- return (h("button", { key: '01f92ec117f679466c30ea86cdc8af7caf8f8e6d', class: {
75
+ return (h("button", { key: '19094b8ffd0d13c7e3cdc7139d559214803f0e73', class: {
70
76
  btn: true,
71
77
  [`btn--${variant}`]: true,
72
78
  [`btn--${size}`]: true,
73
79
  'btn--loading': this.loading
74
- }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, this.text)), h("div", { key: '918ddc7bbcd8aba1f2c194aa73f311b63016d2ec', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
80
+ }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, this.text)), h("div", { key: 'e7e7542f0b79c5bf8e41969e23dd77d9fdec4462', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
75
81
  top: `${ripple.top}px`,
76
82
  left: `${ripple.left}px`,
77
83
  width: `${ripple.size}px`,
@@ -92,57 +98,6 @@ export class LotteryButton {
92
98
  }
93
99
  static get properties() {
94
100
  return {
95
- "mbSource": {
96
- "type": "string",
97
- "mutable": false,
98
- "complexType": {
99
- "original": "string",
100
- "resolved": "string",
101
- "references": {}
102
- },
103
- "required": false,
104
- "optional": false,
105
- "docs": {
106
- "tags": [],
107
- "text": ""
108
- },
109
- "attribute": "mb-source",
110
- "reflect": true
111
- },
112
- "clientStyling": {
113
- "type": "string",
114
- "mutable": false,
115
- "complexType": {
116
- "original": "string",
117
- "resolved": "string",
118
- "references": {}
119
- },
120
- "required": false,
121
- "optional": false,
122
- "docs": {
123
- "tags": [],
124
- "text": ""
125
- },
126
- "attribute": "client-styling",
127
- "reflect": true
128
- },
129
- "clientStylingUrl": {
130
- "type": "string",
131
- "mutable": false,
132
- "complexType": {
133
- "original": "string",
134
- "resolved": "string",
135
- "references": {}
136
- },
137
- "required": false,
138
- "optional": false,
139
- "docs": {
140
- "tags": [],
141
- "text": ""
142
- },
143
- "attribute": "client-styling-url",
144
- "reflect": true
145
- },
146
101
  "variant": {
147
102
  "type": "string",
148
103
  "mutable": false,
@@ -244,6 +199,23 @@ export class LotteryButton {
244
199
  "attribute": "text",
245
200
  "reflect": true
246
201
  },
202
+ "mbSource": {
203
+ "type": "string",
204
+ "mutable": false,
205
+ "complexType": {
206
+ "original": "string",
207
+ "resolved": "string",
208
+ "references": {}
209
+ },
210
+ "required": false,
211
+ "optional": false,
212
+ "docs": {
213
+ "tags": [],
214
+ "text": ""
215
+ },
216
+ "attribute": "mb-source",
217
+ "reflect": true
218
+ },
247
219
  "language": {
248
220
  "type": "string",
249
221
  "mutable": false,
@@ -261,6 +233,58 @@ export class LotteryButton {
261
233
  "attribute": "language",
262
234
  "reflect": true,
263
235
  "defaultValue": "'en'"
236
+ },
237
+ "clientStyling": {
238
+ "type": "string",
239
+ "mutable": false,
240
+ "complexType": {
241
+ "original": "string",
242
+ "resolved": "string",
243
+ "references": {}
244
+ },
245
+ "required": false,
246
+ "optional": false,
247
+ "docs": {
248
+ "tags": [],
249
+ "text": ""
250
+ },
251
+ "attribute": "client-styling",
252
+ "reflect": true
253
+ },
254
+ "clientStylingUrl": {
255
+ "type": "string",
256
+ "mutable": false,
257
+ "complexType": {
258
+ "original": "string",
259
+ "resolved": "string",
260
+ "references": {}
261
+ },
262
+ "required": false,
263
+ "optional": false,
264
+ "docs": {
265
+ "tags": [],
266
+ "text": ""
267
+ },
268
+ "attribute": "client-styling-url",
269
+ "reflect": true
270
+ },
271
+ "translationUrl": {
272
+ "type": "string",
273
+ "mutable": false,
274
+ "complexType": {
275
+ "original": "string",
276
+ "resolved": "string",
277
+ "references": {}
278
+ },
279
+ "required": false,
280
+ "optional": false,
281
+ "docs": {
282
+ "tags": [],
283
+ "text": ""
284
+ },
285
+ "attribute": "translation-url",
286
+ "reflect": true,
287
+ "defaultValue": "''"
264
288
  }
265
289
  };
266
290
  }
@@ -26,3 +26,18 @@ export const getTranslations = (data) => {
26
26
  }
27
27
  });
28
28
  };
29
+ export const resolveTranslationUrl = async (translationUrl) => {
30
+ if (translationUrl) {
31
+ try {
32
+ const response = await fetch(translationUrl);
33
+ if (!response.ok) {
34
+ throw new Error(`HTTP error! status: ${response.status}`);
35
+ }
36
+ const translations = await response.json();
37
+ getTranslations(translations);
38
+ }
39
+ catch (error) {
40
+ console.error('Failed to fetch or parse translations from URL:', error);
41
+ }
42
+ }
43
+ };
@@ -1,5 +1,5 @@
1
1
  const NAMESPACE = 'lottery-button';
2
- const BUILD = /* lottery-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: false, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
2
+ const BUILD = /* lottery-button */ { allRenderFn: true, appendChildSlotFix: false, asyncLoading: true, asyncQueue: false, attachStyles: true, cloneNodeFix: false, cmpDidLoad: true, cmpDidRender: false, cmpDidUnload: false, cmpDidUpdate: false, cmpShouldUpdate: false, cmpWillLoad: true, cmpWillRender: false, cmpWillUpdate: false, connectedCallback: false, constructableCSS: true, cssAnnotations: true, devTools: false, disconnectedCallback: true, element: false, event: false, experimentalScopedSlotChanges: false, experimentalSlotFixes: false, formAssociated: false, hasRenderFn: true, hostListener: false, hostListenerTarget: false, hostListenerTargetBody: false, hostListenerTargetDocument: false, hostListenerTargetParent: false, hostListenerTargetWindow: false, hotModuleReplacement: false, hydrateClientSide: false, hydrateServerSide: false, hydratedAttribute: false, hydratedClass: true, hydratedSelectorName: "hydrated", initializeNextTick: false, invisiblePrehydration: true, isDebug: false, isDev: false, isTesting: false, lazyLoad: true, lifecycle: true, lifecycleDOMEvents: false, member: true, method: false, mode: false, observeAttribute: true, profile: false, prop: true, propBoolean: true, propMutable: false, propNumber: false, propString: true, reflect: true, scoped: false, scopedSlotTextContentFix: false, scriptDataOpts: false, shadowDelegatesFocus: false, shadowDom: true, slot: false, slotChildNodesFix: false, slotRelocation: false, state: true, style: true, svg: false, taskQueue: true, transformTagName: false, updatable: true, vdomAttribute: true, vdomClass: true, vdomFunctional: false, vdomKey: true, vdomListener: true, vdomPropOrAttr: true, vdomRef: false, vdomRender: true, vdomStyle: true, vdomText: true, vdomXlink: false, watchCallback: true };
3
3
 
4
4
  /*
5
5
  Stencil Client Platform v4.19.2 | MIT Licensed | https://stenciljs.com
@@ -708,6 +708,11 @@ var dispatchHooks = (hostRef, isInitialLoad) => {
708
708
  );
709
709
  }
710
710
  let maybePromise;
711
+ if (isInitialLoad) {
712
+ {
713
+ maybePromise = safeCall(instance, "componentWillLoad");
714
+ }
715
+ }
711
716
  endSchedule();
712
717
  return enqueue(maybePromise, () => updateComponent(hostRef, instance, isInitialLoad));
713
718
  };
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryButton } from './lottery-button-f20aa4a1.js';
2
- import './index-b461bf7a.js';
1
+ export { L as LotteryButton } from './lottery-button-25ec2557.js';
2
+ import './index-020f75bf.js';
@@ -1,11 +1,11 @@
1
- import { b as bootstrapLazy } from './index-b461bf7a.js';
2
- export { s as setNonce } from './index-b461bf7a.js';
1
+ import { b as bootstrapLazy } from './index-020f75bf.js';
2
+ export { s as setNonce } from './index-020f75bf.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["lottery-button",[[1,"lottery-button",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"language":[513],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
8
+ return bootstrapLazy([["lottery-button",[[1,"lottery-button",{"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };
@@ -1,4 +1,4 @@
1
- import { r as registerInstance, h, g as getElement } from './index-b461bf7a.js';
1
+ import { r as registerInstance, h, g as getElement } from './index-020f75bf.js';
2
2
 
3
3
  /**
4
4
  * @name setClientStyling
@@ -78,6 +78,28 @@ const translate = (key, customLang, replacements) => {
78
78
  }
79
79
  return translation;
80
80
  };
81
+ const getTranslations = (data) => {
82
+ Object.keys(data).forEach((item) => {
83
+ for (let key in data[item]) {
84
+ TRANSLATIONS[item][key] = data[item][key];
85
+ }
86
+ });
87
+ };
88
+ const resolveTranslationUrl = async (translationUrl) => {
89
+ if (translationUrl) {
90
+ try {
91
+ const response = await fetch(translationUrl);
92
+ if (!response.ok) {
93
+ throw new Error(`HTTP error! status: ${response.status}`);
94
+ }
95
+ const translations = await response.json();
96
+ getTranslations(translations);
97
+ }
98
+ catch (error) {
99
+ console.error('Failed to fetch or parse translations from URL:', error);
100
+ }
101
+ }
102
+ };
81
103
 
82
104
  const lotteryButtonCss = ":host{display:inline-block;font-family:\"PingFang SC\", \"Microsoft YaHei\", \"Helvetica Neue\", Helvetica, Arial, sans-serif}.btn{position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;font-weight:500;cursor:pointer;outline:none;overflow:hidden;transition:background-color 0.2s, border-color 0.2s, color 0.2s;user-select:none;-webkit-tap-highlight-color:transparent}.btn .content{position:relative}.btn:disabled{cursor:not-allowed;opacity:0.5}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:white;animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:#08104a}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:rgba(0, 0, 0, 0.2)}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:#dcdcdc;color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:#a6a6a6}.btn--outline:active:not(:disabled){background-color:#e6e6e6}.btn--dashed{background-color:transparent;border-style:dashed;border-color:#dcdcdc;color:#333}.btn--dashed:hover:not(:disabled){border-color:#a6a6a6;color:#0052d9}.btn--text{background-color:transparent;color:#0052d9;border-color:transparent}.btn--text:hover:not(:disabled){background-color:#f2f2f2}.btn--text:active:not(:disabled){background-color:#e6e6e6}.btn--small{height:28px;font-size:12px;padding:0 12px}.btn--medium{height:34px;font-size:14px;padding:0 18px}.btn--large{height:40px;font-size:16px;padding:0 24px}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:rgba(255, 255, 255, 0.3);transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:rgba(0, 0, 0, 0.1)}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}";
83
105
  const LotteryButtonStyle0 = lotteryButtonCss;
@@ -106,15 +128,16 @@ const LotteryButton = class {
106
128
  this.ripples = this.ripples.filter((r) => r !== newRipple);
107
129
  }, 600); // This duration should match the CSS animation duration
108
130
  };
109
- this.mbSource = undefined;
110
- this.clientStyling = undefined;
111
- this.clientStylingUrl = undefined;
112
131
  this.variant = 'primary';
113
132
  this.size = 'medium';
114
133
  this.disabled = false;
115
134
  this.loading = false;
116
135
  this.text = undefined;
136
+ this.mbSource = undefined;
117
137
  this.language = 'en';
138
+ this.clientStyling = undefined;
139
+ this.clientStylingUrl = undefined;
140
+ this.translationUrl = '';
118
141
  this.ripples = [];
119
142
  }
120
143
  handleClientStylingChange(newValue, oldValue) {
@@ -132,6 +155,9 @@ const LotteryButton = class {
132
155
  setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
133
156
  }
134
157
  }
158
+ disconnectedCallback() {
159
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
160
+ }
135
161
  componentDidLoad() {
136
162
  if (this.stylingContainer) {
137
163
  if (this.mbSource)
@@ -142,18 +168,20 @@ const LotteryButton = class {
142
168
  setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
143
169
  }
144
170
  }
145
- disconnectedCallback() {
146
- this.stylingSubscription && this.stylingSubscription.unsubscribe();
171
+ componentWillLoad() {
172
+ if (this.translationUrl) {
173
+ resolveTranslationUrl(this.translationUrl);
174
+ }
147
175
  }
148
176
  render() {
149
177
  const { variant, disabled, size } = this;
150
178
  const isDisabled = disabled || this.loading;
151
- return (h("button", { key: '01f92ec117f679466c30ea86cdc8af7caf8f8e6d', class: {
179
+ return (h("button", { key: '19094b8ffd0d13c7e3cdc7139d559214803f0e73', class: {
152
180
  btn: true,
153
181
  [`btn--${variant}`]: true,
154
182
  [`btn--${size}`]: true,
155
183
  'btn--loading': this.loading
156
- }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, this.text)), h("div", { key: '918ddc7bbcd8aba1f2c194aa73f311b63016d2ec', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
184
+ }, disabled: isDisabled, onClick: this.handleClick }, this.loading ? (h("div", { class: "loading-container" }, h("span", { class: "content" }, this.text || translate('loading', this.language)), h("span", { class: "spinner" }))) : (h("span", { class: "content" }, this.text)), h("div", { key: 'e7e7542f0b79c5bf8e41969e23dd77d9fdec4462', class: "ripple-container" }, this.ripples.map((ripple, index) => (h("span", { key: index, class: "ripple", style: {
157
185
  top: `${ripple.top}px`,
158
186
  left: `${ripple.left}px`,
159
187
  width: `${ripple.size}px`,
@@ -1,2 +1,2 @@
1
- export { L as lottery_button } from './lottery-button-f20aa4a1.js';
2
- import './index-b461bf7a.js';
1
+ export { L as lottery_button } from './lottery-button-25ec2557.js';
2
+ import './index-020f75bf.js';
@@ -1,5 +1,5 @@
1
- import { p as promiseResolve, b as bootstrapLazy } from './index-b461bf7a.js';
2
- export { s as setNonce } from './index-b461bf7a.js';
1
+ import { p as promiseResolve, b as bootstrapLazy } from './index-020f75bf.js';
2
+ export { s as setNonce } from './index-020f75bf.js';
3
3
  import { g as globalScripts } from './app-globals-0f993ce5.js';
4
4
 
5
5
  /*
@@ -16,5 +16,5 @@ var patchBrowser = () => {
16
16
 
17
17
  patchBrowser().then(async (options) => {
18
18
  await globalScripts();
19
- return bootstrapLazy([["lottery-button",[[1,"lottery-button",{"mbSource":[513,"mb-source"],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"language":[513],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
19
+ return bootstrapLazy([["lottery-button",[[1,"lottery-button",{"variant":[513],"size":[513],"disabled":[516],"loading":[516],"text":[513],"mbSource":[513,"mb-source"],"language":[513],"clientStyling":[513,"client-styling"],"clientStylingUrl":[513,"client-styling-url"],"translationUrl":[513,"translation-url"],"ripples":[32]},null,{"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"mbSource":["handleMbSourceChange"]}]]]], options);
20
20
  });
@@ -0,0 +1,2 @@
1
+ var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>t in e,s=(e,t)=>(0,console.error)(e,t),r=new Map,i=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={l:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},h=e=>Promise.resolve(e),d=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),p=!1,m=[],y=[],$=(e,t)=>n=>{e.push(n),p||(p=!0,t&&4&f.l?v(b):f.raf(b))},w=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){s(e)}e.length=0},b=()=>{w(m),w(y),(p=m.length>0)&&f.raf(b)},v=e=>h().then(e),g=$(y,!0),S={},j=e=>"object"==(e=typeof e)||"function"===e;function k(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>E,map:()=>C,ok:()=>O,unwrap:()=>P,unwrapErr:()=>L});var O=e=>({isOk:!0,isErr:!1,value:e}),E=e=>({isOk:!1,isErr:!0,value:e});function C(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>O(e))):O(n)}if(e.isErr)return E(e.value);throw"should never get here"}var M,x,P=e=>{if(e.isOk)return e.value;throw e.value},L=e=>{if(e.isErr)return e.value;throw e.value},R=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!j(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?T(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=T(e,null);return u.u=t,i.length>0&&(u.h=i),u.p=o,u},T=(e,t)=>({l:0,m:e,i:t,$:null,h:null,u:null,p:null}),A={},N=e=>n(e).$hostElement$,U=new WeakMap,W=e=>"sc-"+e.v,D=(e,t,n,l,s,r)=>{if(n!==l){let i=o(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=H(n),s=H(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if(i||"o"!==t[0]||"n"!==t[1]){const o=j(l);if((i||o&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||s)&&!o&&e.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):o(u,c)?c.slice(2):c[2]+t.slice(3),n||l){const o=t.endsWith(q);t=t.replace(G,""),n&&f.rel(e,t,n,o),l&&f.ael(e,t,l,o)}}},F=/\s/,H=e=>e?e.split(F):[],q="Capture",G=RegExp(q+"$"),V=(e,t,n)=>{const l=11===t.$.nodeType&&t.$.host?t.$.host:t.$,o=e&&e.u||S,s=t.u||S;for(const e of _(Object.keys(o)))e in s||D(l,e,o[e],void 0,n,t.l);for(const e of _(Object.keys(s)))D(l,e,o[e],s[e],n,t.l)};function _(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var z=!1,B=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.$=a.createTextNode(l.i);else if(o=l.$=a.createElement(l.m),V(null,l,z),null!=M&&o["s-si"]!==M&&o.classList.add(o["s-si"]=M),l.h)for(r=0;r<l.h.length;++r)s=B(e,l,r),s&&o.appendChild(s);return o["s-hn"]=x,o},I=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=B(null,n,o),r&&(l[o].$=r,X(i,r,t)))},J=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.$;e&&e.remove()}}},K=(e,t,n=!1)=>e.m===t.m&&(!!n||e.p===t.p),Q=(e,t,n=!1)=>{const l=t.$=e.$,o=e.h,s=t.h,r=t.i;null===r?(V(e,t,z),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],d=t[f],p=l.length-1,m=l[0],y=l[p];for(;i<=f&&c<=p;)if(null==h)h=t[++i];else if(null==d)d=t[--f];else if(null==m)m=l[++c];else if(null==y)y=l[--p];else if(K(h,m,o))Q(h,m,o),h=t[++i],m=l[++c];else if(K(d,y,o))Q(d,y,o),d=t[--f],y=l[--p];else if(K(h,y,o))Q(h,y,o),X(e,h.$,d.$.nextSibling),h=t[++i],y=l[--p];else if(K(d,m,o))Q(d,m,o),X(e,d.$,h.$),d=t[--f],m=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].p&&t[a].p===m.p){u=a;break}u>=0?(r=t[u],r.m!==m.m?s=B(t&&t[c],n,u):(Q(r,m,o),t[u]=void 0,s=r.$),m=l[++c]):(s=B(t&&t[c],n,c),m=l[++c]),s&&X(h.$.parentNode,s,h.$)}i>f?I(e,null==l[p+1]?null:l[p+1].$,n,l,c,p):c>p&&J(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),I(l,null,t,s,0,s.length-1)):null!==o&&J(o,0,o.length-1)):e.i!==r&&(l.data=r)},X=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),Y=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},Z=(e,t)=>{if(e.l|=16,!(4&e.l))return Y(e,e.j),g((()=>ee(e,t)));e.l|=512},ee=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let l;return t&&(l=ie(n,"componentWillLoad")),te(l,(()=>le(e,n,t)))},te=(e,t)=>ne(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),ne=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,le=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.k,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=W(t),o=i.get(l);if(e=11===e.nodeType?e:a,o)if("string"==typeof o){let s,r=U.get(e=e.head||e);if(r||U.set(e,r=new Set),!r.has(l)){{s=a.createElement("style"),s.innerHTML=o;const t=null!=(n=f.O)?n:k(a);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=c),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);oe(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>se(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},oe=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.k,s=e.C||T(null,null),r=(e=>e&&e.m===A)(t)?t:R(null,null,t);if(x=l.tagName,o.M&&(r.u=r.u||{},o.M.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.m=null,r.l|=4,e.C=r,r.$=s.$=l.shadowRoot||l,M=l["s-sc"],Q(s,r,n)})(e,t,l)}catch(t){s(t,e.$hostElement$)}return null},se=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,ce(t),ie(n,"componentDidLoad"),e.P(t),l||re()),e.S&&(e.S(),e.S=void 0),512&e.l&&v((()=>Z(e,!1))),e.l&=-517},re=()=>{ce(a.documentElement),v((()=>(e=>{const t=f.ce("appload",{detail:{namespace:"lottery-button"}});return e.dispatchEvent(t),t})(u)))},ie=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){s(e)}},ce=e=>e.classList.add("hydrated"),ue=(e,t,l)=>{var o,r;const i=e.prototype;if(t.L||t.R||e.watchers){e.watchers&&!t.R&&(t.R=e.watchers);const c=Object.entries(null!=(o=t.L)?o:{});if(c.map((([e,[o]])=>{(31&o||2&l&&32&o)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).T.get(t))(0,e)},set(l){((e,t,l,o)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${o.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.T.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||j(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(l,o.L[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.T.set(t,l),a)){if(o.R&&128&u){const e=o.R[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){s(e,i)}}))}2==(18&u)&&Z(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){f.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.R)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.R)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.M)||o.push([e,s])),s}))]))}}return e},ae=e=>{ie(e,"disconnectedCallback")},fe=(e,l={})=>{var o;const h=[],p=l.exclude||[],m=u.customElements,y=a.head,$=y.querySelector("meta[charset]"),w=a.createElement("style"),b=[];let v,g=!0;Object.assign(f,l),f.o=new URL(l.resourcesUrl||"./",a.baseURI).href;let S=!1;if(e.map((e=>{e[1].map((l=>{var o;const c={l:l[0],v:l[1],L:l[2],A:l[3]};4&c.l&&(S=!0),c.L=l[2],c.M=[],c.R=null!=(o=l[4])?o:{};const u=c.v,a=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,k:n,T:new Map};l.N=new Promise((e=>l.P=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),v&&(clearTimeout(v),v=null),g?b.push(this):f.jmp((()=>(e=>{if(!(1&f.l)){const t=n(e),l=t.k,o=()=>{};if(1&t.l)(null==t?void 0:t.t)||(null==t?void 0:t.N)&&t.N.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){Y(t,t.j=n);break}}l.L&&Object.entries(l.L).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.U){const e=(e=>{const t=e.v.replace(/-/g,"_"),n=e.U;if(!n)return;const l=r.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(r.set(n,e),e[t])),s)
2
+ /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.v}#${t.W}" was not found`);l.isProxied||(n.R=l.watchers,ue(l,n,2),l.isProxied=!0);const o=()=>{};t.l|=8;try{new l(t)}catch(e){s(e)}t.l&=-9,t.l|=128,o()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=W(n);if(!i.has(t)){const l=()=>{};((e,t,n)=>{let l=i.get(e);d&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,i.set(e,l)})(t,e,!!(1&n.l)),l()}}}const o=t.j,c=()=>Z(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(e,t,l)}o()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.l)){const e=n(this);(null==e?void 0:e.t)?ae(e.t):(null==e?void 0:e.N)&&e.N.then((()=>ae(e.t)))}})()))}componentOnReady(){return n(this).N}};c.U=e[0],p.includes(u)||m.get(u)||(h.push(u),m.define(u,ue(a,c,1)))}))})),h.length>0&&(S&&(w.textContent+=c),w.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",w.innerHTML.length)){w.setAttribute("data-styles","");const e=null!=(o=f.O)?o:k(a);null!=e&&w.setAttribute("nonce",e),y.insertBefore(w,$?$.nextSibling:y.firstChild)}g=!1,b.length?b.map((e=>e.connectedCallback())):f.jmp((()=>v=setTimeout(re,30)))},he=e=>f.O=e;export{fe as b,N as g,R as h,h as p,l as r,he as s}
@@ -1 +1 @@
1
- export{L as LotteryButton}from"./lottery-button-f20aa4a1.js";import"./index-b461bf7a.js";
1
+ export{L as LotteryButton}from"./lottery-button-25ec2557.js";import"./index-020f75bf.js";
@@ -0,0 +1 @@
1
+ import{r as t,h as e,g as n}from"./index-020f75bf.js";function o(t,e){if(t){const n=document.createElement("style");n.innerHTML=e,t.appendChild(n)}}function i(t,e){const n=new URL(e);fetch(n.href).then((t=>t.text())).then((e=>{const n=document.createElement("style");n.innerHTML=e,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function r(t,e){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(e,(e=>{n.innerHTML=e,t&&t.appendChild(n)}))}}const a=["ro","en","fr","ar","hr","zh"],s={en:{loading:"Loading"},ro:{},fr:{},ar:{},hr:{}},l=class{constructor(e){t(this,e),this.handleClick=t=>{if(this.disabled)return;const e=this.host.shadowRoot.querySelector(".btn");if(!e)return;const n=e.getBoundingClientRect(),o=Math.max(n.width,n.height),i={top:t.clientY-n.top-o/2,left:t.clientX-n.left-o/2,size:o};this.ripples=[...this.ripples,i],setTimeout((()=>{this.ripples=this.ripples.filter((t=>t!==i))}),600)},this.variant="primary",this.size="medium",this.disabled=!1,this.loading=!1,this.text=void 0,this.mbSource=void 0,this.language="en",this.clientStyling=void 0,this.clientStylingUrl=void 0,this.translationUrl="",this.ripples=[]}handleClientStylingChange(t,e){t!=e&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&i(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&r(this.stylingContainer,`${this.mbSource}.Style`)}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}componentDidLoad(){this.stylingContainer&&(this.mbSource&&r(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&i(this.stylingContainer,this.clientStylingUrl))}componentWillLoad(){this.translationUrl&&(async t=>{if(t)try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP error! status: ${n.status}`);const o=await n.json();e=o,Object.keys(e).forEach((t=>{for(let n in e[t])s[t][n]=e[t][n]}))}catch(t){console.error("Failed to fetch or parse translations from URL:",t)}var e})(this.translationUrl)}render(){const{variant:t,disabled:n,size:o}=this,i=n||this.loading;return e("button",{key:"19094b8ffd0d13c7e3cdc7139d559214803f0e73",class:{btn:!0,[`btn--${t}`]:!0,[`btn--${o}`]:!0,"btn--loading":this.loading},disabled:i,onClick:this.handleClick},this.loading?e("div",{class:"loading-container"},e("span",{class:"content"},this.text||(()=>{const t=this.language;let e=s[void 0!==t&&a.includes(t)?t:"en"].loading;return e})()),e("span",{class:"spinner"})):e("span",{class:"content"},this.text),e("div",{key:"e7e7542f0b79c5bf8e41969e23dd77d9fdec4462",class:"ripple-container"},this.ripples.map(((t,n)=>e("span",{key:n,class:"ripple",style:{top:`${t.top}px`,left:`${t.left}px`,width:`${t.size}px`,height:`${t.size}px`}})))))}get host(){return n(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};l.style=':host{display:inline-block;font-family:"PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif}.btn{position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;font-weight:500;cursor:pointer;outline:none;overflow:hidden;transition:background-color 0.2s, border-color 0.2s, color 0.2s;user-select:none;-webkit-tap-highlight-color:transparent}.btn .content{position:relative}.btn:disabled{cursor:not-allowed;opacity:0.5}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:white;animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:#08104a}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:rgba(0, 0, 0, 0.2)}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:#dcdcdc;color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:#a6a6a6}.btn--outline:active:not(:disabled){background-color:#e6e6e6}.btn--dashed{background-color:transparent;border-style:dashed;border-color:#dcdcdc;color:#333}.btn--dashed:hover:not(:disabled){border-color:#a6a6a6;color:#0052d9}.btn--text{background-color:transparent;color:#0052d9;border-color:transparent}.btn--text:hover:not(:disabled){background-color:#f2f2f2}.btn--text:active:not(:disabled){background-color:#e6e6e6}.btn--small{height:28px;font-size:12px;padding:0 12px}.btn--medium{height:34px;font-size:14px;padding:0 18px}.btn--large{height:40px;font-size:16px;padding:0 24px}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:rgba(255, 255, 255, 0.3);transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:rgba(0, 0, 0, 0.1)}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}';export{l as L}
@@ -1 +1 @@
1
- export{L as lottery_button}from"./lottery-button-f20aa4a1.js";import"./index-b461bf7a.js";
1
+ export{L as lottery_button}from"./lottery-button-25ec2557.js";import"./index-020f75bf.js";
@@ -1 +1 @@
1
- import{p as t,b as n}from"./index-b461bf7a.js";export{s as setNonce}from"./index-b461bf7a.js";import{g as e}from"./app-globals-0f993ce5.js";(()=>{const n=import.meta.url,e={};return""!==n&&(e.resourcesUrl=new URL(".",n).href),t(e)})().then((async t=>(await e(),n([["lottery-button",[[1,"lottery-button",{mbSource:[513,"mb-source"],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],variant:[513],size:[513],disabled:[516],loading:[516],text:[513],language:[513],ripples:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],t))));
1
+ import{p as t,b as n}from"./index-020f75bf.js";export{s as setNonce}from"./index-020f75bf.js";import{g as l}from"./app-globals-0f993ce5.js";(()=>{const n=import.meta.url,l={};return""!==n&&(l.resourcesUrl=new URL(".",n).href),t(l)})().then((async t=>(await l(),n([["lottery-button",[[1,"lottery-button",{variant:[513],size:[513],disabled:[516],loading:[516],text:[513],mbSource:[513,"mb-source"],language:[513],clientStyling:[513,"client-styling"],clientStylingUrl:[513,"client-styling-url"],translationUrl:[513,"translation-url"],ripples:[32]},null,{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}]]]],t))));
@@ -1,9 +1,6 @@
1
1
  export type ButtonVariant = 'primary' | 'outline' | 'dashed' | 'text';
2
2
  export type ButtonSize = 'small' | 'medium' | 'large';
3
3
  export declare class LotteryButton {
4
- mbSource: string;
5
- clientStyling: string;
6
- clientStylingUrl: string;
7
4
  host: HTMLElement;
8
5
  /**
9
6
  * The variant of the button.
@@ -21,7 +18,11 @@ export declare class LotteryButton {
21
18
  disabled: boolean;
22
19
  loading: boolean;
23
20
  text: string;
21
+ mbSource: string;
24
22
  language: string;
23
+ clientStyling: string;
24
+ clientStylingUrl: string;
25
+ translationUrl: string;
25
26
  ripples: {
26
27
  top: number;
27
28
  left: number;
@@ -32,8 +33,9 @@ export declare class LotteryButton {
32
33
  handleClientStylingChange(newValue: any, oldValue: any): void;
33
34
  handleClientStylingUrlChange(newValue: any, oldValue: any): void;
34
35
  handleMbSourceChange(newValue: any, oldValue: any): void;
35
- componentDidLoad(): void;
36
36
  disconnectedCallback(): void;
37
+ componentDidLoad(): void;
38
+ componentWillLoad(): void;
37
39
  private handleClick;
38
40
  render(): any;
39
41
  }
@@ -23,6 +23,7 @@ export namespace Components {
23
23
  */
24
24
  "size": ButtonSize;
25
25
  "text": string;
26
+ "translationUrl": string;
26
27
  /**
27
28
  * The variant of the button. Can be 'primary', 'outline', 'dashed', or 'text'.
28
29
  */
@@ -56,6 +57,7 @@ declare namespace LocalJSX {
56
57
  */
57
58
  "size"?: ButtonSize;
58
59
  "text"?: string;
60
+ "translationUrl"?: string;
59
61
  /**
60
62
  * The variant of the button. Can be 'primary', 'outline', 'dashed', or 'text'.
61
63
  */
@@ -1,2 +1,3 @@
1
1
  export declare const translate: (key: string, customLang?: any, replacements?: any) => string;
2
2
  export declare const getTranslations: (data: any) => void;
3
+ export declare const resolveTranslationUrl: (translationUrl: string) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-button",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1,2 +0,0 @@
1
- var e=Object.defineProperty,t=new WeakMap,n=e=>t.get(e),l=(e,n)=>t.set(n.t=e,n),o=(e,t)=>t in e,s=(e,t)=>(0,console.error)(e,t),r=new Map,i=new Map,c="slot-fb{display:contents}slot-fb[hidden]{display:none}",u="undefined"!=typeof window?window:{},a=u.document||{head:{}},f={l:0,o:"",jmp:e=>e(),raf:e=>requestAnimationFrame(e),ael:(e,t,n,l)=>e.addEventListener(t,n,l),rel:(e,t,n,l)=>e.removeEventListener(t,n,l),ce:(e,t)=>new CustomEvent(e,t)},h=e=>Promise.resolve(e),d=(()=>{try{return new CSSStyleSheet,"function"==typeof(new CSSStyleSheet).replaceSync}catch(e){}return!1})(),p=!1,m=[],y=[],$=(e,t)=>n=>{e.push(n),p||(p=!0,t&&4&f.l?b(v):f.raf(v))},w=e=>{for(let t=0;t<e.length;t++)try{e[t](performance.now())}catch(e){s(e)}e.length=0},v=()=>{w(m),w(y),(p=m.length>0)&&f.raf(v)},b=e=>h().then(e),g=$(y,!0),S={},j=e=>"object"==(e=typeof e)||"function"===e;function k(e){var t,n,l;return null!=(l=null==(n=null==(t=e.head)?void 0:t.querySelector('meta[name="csp-nonce"]'))?void 0:n.getAttribute("content"))?l:void 0}((t,n)=>{for(var l in n)e(t,l,{get:n[l],enumerable:!0})})({},{err:()=>E,map:()=>C,ok:()=>O,unwrap:()=>P,unwrapErr:()=>R});var O=e=>({isOk:!0,isErr:!1,value:e}),E=e=>({isOk:!1,isErr:!0,value:e});function C(e,t){if(e.isOk){const n=t(e.value);return n instanceof Promise?n.then((e=>O(e))):O(n)}if(e.isErr)return E(e.value);throw"should never get here"}var M,x,P=e=>{if(e.isOk)return e.value;throw e.value},R=e=>{if(e.isErr)return e.value;throw e.value},T=(e,t,...n)=>{let l=null,o=null,s=!1,r=!1;const i=[],c=t=>{for(let n=0;n<t.length;n++)l=t[n],Array.isArray(l)?c(l):null!=l&&"boolean"!=typeof l&&((s="function"!=typeof e&&!j(l))&&(l+=""),s&&r?i[i.length-1].i+=l:i.push(s?A(null,l):l),r=s)};if(c(n),t){t.key&&(o=t.key);{const e=t.className||t.class;e&&(t.class="object"!=typeof e?e:Object.keys(e).filter((t=>e[t])).join(" "))}}const u=A(e,null);return u.u=t,i.length>0&&(u.h=i),u.p=o,u},A=(e,t)=>({l:0,m:e,i:t,$:null,h:null,u:null,p:null}),L={},N=e=>n(e).$hostElement$,U=new WeakMap,D=e=>"sc-"+e.v,F=(e,t,n,l,s,r)=>{if(n!==l){let i=o(e,t),c=t.toLowerCase();if("class"===t){const t=e.classList,o=W(n),s=W(l);t.remove(...o.filter((e=>e&&!s.includes(e)))),t.add(...s.filter((e=>e&&!o.includes(e))))}else if("style"===t){for(const t in n)l&&null!=l[t]||(t.includes("-")?e.style.removeProperty(t):e.style[t]="");for(const t in l)n&&l[t]===n[t]||(t.includes("-")?e.style.setProperty(t,l[t]):e.style[t]=l[t])}else if("key"===t);else if(i||"o"!==t[0]||"n"!==t[1]){const o=j(l);if((i||o&&null!==l)&&!s)try{if(e.tagName.includes("-"))e[t]=l;else{const o=null==l?"":l;"list"===t?i=!1:null!=n&&e[t]==o||(e[t]=o)}}catch(e){}null==l||!1===l?!1===l&&""!==e.getAttribute(t)||e.removeAttribute(t):(!i||4&r||s)&&!o&&e.setAttribute(t,l=!0===l?"":l)}else if(t="-"===t[2]?t.slice(3):o(u,c)?c.slice(2):c[2]+t.slice(3),n||l){const o=t.endsWith(q);t=t.replace(G,""),n&&f.rel(e,t,n,o),l&&f.ael(e,t,l,o)}}},H=/\s/,W=e=>e?e.split(H):[],q="Capture",G=RegExp(q+"$"),V=(e,t,n)=>{const l=11===t.$.nodeType&&t.$.host?t.$.host:t.$,o=e&&e.u||S,s=t.u||S;for(const e of _(Object.keys(o)))e in s||F(l,e,o[e],void 0,n,t.l);for(const e of _(Object.keys(s)))F(l,e,o[e],s[e],n,t.l)};function _(e){return e.includes("ref")?[...e.filter((e=>"ref"!==e)),"ref"]:e}var z=!1,B=(e,t,n)=>{const l=t.h[n];let o,s,r=0;if(null!==l.i)o=l.$=a.createTextNode(l.i);else if(o=l.$=a.createElement(l.m),V(null,l,z),null!=M&&o["s-si"]!==M&&o.classList.add(o["s-si"]=M),l.h)for(r=0;r<l.h.length;++r)s=B(e,l,r),s&&o.appendChild(s);return o["s-hn"]=x,o},I=(e,t,n,l,o,s)=>{let r,i=e;for(i.shadowRoot&&i.tagName===x&&(i=i.shadowRoot);o<=s;++o)l[o]&&(r=B(null,n,o),r&&(l[o].$=r,X(i,r,t)))},J=(e,t,n)=>{for(let l=t;l<=n;++l){const t=e[l];if(t){const e=t.$;e&&e.remove()}}},K=(e,t,n=!1)=>e.m===t.m&&(!!n||e.p===t.p),Q=(e,t,n=!1)=>{const l=t.$=e.$,o=e.h,s=t.h,r=t.i;null===r?(V(e,t,z),null!==o&&null!==s?((e,t,n,l,o=!1)=>{let s,r,i=0,c=0,u=0,a=0,f=t.length-1,h=t[0],d=t[f],p=l.length-1,m=l[0],y=l[p];for(;i<=f&&c<=p;)if(null==h)h=t[++i];else if(null==d)d=t[--f];else if(null==m)m=l[++c];else if(null==y)y=l[--p];else if(K(h,m,o))Q(h,m,o),h=t[++i],m=l[++c];else if(K(d,y,o))Q(d,y,o),d=t[--f],y=l[--p];else if(K(h,y,o))Q(h,y,o),X(e,h.$,d.$.nextSibling),h=t[++i],y=l[--p];else if(K(d,m,o))Q(d,m,o),X(e,d.$,h.$),d=t[--f],m=l[++c];else{for(u=-1,a=i;a<=f;++a)if(t[a]&&null!==t[a].p&&t[a].p===m.p){u=a;break}u>=0?(r=t[u],r.m!==m.m?s=B(t&&t[c],n,u):(Q(r,m,o),t[u]=void 0,s=r.$),m=l[++c]):(s=B(t&&t[c],n,c),m=l[++c]),s&&X(h.$.parentNode,s,h.$)}i>f?I(e,null==l[p+1]?null:l[p+1].$,n,l,c,p):c>p&&J(t,i,f)})(l,o,t,s,n):null!==s?(null!==e.i&&(l.textContent=""),I(l,null,t,s,0,s.length-1)):null!==o&&J(o,0,o.length-1)):e.i!==r&&(l.data=r)},X=(e,t,n)=>null==e?void 0:e.insertBefore(t,n),Y=(e,t)=>{t&&!e.S&&t["s-p"]&&t["s-p"].push(new Promise((t=>e.S=t)))},Z=(e,t)=>{if(e.l|=16,!(4&e.l))return Y(e,e.j),g((()=>ee(e,t)));e.l|=512},ee=(e,t)=>{const n=e.t;if(!n)throw Error(`Can't render component <${e.$hostElement$.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);return te(void 0,(()=>le(e,n,t)))},te=(e,t)=>ne(e)?e.then(t).catch((e=>{console.error(e),t()})):t(),ne=e=>e instanceof Promise||e&&e.then&&"function"==typeof e.then,le=async(e,t,n)=>{var l;const o=e.$hostElement$,s=o["s-rc"];n&&(e=>{const t=e.k,n=e.$hostElement$,l=t.l,o=((e,t)=>{var n;const l=D(t),o=i.get(l);if(e=11===e.nodeType?e:a,o)if("string"==typeof o){let s,r=U.get(e=e.head||e);if(r||U.set(e,r=new Set),!r.has(l)){{s=a.createElement("style"),s.innerHTML=o;const t=null!=(n=f.O)?n:k(a);null!=t&&s.setAttribute("nonce",t),e.insertBefore(s,e.querySelector("link"))}4&t.l&&(s.innerHTML+=c),r&&r.add(l)}}else e.adoptedStyleSheets.includes(o)||(e.adoptedStyleSheets=[...e.adoptedStyleSheets,o]);return l})(n.shadowRoot?n.shadowRoot:n.getRootNode(),t);10&l&&(n["s-sc"]=o,n.classList.add(o+"-h"))})(e);oe(e,t,o,n),s&&(s.map((e=>e())),o["s-rc"]=void 0);{const t=null!=(l=o["s-p"])?l:[],n=()=>se(e);0===t.length?n():(Promise.all(t).then(n),e.l|=4,t.length=0)}},oe=(e,t,n,l)=>{try{t=t.render(),e.l&=-17,e.l|=2,((e,t,n=!1)=>{const l=e.$hostElement$,o=e.k,s=e.C||A(null,null),r=(e=>e&&e.m===L)(t)?t:T(null,null,t);if(x=l.tagName,o.M&&(r.u=r.u||{},o.M.map((([e,t])=>r.u[t]=l[e]))),n&&r.u)for(const e of Object.keys(r.u))l.hasAttribute(e)&&!["key","ref","style","class"].includes(e)&&(r.u[e]=l[e]);r.m=null,r.l|=4,e.C=r,r.$=s.$=l.shadowRoot||l,M=l["s-sc"],Q(s,r,n)})(e,t,l)}catch(t){s(t,e.$hostElement$)}return null},se=e=>{const t=e.$hostElement$,n=e.t,l=e.j;64&e.l||(e.l|=64,ce(t),ie(n,"componentDidLoad"),e.P(t),l||re()),e.S&&(e.S(),e.S=void 0),512&e.l&&b((()=>Z(e,!1))),e.l&=-517},re=()=>{ce(a.documentElement),b((()=>(e=>{const t=f.ce("appload",{detail:{namespace:"lottery-button"}});return e.dispatchEvent(t),t})(u)))},ie=(e,t,n)=>{if(e&&e[t])try{return e[t](n)}catch(e){s(e)}},ce=e=>e.classList.add("hydrated"),ue=(e,t,l)=>{var o,r;const i=e.prototype;if(t.R||t.T||e.watchers){e.watchers&&!t.T&&(t.T=e.watchers);const c=Object.entries(null!=(o=t.R)?o:{});if(c.map((([e,[o]])=>{(31&o||2&l&&32&o)&&Object.defineProperty(i,e,{get(){return((e,t)=>n(this).A.get(t))(0,e)},set(l){((e,t,l,o)=>{const r=n(e);if(!r)throw Error(`Couldn't find host element for "${o.v}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/ionic-team/stencil/issues/5457).`);const i=r.$hostElement$,c=r.A.get(t),u=r.l,a=r.t;if(l=((e,t)=>null==e||j(e)?e:4&t?"false"!==e&&(""===e||!!e):1&t?e+"":e)(l,o.R[t][0]),(!(8&u)||void 0===c)&&l!==c&&(!Number.isNaN(c)||!Number.isNaN(l))&&(r.A.set(t,l),a)){if(o.T&&128&u){const e=o.T[t];e&&e.map((e=>{try{a[e](l,c,t)}catch(e){s(e,i)}}))}2==(18&u)&&Z(r,!1)}})(this,e,l,t)},configurable:!0,enumerable:!0})})),1&l){const l=new Map;i.attributeChangedCallback=function(e,o,s){f.jmp((()=>{var r;const c=l.get(e);if(this.hasOwnProperty(c))s=this[c],delete this[c];else{if(i.hasOwnProperty(c)&&"number"==typeof this[c]&&this[c]==s)return;if(null==c){const l=n(this),i=null==l?void 0:l.l;if(i&&!(8&i)&&128&i&&s!==o){const n=l.t,i=null==(r=t.T)?void 0:r[e];null==i||i.forEach((t=>{null!=n[t]&&n[t].call(n,s,o,e)}))}return}}this[c]=(null!==s||"boolean"!=typeof this[c])&&s}))},e.observedAttributes=Array.from(new Set([...Object.keys(null!=(r=t.T)?r:{}),...c.filter((([e,t])=>15&t[0])).map((([e,n])=>{var o;const s=n[1]||e;return l.set(s,e),512&n[0]&&(null==(o=t.M)||o.push([e,s])),s}))]))}}return e},ae=e=>{ie(e,"disconnectedCallback")},fe=(e,l={})=>{var o;const h=[],p=l.exclude||[],m=u.customElements,y=a.head,$=y.querySelector("meta[charset]"),w=a.createElement("style"),v=[];let b,g=!0;Object.assign(f,l),f.o=new URL(l.resourcesUrl||"./",a.baseURI).href;let S=!1;if(e.map((e=>{e[1].map((l=>{var o;const c={l:l[0],v:l[1],R:l[2],L:l[3]};4&c.l&&(S=!0),c.R=l[2],c.M=[],c.T=null!=(o=l[4])?o:{};const u=c.v,a=class extends HTMLElement{constructor(e){if(super(e),this.hasRegisteredEventListeners=!1,((e,n)=>{const l={l:0,$hostElement$:e,k:n,A:new Map};l.N=new Promise((e=>l.P=e)),e["s-p"]=[],e["s-rc"]=[],t.set(e,l)})(e=this,c),1&c.l)if(e.shadowRoot){if("open"!==e.shadowRoot.mode)throw Error(`Unable to re-use existing shadow root for ${c.v}! Mode is set to ${e.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else e.attachShadow({mode:"open"})}connectedCallback(){this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0),b&&(clearTimeout(b),b=null),g?v.push(this):f.jmp((()=>(e=>{if(!(1&f.l)){const t=n(e),l=t.k,o=()=>{};if(1&t.l)(null==t?void 0:t.t)||(null==t?void 0:t.N)&&t.N.then((()=>{}));else{t.l|=1;{let n=e;for(;n=n.parentNode||n.host;)if(n["s-p"]){Y(t,t.j=n);break}}l.R&&Object.entries(l.R).map((([t,[n]])=>{if(31&n&&e.hasOwnProperty(t)){const n=e[t];delete e[t],e[t]=n}})),(async(e,t,n)=>{let l;if(!(32&t.l)){if(t.l|=32,n.U){const e=(e=>{const t=e.v.replace(/-/g,"_"),n=e.U;if(!n)return;const l=r.get(n);return l?l[t]:import(`./${n}.entry.js`).then((e=>(r.set(n,e),e[t])),s)
2
- /*!__STENCIL_STATIC_IMPORT_SWITCH__*/})(n);if(e&&"then"in e){const t=()=>{};l=await e,t()}else l=e;if(!l)throw Error(`Constructor for "${n.v}#${t.D}" was not found`);l.isProxied||(n.T=l.watchers,ue(l,n,2),l.isProxied=!0);const o=()=>{};t.l|=8;try{new l(t)}catch(e){s(e)}t.l&=-9,t.l|=128,o()}else l=e.constructor,customElements.whenDefined(e.localName).then((()=>t.l|=128));if(l&&l.style){let e;"string"==typeof l.style&&(e=l.style);const t=D(n);if(!i.has(t)){const l=()=>{};((e,t,n)=>{let l=i.get(e);d&&n?(l=l||new CSSStyleSheet,"string"==typeof l?l=t:l.replaceSync(t)):l=t,i.set(e,l)})(t,e,!!(1&n.l)),l()}}}const o=t.j,c=()=>Z(t,!0);o&&o["s-rc"]?o["s-rc"].push(c):c()})(e,t,l)}o()}})(this)))}disconnectedCallback(){f.jmp((()=>(async()=>{if(!(1&f.l)){const e=n(this);(null==e?void 0:e.t)?ae(e.t):(null==e?void 0:e.N)&&e.N.then((()=>ae(e.t)))}})()))}componentOnReady(){return n(this).N}};c.U=e[0],p.includes(u)||m.get(u)||(h.push(u),m.define(u,ue(a,c,1)))}))})),h.length>0&&(S&&(w.textContent+=c),w.textContent+=h.sort()+"{visibility:hidden}.hydrated{visibility:inherit}",w.innerHTML.length)){w.setAttribute("data-styles","");const e=null!=(o=f.O)?o:k(a);null!=e&&w.setAttribute("nonce",e),y.insertBefore(w,$?$.nextSibling:y.firstChild)}g=!1,v.length?v.map((e=>e.connectedCallback())):f.jmp((()=>b=setTimeout(re,30)))},he=e=>f.O=e;export{fe as b,N as g,T as h,h as p,l as r,he as s}
@@ -1 +0,0 @@
1
- import{r as t,h as e,g as n}from"./index-b461bf7a.js";function i(t,e){if(t){const n=document.createElement("style");n.innerHTML=e,t.appendChild(n)}}function o(t,e){const n=new URL(e);fetch(n.href).then((t=>t.text())).then((e=>{const n=document.createElement("style");n.innerHTML=e,t&&t.appendChild(n)})).catch((t=>{console.error("There was an error while trying to load client styling from URL",t)}))}function r(t,e){if(window.emMessageBus){const n=document.createElement("style");window.emMessageBus.subscribe(e,(e=>{n.innerHTML=e,t&&t.appendChild(n)}))}}const a=["ro","en","fr","ar","hr","zh"],s={en:{loading:"Loading"},ro:{},fr:{},ar:{},hr:{}},l=class{constructor(e){t(this,e),this.handleClick=t=>{if(this.disabled)return;const e=this.host.shadowRoot.querySelector(".btn");if(!e)return;const n=e.getBoundingClientRect(),i=Math.max(n.width,n.height),o={top:t.clientY-n.top-i/2,left:t.clientX-n.left-i/2,size:i};this.ripples=[...this.ripples,o],setTimeout((()=>{this.ripples=this.ripples.filter((t=>t!==o))}),600)},this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.variant="primary",this.size="medium",this.disabled=!1,this.loading=!1,this.text=void 0,this.language="en",this.ripples=[]}handleClientStylingChange(t,e){t!=e&&i(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(t,e){t!=e&&o(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(t,e){t!=e&&r(this.stylingContainer,`${this.mbSource}.Style`)}componentDidLoad(){this.stylingContainer&&(this.mbSource&&r(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&i(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&o(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}render(){const{variant:t,disabled:n,size:i}=this,o=n||this.loading;return e("button",{key:"01f92ec117f679466c30ea86cdc8af7caf8f8e6d",class:{btn:!0,[`btn--${t}`]:!0,[`btn--${i}`]:!0,"btn--loading":this.loading},disabled:o,onClick:this.handleClick},this.loading?e("div",{class:"loading-container"},e("span",{class:"content"},this.text||(()=>{const t=this.language;let e=s[void 0!==t&&a.includes(t)?t:"en"].loading;return e})()),e("span",{class:"spinner"})):e("span",{class:"content"},this.text),e("div",{key:"918ddc7bbcd8aba1f2c194aa73f311b63016d2ec",class:"ripple-container"},this.ripples.map(((t,n)=>e("span",{key:n,class:"ripple",style:{top:`${t.top}px`,left:`${t.left}px`,width:`${t.size}px`,height:`${t.size}px`}})))))}get host(){return n(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};l.style=':host{display:inline-block;font-family:"PingFang SC", "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif}.btn{position:relative;display:inline-flex;align-items:center;justify-content:center;border:1px solid transparent;border-radius:6px;font-weight:500;cursor:pointer;outline:none;overflow:hidden;transition:background-color 0.2s, border-color 0.2s, color 0.2s;user-select:none;-webkit-tap-highlight-color:transparent}.btn .content{position:relative}.btn:disabled{cursor:not-allowed;opacity:0.5}.btn .loading-container{display:flex;align-items:center}.btn--loading{position:relative}.btn .spinner{display:inline-block;width:1em;height:1em;border:2px solid rgba(255, 255, 255, 0.3);border-radius:50%;border-top-color:white;animation:spin 1s ease-in-out infinite;margin-left:0.5em;vertical-align:middle}.btn--small .spinner{width:0.8em;height:0.8em}.btn--large .spinner{width:1.2em;height:1.2em}@keyframes spin{to{transform:rotate(360deg)}}.btn--primary{background-color:var(--emw--color-primary, #0d196e);color:var(--emw--color-typography-inverse, #fff)}.btn--primary:hover:not(:disabled){background-color:var(--emw--color-primary-variant, #1367e7)}.btn--primary:active:not(:disabled){background-color:#08104a}.btn--outline .spinner,.btn--dashed .spinner,.btn--text .spinner{border-top-color:currentColor;border-color:rgba(0, 0, 0, 0.2)}.btn--outline{background-color:var(--emw--color-background, #fff);border-color:#dcdcdc;color:var(--emw--color-typography, #000)}.btn--outline:hover:not(:disabled){background-color:var(--emw--color-background-tertiary, #ccc);border-color:#a6a6a6}.btn--outline:active:not(:disabled){background-color:#e6e6e6}.btn--dashed{background-color:transparent;border-style:dashed;border-color:#dcdcdc;color:#333}.btn--dashed:hover:not(:disabled){border-color:#a6a6a6;color:#0052d9}.btn--text{background-color:transparent;color:#0052d9;border-color:transparent}.btn--text:hover:not(:disabled){background-color:#f2f2f2}.btn--text:active:not(:disabled){background-color:#e6e6e6}.btn--small{height:28px;font-size:12px;padding:0 12px}.btn--medium{height:34px;font-size:14px;padding:0 18px}.btn--large{height:40px;font-size:16px;padding:0 24px}.ripple-container{position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;border-radius:inherit}.ripple{position:absolute;border-radius:50%;background-color:rgba(255, 255, 255, 0.3);transform:scale(0);animation:ripple-animation 600ms linear}.btn--outline .ripple,.btn--dashed .ripple,.btn--text .ripple{background-color:rgba(0, 0, 0, 0.1)}@keyframes ripple-animation{to{transform:scale(4);opacity:0}}';export{l as L}