@everymatrix/lottery-hakuna-collapse 1.87.26 → 1.87.27

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryHakunaCollapse = require('./lottery-hakuna-collapse-e91d7dc9.js');
5
+ const lotteryHakunaCollapse = require('./lottery-hakuna-collapse-7e57277d.js');
6
6
  require('./index-5647524d.js');
7
7
 
8
8
 
@@ -2,6 +2,8 @@
2
2
 
3
3
  const index = require('./index-5647524d.js');
4
4
 
5
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
6
+
5
7
  /**
6
8
  * @name setClientStyling
7
9
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -47,18 +49,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
47
49
  * @param {HTMLElement} stylingContainer The highest element of the widget
48
50
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
49
51
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
52
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
50
53
  */
51
- function setStreamStyling(stylingContainer, domain, subscription) {
52
- if (window.emMessageBus) {
53
- const sheet = document.createElement('style');
54
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
55
+ if (!window.emMessageBus) return;
54
56
 
55
- window.emMessageBus.subscribe(domain, (data) => {
56
- sheet.innerHTML = data;
57
- if (stylingContainer) {
58
- stylingContainer.appendChild(sheet);
59
- }
60
- });
57
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
58
+
59
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
60
+ subscription = getStyleTagSubscription(stylingContainer, domain);
61
+
62
+ return subscription;
63
+ }
64
+
65
+ if (!window[StyleCacheKey]) {
66
+ window[StyleCacheKey] = {};
61
67
  }
68
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
69
+
70
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
71
+ const wrappedUnsubscribe = () => {
72
+ if (window[StyleCacheKey][domain]) {
73
+ const cachedObject = window[StyleCacheKey][domain];
74
+ cachedObject.refCount > 1
75
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
76
+ : delete window[StyleCacheKey][domain];
77
+ }
78
+
79
+ originalUnsubscribe();
80
+ };
81
+ subscription.unsubscribe = wrappedUnsubscribe;
82
+
83
+ return subscription;
84
+ }
85
+
86
+ function getStyleTagSubscription(stylingContainer, domain) {
87
+ const sheet = document.createElement('style');
88
+
89
+ return window.emMessageBus.subscribe(domain, (data) => {
90
+ if (stylingContainer) {
91
+ sheet.innerHTML = data;
92
+ stylingContainer.appendChild(sheet);
93
+ }
94
+ });
95
+ }
96
+
97
+ function getAdoptStyleSubscription(stylingContainer, domain) {
98
+ return window.emMessageBus.subscribe(domain, (data) => {
99
+ if (!stylingContainer) return;
100
+
101
+ const shadowRoot = stylingContainer.getRootNode();
102
+ const cacheStyleObject = window[StyleCacheKey];
103
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
104
+
105
+ if (!cachedStyle) {
106
+ cachedStyle = new CSSStyleSheet();
107
+ cachedStyle.replaceSync(data);
108
+ cacheStyleObject[domain] = {
109
+ sheet: cachedStyle,
110
+ refCount: 1
111
+ };
112
+ } else {
113
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
114
+ }
115
+
116
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
117
+ if (!currentSheets.includes(cachedStyle)) {
118
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
119
+ }
120
+ });
62
121
  }
63
122
 
64
123
  const lotteryHakunaCollapseCss = ":host{display:block;width:100%;box-sizing:border-box}.lottery-hakuna-collapse{border:var(--lottery-hakuna-collapse-border-width, 1px) solid transparent;border-radius:var(--lottery-hakuna-collapse-border-radius, 12px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--lottery-hakuna-collapse-bg, #120505), var(--lottery-hakuna-collapse-bg, #120505)), linear-gradient(to top left, var(--lottery-hakuna-collapse-border-gradient-start, #c52217) var(--lottery-hakuna-collapse-border-gradient-start-stop, 32%), var(--lottery-hakuna-collapse-border-gradient-end, #2c2525) var(--lottery-hakuna-collapse-border-gradient-end-stop, 68%));overflow:hidden;margin-bottom:var(--lottery-hakuna-collapse-margin-bottom, 10px)}.lottery-hakuna-collapse .header{display:flex;justify-content:space-between;align-items:center;padding:var(--lottery-hakuna-collapse-header-padding, 20px);cursor:pointer;user-select:none}.lottery-hakuna-collapse .header .header-content{display:flex;align-items:center;flex:1;gap:var(--lottery-hakuna-collapse-header-gap, 8px)}.lottery-hakuna-collapse .header .title{font-size:var(--lottery-hakuna-collapse-title-size, 16px);font-weight:var(--lottery-hakuna-collapse-title-weight, 600);color:var(--lottery-hakuna-collapse-title-color, #fff)}.lottery-hakuna-collapse .header .icon{color:var(--lottery-hakuna-collapse-icon-color, #fff);font-size:var(--lottery-hakuna-collapse-icon-size, 12px);transition:transform 0.3s ease}.lottery-hakuna-collapse .header .icon.is-open{transform:rotate(180deg)}.lottery-hakuna-collapse .content{padding:var(--lottery-hakuna-collapse-content-padding, 0 20px 20px 20px);color:var(--lottery-hakuna-collapse-content-color, #fff);font-size:var(--lottery-hakuna-collapse-content-size, 14px);line-height:var(--lottery-hakuna-collapse-content-line-height, 1.5)}";
@@ -87,7 +146,7 @@ const LotteryHakunaCollapse = class {
87
146
  }
88
147
  handleMbSourceChange(newValue, oldValue) {
89
148
  if (newValue != oldValue) {
90
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
149
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
91
150
  }
92
151
  }
93
152
  componentWillLoad() {
@@ -99,7 +158,7 @@ const LotteryHakunaCollapse = class {
99
158
  componentDidLoad() {
100
159
  if (this.stylingContainer) {
101
160
  if (this.mbSource)
102
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
161
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
103
162
  if (this.clientStyling)
104
163
  setClientStyling(this.stylingContainer, this.clientStyling);
105
164
  if (this.clientStylingUrl)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const lotteryHakunaCollapse = require('./lottery-hakuna-collapse-e91d7dc9.js');
5
+ const lotteryHakunaCollapse = require('./lottery-hakuna-collapse-7e57277d.js');
6
6
  require('./index-5647524d.js');
7
7
 
8
8
 
package/dist/esm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { L as LotteryHakunaCollapse } from './lottery-hakuna-collapse-e56904fa.js';
1
+ export { L as LotteryHakunaCollapse } from './lottery-hakuna-collapse-f8b27394.js';
2
2
  import './index-af1fac59.js';
@@ -1,5 +1,7 @@
1
1
  import { r as registerInstance, h, g as getElement } from './index-af1fac59.js';
2
2
 
3
+ const StyleCacheKey = '__WIDGET_GLOBAL_STYLE_CACHE__';
4
+
3
5
  /**
4
6
  * @name setClientStyling
5
7
  * @description Method used to create and append to the passed element of the widget a style element with the content received
@@ -45,18 +47,75 @@ function setClientStylingURL(stylingContainer, clientStylingUrl) {
45
47
  * @param {HTMLElement} stylingContainer The highest element of the widget
46
48
  * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
47
49
  * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
50
+ * @param {boolean} useAdoptedStyleSheets A flag to gradually enable testing of adoptedStyleSheets
48
51
  */
49
- function setStreamStyling(stylingContainer, domain, subscription) {
50
- if (window.emMessageBus) {
51
- const sheet = document.createElement('style');
52
+ function setStreamStyling(stylingContainer, domain, subscription, useAdoptedStyleSheets = false) {
53
+ if (!window.emMessageBus) return;
52
54
 
53
- window.emMessageBus.subscribe(domain, (data) => {
54
- sheet.innerHTML = data;
55
- if (stylingContainer) {
56
- stylingContainer.appendChild(sheet);
57
- }
58
- });
55
+ const supportAdoptStyle = 'adoptedStyleSheets' in Document.prototype;
56
+
57
+ if (!supportAdoptStyle || !useAdoptedStyleSheets) {
58
+ subscription = getStyleTagSubscription(stylingContainer, domain);
59
+
60
+ return subscription;
61
+ }
62
+
63
+ if (!window[StyleCacheKey]) {
64
+ window[StyleCacheKey] = {};
59
65
  }
66
+ subscription = getAdoptStyleSubscription(stylingContainer, domain);
67
+
68
+ const originalUnsubscribe = subscription.unsubscribe.bind(subscription);
69
+ const wrappedUnsubscribe = () => {
70
+ if (window[StyleCacheKey][domain]) {
71
+ const cachedObject = window[StyleCacheKey][domain];
72
+ cachedObject.refCount > 1
73
+ ? (cachedObject.refCount = cachedObject.refCount - 1)
74
+ : delete window[StyleCacheKey][domain];
75
+ }
76
+
77
+ originalUnsubscribe();
78
+ };
79
+ subscription.unsubscribe = wrappedUnsubscribe;
80
+
81
+ return subscription;
82
+ }
83
+
84
+ function getStyleTagSubscription(stylingContainer, domain) {
85
+ const sheet = document.createElement('style');
86
+
87
+ return window.emMessageBus.subscribe(domain, (data) => {
88
+ if (stylingContainer) {
89
+ sheet.innerHTML = data;
90
+ stylingContainer.appendChild(sheet);
91
+ }
92
+ });
93
+ }
94
+
95
+ function getAdoptStyleSubscription(stylingContainer, domain) {
96
+ return window.emMessageBus.subscribe(domain, (data) => {
97
+ if (!stylingContainer) return;
98
+
99
+ const shadowRoot = stylingContainer.getRootNode();
100
+ const cacheStyleObject = window[StyleCacheKey];
101
+ let cachedStyle = cacheStyleObject[domain]?.sheet;
102
+
103
+ if (!cachedStyle) {
104
+ cachedStyle = new CSSStyleSheet();
105
+ cachedStyle.replaceSync(data);
106
+ cacheStyleObject[domain] = {
107
+ sheet: cachedStyle,
108
+ refCount: 1
109
+ };
110
+ } else {
111
+ cacheStyleObject[domain].refCount = cacheStyleObject[domain].refCount + 1;
112
+ }
113
+
114
+ const currentSheets = shadowRoot.adoptedStyleSheets || [];
115
+ if (!currentSheets.includes(cachedStyle)) {
116
+ shadowRoot.adoptedStyleSheets = [...currentSheets, cachedStyle];
117
+ }
118
+ });
60
119
  }
61
120
 
62
121
  const lotteryHakunaCollapseCss = ":host{display:block;width:100%;box-sizing:border-box}.lottery-hakuna-collapse{border:var(--lottery-hakuna-collapse-border-width, 1px) solid transparent;border-radius:var(--lottery-hakuna-collapse-border-radius, 12px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--lottery-hakuna-collapse-bg, #120505), var(--lottery-hakuna-collapse-bg, #120505)), linear-gradient(to top left, var(--lottery-hakuna-collapse-border-gradient-start, #c52217) var(--lottery-hakuna-collapse-border-gradient-start-stop, 32%), var(--lottery-hakuna-collapse-border-gradient-end, #2c2525) var(--lottery-hakuna-collapse-border-gradient-end-stop, 68%));overflow:hidden;margin-bottom:var(--lottery-hakuna-collapse-margin-bottom, 10px)}.lottery-hakuna-collapse .header{display:flex;justify-content:space-between;align-items:center;padding:var(--lottery-hakuna-collapse-header-padding, 20px);cursor:pointer;user-select:none}.lottery-hakuna-collapse .header .header-content{display:flex;align-items:center;flex:1;gap:var(--lottery-hakuna-collapse-header-gap, 8px)}.lottery-hakuna-collapse .header .title{font-size:var(--lottery-hakuna-collapse-title-size, 16px);font-weight:var(--lottery-hakuna-collapse-title-weight, 600);color:var(--lottery-hakuna-collapse-title-color, #fff)}.lottery-hakuna-collapse .header .icon{color:var(--lottery-hakuna-collapse-icon-color, #fff);font-size:var(--lottery-hakuna-collapse-icon-size, 12px);transition:transform 0.3s ease}.lottery-hakuna-collapse .header .icon.is-open{transform:rotate(180deg)}.lottery-hakuna-collapse .content{padding:var(--lottery-hakuna-collapse-content-padding, 0 20px 20px 20px);color:var(--lottery-hakuna-collapse-content-color, #fff);font-size:var(--lottery-hakuna-collapse-content-size, 14px);line-height:var(--lottery-hakuna-collapse-content-line-height, 1.5)}";
@@ -85,7 +144,7 @@ const LotteryHakunaCollapse = class {
85
144
  }
86
145
  handleMbSourceChange(newValue, oldValue) {
87
146
  if (newValue != oldValue) {
88
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
147
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
89
148
  }
90
149
  }
91
150
  componentWillLoad() {
@@ -97,7 +156,7 @@ const LotteryHakunaCollapse = class {
97
156
  componentDidLoad() {
98
157
  if (this.stylingContainer) {
99
158
  if (this.mbSource)
100
- setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
159
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
101
160
  if (this.clientStyling)
102
161
  setClientStyling(this.stylingContainer, this.clientStyling);
103
162
  if (this.clientStylingUrl)
@@ -1,2 +1,2 @@
1
- export { L as lottery_hakuna_collapse } from './lottery-hakuna-collapse-e56904fa.js';
1
+ export { L as lottery_hakuna_collapse } from './lottery-hakuna-collapse-f8b27394.js';
2
2
  import './index-af1fac59.js';
@@ -1 +1 @@
1
- export{L as LotteryHakunaCollapse}from"./lottery-hakuna-collapse-e56904fa.js";import"./index-af1fac59.js";
1
+ export{L as LotteryHakunaCollapse}from"./lottery-hakuna-collapse-f8b27394.js";import"./index-af1fac59.js";
@@ -0,0 +1 @@
1
+ import{r as e,h as t,g as a}from"./index-af1fac59.js";const n="__WIDGET_GLOBAL_STYLE_CACHE__";function o(e,t){if(e){const a=document.createElement("style");a.innerHTML=t,e.appendChild(a)}}function l(e,t){if(!e||!t)return;const a=new URL(t);fetch(a.href).then((e=>e.text())).then((t=>{const a=document.createElement("style");a.innerHTML=t,e&&e.appendChild(a)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function r(e,t,a,o=!1){if(!window.emMessageBus)return;if(!("adoptedStyleSheets"in Document.prototype)||!o)return a=function(e,t){const a=document.createElement("style");return window.emMessageBus.subscribe(t,(t=>{e&&(a.innerHTML=t,e.appendChild(a))}))}(e,t),a;window[n]||(window[n]={}),a=function(e,t){return window.emMessageBus.subscribe(t,(a=>{if(!e)return;const o=e.getRootNode(),l=window[n];let r=l[t]?.sheet;r?l[t].refCount=l[t].refCount+1:(r=new CSSStyleSheet,r.replaceSync(a),l[t]={sheet:r,refCount:1});const i=o.adoptedStyleSheets||[];i.includes(r)||(o.adoptedStyleSheets=[...i,r])}))}(e,t);const l=a.unsubscribe.bind(a);return a.unsubscribe=()=>{if(window[n][t]){const e=window[n][t];e.refCount>1?e.refCount=e.refCount-1:delete window[n][t]}l()},a}const i=class{constructor(t){e(this,t),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.headerTitle="",this.collapsed=!0,this.isOpen=!1,this.hasSummary=!1}handleClientStylingChange(e,t){e!=t&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&l(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&r(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription)}componentWillLoad(){this.isOpen=!this.collapsed}componentWillRender(){this.hasSummary=!!this.el.querySelector('[slot="summary"]')}componentDidLoad(){this.stylingContainer&&(this.mbSource&&r(this.stylingContainer,`${this.mbSource}.Style`,this.stylingSubscription),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&l(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}async toggle(){this.isOpen=!this.isOpen}render(){const e=this.isOpen||this.hasSummary;return t("div",{key:"5e28ba28bf46f6a22f749bbd878aef8972bb7eeb",ref:e=>this.stylingContainer=e,class:"lottery-hakuna-collapse"},t("div",{key:"ec42a23932c7e0652476743c1cafcfe7e411c2aa",class:"header",onClick:()=>this.toggle()},t("div",{key:"152e98bb7fc69274d61ffff0d6de9f76a1df90f8",class:"header-content"},this.headerTitle&&t("span",{key:"0acc51d711ca12fa1a666dbe1678071a37fa0aff",class:"title"},this.headerTitle)),t("span",{key:"ad31e6e3a249a9dca394e725e805422297811f85",class:{icon:!0,"is-open":this.isOpen}},t("svg",{key:"14bc41acc77204fcb1966f8966dc6feb49730518",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},t("path",{key:"bac152fc477b275a1792264a35dba2765cf2687f","fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.96967 6.21967C4.26256 5.92678 4.73744 5.92678 5.03033 6.21967L9 10.1893L12.9697 6.21967C13.2626 5.92678 13.7374 5.92678 14.0303 6.21967C14.3232 6.51256 14.3232 6.98744 14.0303 7.28033L9.53033 11.7803C9.23744 12.0732 8.76256 12.0732 8.46967 11.7803L3.96967 7.28033C3.67678 6.98744 3.67678 6.51256 3.96967 6.21967Z",fill:"currentColor"})))),e&&t("div",{key:"0358ec8ccc21286a31f6ffcb770efa6c1bcc36ea",class:"content"},t("slot",this.isOpen?null:{name:"summary"})))}get el(){return a(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};i.style=":host{display:block;width:100%;box-sizing:border-box}.lottery-hakuna-collapse{border:var(--lottery-hakuna-collapse-border-width, 1px) solid transparent;border-radius:var(--lottery-hakuna-collapse-border-radius, 12px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--lottery-hakuna-collapse-bg, #120505), var(--lottery-hakuna-collapse-bg, #120505)), linear-gradient(to top left, var(--lottery-hakuna-collapse-border-gradient-start, #c52217) var(--lottery-hakuna-collapse-border-gradient-start-stop, 32%), var(--lottery-hakuna-collapse-border-gradient-end, #2c2525) var(--lottery-hakuna-collapse-border-gradient-end-stop, 68%));overflow:hidden;margin-bottom:var(--lottery-hakuna-collapse-margin-bottom, 10px)}.lottery-hakuna-collapse .header{display:flex;justify-content:space-between;align-items:center;padding:var(--lottery-hakuna-collapse-header-padding, 20px);cursor:pointer;user-select:none}.lottery-hakuna-collapse .header .header-content{display:flex;align-items:center;flex:1;gap:var(--lottery-hakuna-collapse-header-gap, 8px)}.lottery-hakuna-collapse .header .title{font-size:var(--lottery-hakuna-collapse-title-size, 16px);font-weight:var(--lottery-hakuna-collapse-title-weight, 600);color:var(--lottery-hakuna-collapse-title-color, #fff)}.lottery-hakuna-collapse .header .icon{color:var(--lottery-hakuna-collapse-icon-color, #fff);font-size:var(--lottery-hakuna-collapse-icon-size, 12px);transition:transform 0.3s ease}.lottery-hakuna-collapse .header .icon.is-open{transform:rotate(180deg)}.lottery-hakuna-collapse .content{padding:var(--lottery-hakuna-collapse-content-padding, 0 20px 20px 20px);color:var(--lottery-hakuna-collapse-content-color, #fff);font-size:var(--lottery-hakuna-collapse-content-size, 14px);line-height:var(--lottery-hakuna-collapse-content-line-height, 1.5)}";export{i as L}
@@ -1 +1 @@
1
- export{L as lottery_hakuna_collapse}from"./lottery-hakuna-collapse-e56904fa.js";import"./index-af1fac59.js";
1
+ export{L as lottery_hakuna_collapse}from"./lottery-hakuna-collapse-f8b27394.js";import"./index-af1fac59.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/lottery-hakuna-collapse",
3
- "version": "1.87.26",
3
+ "version": "1.87.27",
4
4
  "main": "./dist/index.cjs.js",
5
5
  "module": "./dist/index.js",
6
6
  "es2015": "./dist/esm/index.mjs",
@@ -1 +0,0 @@
1
- import{r as e,h as t,g as a}from"./index-af1fac59.js";function o(e,t){if(e){const a=document.createElement("style");a.innerHTML=t,e.appendChild(a)}}function l(e,t){if(!e||!t)return;const a=new URL(t);fetch(a.href).then((e=>e.text())).then((t=>{const a=document.createElement("style");a.innerHTML=t,e&&e.appendChild(a)})).catch((e=>{console.error("There was an error while trying to load client styling from URL",e)}))}function n(e,t){if(window.emMessageBus){const a=document.createElement("style");window.emMessageBus.subscribe(t,(t=>{a.innerHTML=t,e&&e.appendChild(a)}))}}const r=class{constructor(t){e(this,t),this.mbSource=void 0,this.clientStyling=void 0,this.clientStylingUrl=void 0,this.headerTitle="",this.collapsed=!0,this.isOpen=!1,this.hasSummary=!1}handleClientStylingChange(e,t){e!=t&&o(this.stylingContainer,this.clientStyling)}handleClientStylingUrlChange(e,t){e!=t&&l(this.stylingContainer,this.clientStylingUrl)}handleMbSourceChange(e,t){e!=t&&n(this.stylingContainer,`${this.mbSource}.Style`)}componentWillLoad(){this.isOpen=!this.collapsed}componentWillRender(){this.hasSummary=!!this.el.querySelector('[slot="summary"]')}componentDidLoad(){this.stylingContainer&&(this.mbSource&&n(this.stylingContainer,`${this.mbSource}.Style`),this.clientStyling&&o(this.stylingContainer,this.clientStyling),this.clientStylingUrl&&l(this.stylingContainer,this.clientStylingUrl))}disconnectedCallback(){this.stylingSubscription&&this.stylingSubscription.unsubscribe()}async toggle(){this.isOpen=!this.isOpen}render(){const e=this.isOpen||this.hasSummary;return t("div",{key:"5e28ba28bf46f6a22f749bbd878aef8972bb7eeb",ref:e=>this.stylingContainer=e,class:"lottery-hakuna-collapse"},t("div",{key:"ec42a23932c7e0652476743c1cafcfe7e411c2aa",class:"header",onClick:()=>this.toggle()},t("div",{key:"152e98bb7fc69274d61ffff0d6de9f76a1df90f8",class:"header-content"},this.headerTitle&&t("span",{key:"0acc51d711ca12fa1a666dbe1678071a37fa0aff",class:"title"},this.headerTitle)),t("span",{key:"ad31e6e3a249a9dca394e725e805422297811f85",class:{icon:!0,"is-open":this.isOpen}},t("svg",{key:"14bc41acc77204fcb1966f8966dc6feb49730518",xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 18 18",fill:"none"},t("path",{key:"bac152fc477b275a1792264a35dba2765cf2687f","fill-rule":"evenodd","clip-rule":"evenodd",d:"M3.96967 6.21967C4.26256 5.92678 4.73744 5.92678 5.03033 6.21967L9 10.1893L12.9697 6.21967C13.2626 5.92678 13.7374 5.92678 14.0303 6.21967C14.3232 6.51256 14.3232 6.98744 14.0303 7.28033L9.53033 11.7803C9.23744 12.0732 8.76256 12.0732 8.46967 11.7803L3.96967 7.28033C3.67678 6.98744 3.67678 6.51256 3.96967 6.21967Z",fill:"currentColor"})))),e&&t("div",{key:"0358ec8ccc21286a31f6ffcb770efa6c1bcc36ea",class:"content"},t("slot",this.isOpen?null:{name:"summary"})))}get el(){return a(this)}static get watchers(){return{clientStyling:["handleClientStylingChange"],clientStylingUrl:["handleClientStylingUrlChange"],mbSource:["handleMbSourceChange"]}}};r.style=":host{display:block;width:100%;box-sizing:border-box}.lottery-hakuna-collapse{border:var(--lottery-hakuna-collapse-border-width, 1px) solid transparent;border-radius:var(--lottery-hakuna-collapse-border-radius, 12px);background-origin:border-box;background-clip:padding-box, border-box;background-image:linear-gradient(var(--lottery-hakuna-collapse-bg, #120505), var(--lottery-hakuna-collapse-bg, #120505)), linear-gradient(to top left, var(--lottery-hakuna-collapse-border-gradient-start, #c52217) var(--lottery-hakuna-collapse-border-gradient-start-stop, 32%), var(--lottery-hakuna-collapse-border-gradient-end, #2c2525) var(--lottery-hakuna-collapse-border-gradient-end-stop, 68%));overflow:hidden;margin-bottom:var(--lottery-hakuna-collapse-margin-bottom, 10px)}.lottery-hakuna-collapse .header{display:flex;justify-content:space-between;align-items:center;padding:var(--lottery-hakuna-collapse-header-padding, 20px);cursor:pointer;user-select:none}.lottery-hakuna-collapse .header .header-content{display:flex;align-items:center;flex:1;gap:var(--lottery-hakuna-collapse-header-gap, 8px)}.lottery-hakuna-collapse .header .title{font-size:var(--lottery-hakuna-collapse-title-size, 16px);font-weight:var(--lottery-hakuna-collapse-title-weight, 600);color:var(--lottery-hakuna-collapse-title-color, #fff)}.lottery-hakuna-collapse .header .icon{color:var(--lottery-hakuna-collapse-icon-color, #fff);font-size:var(--lottery-hakuna-collapse-icon-size, 12px);transition:transform 0.3s ease}.lottery-hakuna-collapse .header .icon.is-open{transform:rotate(180deg)}.lottery-hakuna-collapse .content{padding:var(--lottery-hakuna-collapse-content-padding, 0 20px 20px 20px);color:var(--lottery-hakuna-collapse-content-color, #fff);font-size:var(--lottery-hakuna-collapse-content-size, 14px);line-height:var(--lottery-hakuna-collapse-content-line-height, 1.5)}";export{r as L}