mealz-components 1.3.15 → 1.3.17

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
  * @license
3
3
  * Copyright 2019 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const T=globalThis,I=T.ShadowRoot&&(T.ShadyCSS===void 0||T.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,B=Symbol(),V=new WeakMap;let tt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==B)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(I&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=V.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&V.set(e,t))}return t}toString(){return this.cssText}};const ot=r=>new tt(typeof r=="string"?r:r+"",void 0,B),Pt=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new tt(e,r,B)},ht=(r,t)=>{if(I)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=T.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},W=I?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return ot(e)})(r):r;/**
5
+ */const H=globalThis,I=H.ShadowRoot&&(H.ShadyCSS===void 0||H.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,B=Symbol(),V=new WeakMap;let tt=class{constructor(t,e,s){if(this._$cssResult$=!0,s!==B)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o;const e=this.t;if(I&&t===void 0){const s=e!==void 0&&e.length===1;s&&(t=V.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&V.set(e,t))}return t}toString(){return this.cssText}};const ot=r=>new tt(typeof r=="string"?r:r+"",void 0,B),Pt=(r,...t)=>{const e=r.length===1?r[0]:t.reduce((s,i,o)=>s+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[o+1],r[0]);return new tt(e,r,B)},ht=(r,t)=>{if(I)r.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const e of t){const s=document.createElement("style"),i=H.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,r.appendChild(s)}},W=I?r=>r:r=>r instanceof CSSStyleSheet?(t=>{let e="";for(const s of t.cssRules)e+=s.cssText;return ot(e)})(r):r;/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
@@ -10,10 +10,10 @@
10
10
  * @license
11
11
  * Copyright 2017 Google LLC
12
12
  * SPDX-License-Identifier: BSD-3-Clause
13
- */const w=globalThis,N=w.trustedTypes,Z=N?N.createPolicy("lit-html",{createHTML:r=>r}):void 0,st="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+_,_t=`<${it}>`,g=document,P=()=>g.createComment(""),C=r=>r===null||typeof r!="object"&&typeof r!="function",D=Array.isArray,ft=r=>D(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",k=`[
13
+ */const w=globalThis,N=w.trustedTypes,Z=N?N.createPolicy("lit-html",{createHTML:r=>r}):void 0,st="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,it="?"+_,_t=`<${it}>`,g=document,C=()=>g.createComment(""),U=r=>r===null||typeof r!="object"&&typeof r!="function",D=Array.isArray,ft=r=>D(r)||typeof(r==null?void 0:r[Symbol.iterator])=="function",k=`[
14
14
  \f\r]`,S=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,F=/-->/g,J=/>/g,A=RegExp(`>|${k}(?:([^\\s"'>=/]+)(${k}*=${k}*(?:[^
15
- \f\r"'\`<>=]|("|')|))|$)`,"g"),G=/'/g,Q=/"/g,rt=/^(?:script|style|textarea|title)$/i,At=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Ct=At(1),v=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Y=new WeakMap,m=g.createTreeWalker(g,129);function nt(r,t){if(!D(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Z!==void 0?Z.createHTML(t):t}const mt=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=S;for(let l=0;l<e;l++){const h=r[l];let c,p,a=-1,u=0;for(;u<h.length&&(n.lastIndex=u,p=n.exec(h),p!==null);)u=n.lastIndex,n===S?p[1]==="!--"?n=F:p[1]!==void 0?n=J:p[2]!==void 0?(rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=A):p[3]!==void 0&&(n=A):n===A?p[0]===">"?(n=i??S,a=-1):p[1]===void 0?a=-2:(a=n.lastIndex-p[2].length,c=p[1],n=p[3]===void 0?A:p[3]==='"'?Q:G):n===Q||n===G?n=A:n===F||n===J?n=S:(n=A,i=void 0);const $=n===A&&r[l+1].startsWith("/>")?" ":"";o+=n===S?h+_t:a>=0?(s.push(c),h.slice(0,a)+st+h.slice(a)+_+$):h+_+(a===-2?l:$)}return[nt(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class U{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const l=t.length-1,h=this.parts,[c,p]=mt(t,e);if(this.el=U.createElement(c,s),m.currentNode=this.el.content,e===2||e===3){const a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(i=m.nextNode())!==null&&h.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const a of i.getAttributeNames())if(a.endsWith(st)){const u=p[n++],$=i.getAttribute(a).split(_),O=/([.?@])?(.*)/.exec(u);h.push({type:1,index:o,name:O[2],strings:$,ctor:O[1]==="."?yt:O[1]==="?"?vt:O[1]==="@"?Et:R}),i.removeAttribute(a)}else a.startsWith(_)&&(h.push({type:6,index:o}),i.removeAttribute(a));if(rt.test(i.tagName)){const a=i.textContent.split(_),u=a.length-1;if(u>0){i.textContent=N?N.emptyScript:"";for(let $=0;$<u;$++)i.append(a[$],P()),m.nextNode(),h.push({type:2,index:++o});i.append(a[u],P())}}}else if(i.nodeType===8)if(i.data===it)h.push({type:2,index:o});else{let a=-1;for(;(a=i.data.indexOf(_,a+1))!==-1;)h.push({type:7,index:o}),a+=_.length-1}o++}}static createElement(t,e){const s=g.createElement("template");return s.innerHTML=t,s}}function E(r,t,e=r,s){var n,l;if(t===v)return t;let i=s!==void 0?(n=e.o)==null?void 0:n[s]:e.l;const o=C(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((l=i==null?void 0:i._$AO)==null||l.call(i,!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e.o??(e.o=[]))[s]=i:e.l=i),i!==void 0&&(t=E(r,i._$AS(r,t.values),i,s)),t}class gt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??g).importNode(e,!0);m.currentNode=i;let o=m.nextNode(),n=0,l=0,h=s[0];for(;h!==void 0;){if(n===h.index){let c;h.type===2?c=new x(o,o.nextSibling,this,t):h.type===1?c=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(c=new St(o,this,t)),this._$AV.push(c),h=s[++l]}n!==(h==null?void 0:h.index)&&(o=m.nextNode(),n++)}return m.currentNode=g,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class x{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this.v=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=E(this,t,e),C(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==v&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ft(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&C(this._$AH)?this._$AA.nextSibling.data=t:this.T(g.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=U.createElement(nt(s.h,s.h[0]),this.options)),s);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{const n=new gt(i,this),l=n.u(this.options);n.p(e),this.T(l),this._$AH=n}}_$AC(t){let e=Y.get(t.strings);return e===void 0&&Y.set(t.strings,e=new U(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new x(this.O(P()),this.O(P()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=E(this,t,e,0),n=!C(t)||t!==this._$AH&&t!==v,n&&(this._$AH=t);else{const l=t;let h,c;for(t=o[0],h=0;h<o.length-1;h++)c=E(this,l[s+h],e,h),c===v&&(c=this._$AH[h]),n||(n=!C(c)||c!==this._$AH[h]),c===d?t=d:t!==d&&(t+=(c??"")+o[h+1]),this._$AH[h]=c}n&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class yt extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class vt extends R{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Et extends R{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??d)===v)return;const s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class St{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}}const z=w.litHtmlPolyfillSupport;z==null||z(U,x),(w.litHtmlVersions??(w.litHtmlVersions=[])).push("3.2.0");const bt=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new x(t.insertBefore(P(),o),o,void 0,e??{})}return i._$AI(r),i};/**
15
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),G=/'/g,Q=/"/g,rt=/^(?:script|style|textarea|title)$/i,At=r=>(t,...e)=>({_$litType$:r,strings:t,values:e}),Ct=At(1),v=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Y=new WeakMap,m=g.createTreeWalker(g,129);function nt(r,t){if(!D(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Z!==void 0?Z.createHTML(t):t}const mt=(r,t)=>{const e=r.length-1,s=[];let i,o=t===2?"<svg>":t===3?"<math>":"",n=S;for(let l=0;l<e;l++){const h=r[l];let c,p,a=-1,u=0;for(;u<h.length&&(n.lastIndex=u,p=n.exec(h),p!==null);)u=n.lastIndex,n===S?p[1]==="!--"?n=F:p[1]!==void 0?n=J:p[2]!==void 0?(rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),n=A):p[3]!==void 0&&(n=A):n===A?p[0]===">"?(n=i??S,a=-1):p[1]===void 0?a=-2:(a=n.lastIndex-p[2].length,c=p[1],n=p[3]===void 0?A:p[3]==='"'?Q:G):n===Q||n===G?n=A:n===F||n===J?n=S:(n=A,i=void 0);const $=n===A&&r[l+1].startsWith("/>")?" ":"";o+=n===S?h+_t:a>=0?(s.push(c),h.slice(0,a)+st+h.slice(a)+_+$):h+_+(a===-2?l:$)}return[nt(r,o+(r[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]};class x{constructor({strings:t,_$litType$:e},s){let i;this.parts=[];let o=0,n=0;const l=t.length-1,h=this.parts,[c,p]=mt(t,e);if(this.el=x.createElement(c,s),m.currentNode=this.el.content,e===2||e===3){const a=this.el.content.firstChild;a.replaceWith(...a.childNodes)}for(;(i=m.nextNode())!==null&&h.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(const a of i.getAttributeNames())if(a.endsWith(st)){const u=p[n++],$=i.getAttribute(a).split(_),T=/([.?@])?(.*)/.exec(u);h.push({type:1,index:o,name:T[2],strings:$,ctor:T[1]==="."?yt:T[1]==="?"?vt:T[1]==="@"?Et:R}),i.removeAttribute(a)}else a.startsWith(_)&&(h.push({type:6,index:o}),i.removeAttribute(a));if(rt.test(i.tagName)){const a=i.textContent.split(_),u=a.length-1;if(u>0){i.textContent=N?N.emptyScript:"";for(let $=0;$<u;$++)i.append(a[$],C()),m.nextNode(),h.push({type:2,index:++o});i.append(a[u],C())}}}else if(i.nodeType===8)if(i.data===it)h.push({type:2,index:o});else{let a=-1;for(;(a=i.data.indexOf(_,a+1))!==-1;)h.push({type:7,index:o}),a+=_.length-1}o++}}static createElement(t,e){const s=g.createElement("template");return s.innerHTML=t,s}}function E(r,t,e=r,s){var n,l;if(t===v)return t;let i=s!==void 0?(n=e.o)==null?void 0:n[s]:e.l;const o=U(t)?void 0:t._$litDirective$;return(i==null?void 0:i.constructor)!==o&&((l=i==null?void 0:i._$AO)==null||l.call(i,!1),o===void 0?i=void 0:(i=new o(r),i._$AT(r,e,s)),s!==void 0?(e.o??(e.o=[]))[s]=i:e.l=i),i!==void 0&&(t=E(r,i._$AS(r,t.values),i,s)),t}class gt{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){const{el:{content:e},parts:s}=this._$AD,i=((t==null?void 0:t.creationScope)??g).importNode(e,!0);m.currentNode=i;let o=m.nextNode(),n=0,l=0,h=s[0];for(;h!==void 0;){if(n===h.index){let c;h.type===2?c=new O(o,o.nextSibling,this,t):h.type===1?c=new h.ctor(o,h.name,h.strings,this,t):h.type===6&&(c=new St(o,this,t)),this._$AV.push(c),h=s[++l]}n!==(h==null?void 0:h.index)&&(o=m.nextNode(),n++)}return m.currentNode=g,i}p(t){let e=0;for(const s of this._$AV)s!==void 0&&(s.strings!==void 0?(s._$AI(t,s,e),e+=s.strings.length-2):s._$AI(t[e])),e++}}class O{get _$AU(){var t;return((t=this._$AM)==null?void 0:t._$AU)??this.v}constructor(t,e,s,i){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=s,this.options=i,this.v=(i==null?void 0:i.isConnected)??!0}get parentNode(){let t=this._$AA.parentNode;const e=this._$AM;return e!==void 0&&(t==null?void 0:t.nodeType)===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=E(this,t,e),U(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==v&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):ft(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&U(this._$AH)?this._$AA.nextSibling.data=t:this.T(g.createTextNode(t)),this._$AH=t}$(t){var o;const{values:e,_$litType$:s}=t,i=typeof s=="number"?this._$AC(t):(s.el===void 0&&(s.el=x.createElement(nt(s.h,s.h[0]),this.options)),s);if(((o=this._$AH)==null?void 0:o._$AD)===i)this._$AH.p(e);else{const n=new gt(i,this),l=n.u(this.options);n.p(e),this.T(l),this._$AH=n}}_$AC(t){let e=Y.get(t.strings);return e===void 0&&Y.set(t.strings,e=new x(t)),e}k(t){D(this._$AH)||(this._$AH=[],this._$AR());const e=this._$AH;let s,i=0;for(const o of t)i===e.length?e.push(s=new O(this.O(C()),this.O(C()),this,this.options)):s=e[i],s._$AI(o),i++;i<e.length&&(this._$AR(s&&s._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){var s;for((s=this._$AP)==null?void 0:s.call(this,!1,!0,e);t&&t!==this._$AB;){const i=t.nextSibling;t.remove(),t=i}}setConnected(t){var e;this._$AM===void 0&&(this.v=t,(e=this._$AP)==null||e.call(this,t))}}class R{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,s,i,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,s.length>2||s[0]!==""||s[1]!==""?(this._$AH=Array(s.length-1).fill(new String),this.strings=s):this._$AH=d}_$AI(t,e=this,s,i){const o=this.strings;let n=!1;if(o===void 0)t=E(this,t,e,0),n=!U(t)||t!==this._$AH&&t!==v,n&&(this._$AH=t);else{const l=t;let h,c;for(t=o[0],h=0;h<o.length-1;h++)c=E(this,l[s+h],e,h),c===v&&(c=this._$AH[h]),n||(n=!U(c)||c!==this._$AH[h]),c===d?t=d:t!==d&&(t+=(c??"")+o[h+1]),this._$AH[h]=c}n&&!i&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}}class yt extends R{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}}class vt extends R{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}}class Et extends R{constructor(t,e,s,i,o){super(t,e,s,i,o),this.type=5}_$AI(t,e=this){if((t=E(this,t,e,0)??d)===v)return;const s=this._$AH,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,o=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e;typeof this._$AH=="function"?this._$AH.call(((e=this.options)==null?void 0:e.host)??this.element,t):this._$AH.handleEvent(t)}}class St{constructor(t,e,s){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=s}get _$AU(){return this._$AM._$AU}_$AI(t){E(this,t)}}const L=w.litHtmlPolyfillSupport;L==null||L(x,O),(w.litHtmlVersions??(w.litHtmlVersions=[])).push("3.2.0");const bt=(r,t,e)=>{const s=(e==null?void 0:e.renderBefore)??t;let i=s._$litPart$;if(i===void 0){const o=(e==null?void 0:e.renderBefore)??null;s._$litPart$=i=new O(t.insertBefore(C(),o),o,void 0,e??{})}return i._$AI(r),i};/**
16
16
  * @license
17
17
  * Copyright 2017 Google LLC
18
18
  * SPDX-License-Identifier: BSD-3-Clause
19
- */class H extends y{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=bt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return v}}var X;H._$litElement$=!0,H.finalized=!0,(X=globalThis.litElementHydrateSupport)==null||X.call(globalThis,{LitElement:H});const L=globalThis.litElementPolyfillSupport;L==null||L({LitElement:H});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");export{et as f,H as h,Pt as i,Ct as k,j as u};
19
+ */class P extends y{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;const t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){const e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=bt(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this.o)==null||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this.o)==null||t.setConnected(!1)}render(){return v}}var X;P._$litElement$=!0,P.finalized=!0,(X=globalThis.litElementHydrateSupport)==null||X.call(globalThis,{LitElement:P});const z=globalThis.litElementPolyfillSupport;z==null||z({LitElement:P});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");class Ut extends P{createRenderRoot(){return this}}export{Ut as N,et as f,Pt as i,Ct as k,j as u};
@@ -1 +1 @@
1
- import{t as n}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{N as s}from"../../assets/no-shadow-element-BjktO6El.js";var b=Object.getOwnPropertyDescriptor,d=(t,l,o,c)=>{for(var e=c>1?void 0:c?b(l,o):l,a=t.length-1,m;a>=0;a--)(m=t[a])&&(e=m(e)||e);return e};let r=class extends s{connectedCallback(){super.connectedCallback()}render(){}};r=d([n("mealz-catalog-breadcrumb")],r);customElements.get("mealz-catalog-breadcrumb")||customElements.define("mealz-catalog-breadcrumb",r);
1
+ import{t as n}from"../../assets/custom-element-BhZVzxrc.js";import{N as s}from"../../assets/no-shadow-element-Dl16SZ0M.js";var b=Object.getOwnPropertyDescriptor,d=(t,l,o,c)=>{for(var e=c>1?void 0:c?b(l,o):l,a=t.length-1,m;a>=0;a--)(m=t[a])&&(e=m(e)||e);return e};let r=class extends s{connectedCallback(){super.connectedCallback()}render(){}};r=d([n("mealz-catalog-breadcrumb")],r);customElements.get("mealz-catalog-breadcrumb")||customElements.define("mealz-catalog-breadcrumb",r);
@@ -1 +1 @@
1
- import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{C as p}from"../catalog-load-more.min.js";import{h as g}from"../../assets/session-handler-BPS5vj92.js";import"../../assets/no-shadow-element-BjktO6El.js";import"../../assets/async-CN53vnBN.js";var m=Object.getOwnPropertyDescriptor,u=(t,s,o,r)=>{for(var e=r>1?void 0:r?m(s,o):s,a=t.length-1,i;a>=0;a--)(i=t[a])&&(e=i(e)||e);return e};let n=class extends p{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const t=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!t||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{batchSize:s,packageId:o,posId:r,loadMoreURL:e,displayRecipeVariant:a,search:i,sessionId:l,path:d}=JSON.parse(t);g(l),this.analyticsPath=d,this.sendPageViewEvent(),this.loadMoreRecipesOnScroll({displayRecipeVariant:a,loadMoreURL:e,sessionId:l,pageSize:s,storeId:r,packageId:o,search:i,listHTML:this.recipeCardListHTML}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}};n=u([h("mealz-catalog-category")],n);customElements.get("mealz-catalog-category")||customElements.define("mealz-catalog-category",n);
1
+ import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-Dl16SZ0M.js";import{C as g}from"../catalog-load-more.min.js";import{h as p}from"../../assets/session-handler-BPS5vj92.js";import"../../assets/async-CN53vnBN.js";var m=Object.getOwnPropertyDescriptor,u=(t,s,o,r)=>{for(var e=r>1?void 0:r?m(s,o):s,a=t.length-1,i;a>=0;a--)(i=t[a])&&(e=i(e)||e);return e};let n=class extends g{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const t=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!t||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{batchSize:s,packageId:o,posId:r,loadMoreURL:e,displayRecipeVariant:a,search:i,sessionId:l,path:d}=JSON.parse(t);p(l),this.analyticsPath=d,this.sendPageViewEvent(),this.loadMoreRecipesOnScroll({displayRecipeVariant:a,loadMoreURL:e,sessionId:l,pageSize:s,storeId:r,packageId:o,search:i,listHTML:this.recipeCardListHTML}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}};n=u([h("mealz-catalog-category")],n);customElements.get("mealz-catalog-category")||customElements.define("mealz-catalog-category",n);
@@ -1 +1 @@
1
- import{t as u}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{C as g}from"../catalog-load-more.min.js";import{h}from"../../assets/session-handler-BPS5vj92.js";import{o as p,c as m}from"../../assets/async-CN53vnBN.js";import"../../assets/no-shadow-element-BjktO6El.js";function f(e,t){return p(function(s,r){var i=0;s.subscribe(m(r,function(a){return e.call(t,a,i++)&&r.next(a)}))})}function v(e){return f(function(t,s){return e<=s})}var _=Object.getOwnPropertyDescriptor,L=(e,t,s,r)=>{for(var i=r>1?void 0:r?_(t,s):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(i=n(i)||i);return i};let o=class extends g{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.user.isAuthenticated().pipe(v(1)).subscribe(e=>{this.isLogged=e,this.updateDOM()}),this.handleLikedRecipe())}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const e=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!e)return;const{pageSize:t,storeId:s,loadMoreURL:r,displayRecipeVariant:i,search:a,sessionId:n,path:d}=JSON.parse(e);if(this.analyticsPath=d,this.sendPageViewEvent(),this.favorites=this.querySelector(".mealz-catalog-favorites__list"),!this.favorites)return;const l=this.querySelector(".mealz-catalog__list");l&&(h(n),this.loadMoreRecipesOnScroll({displayRecipeVariant:i,loadMoreURL:r,sessionId:n,pageSize:t,storeId:s,packageId:null,search:a,listHTML:l}),this.removeAttribute("starting-data"))}updateDOM(){const e=this.querySelector(".mealz-catalog-favorites__list__not-logged"),t=this.querySelector(".mealz-catalog-favorites__list__logged");!e||!t||(e.classList.toggle("hidden",this.isLogged),t.classList.toggle("hidden",!this.isLogged))}sendPageViewEvent(){var e;window.mealzInternal?((e=window.mealzInternal.analytics)==null||e.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}handleLikedRecipe(){return window.mealzInternal.recipes.recipeLikeUpdated().subscribe(({id:e,isPast:t})=>{const s=document.getElementById("mealz-recipe-card-"+e);s&&s.classList.toggle("hidden",t),this.requestUpdate()})}};o=L([u("mealz-catalog-favorites")],o);customElements.get("mealz-catalog-favorites")||customElements.define("mealz-catalog-favorites",o);
1
+ import{t as u}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-Dl16SZ0M.js";import{C as g}from"../catalog-load-more.min.js";import{h}from"../../assets/session-handler-BPS5vj92.js";import{o as p,c as m}from"../../assets/async-CN53vnBN.js";function f(e,t){return p(function(s,r){var i=0;s.subscribe(m(r,function(a){return e.call(t,a,i++)&&r.next(a)}))})}function v(e){return f(function(t,s){return e<=s})}var _=Object.getOwnPropertyDescriptor,L=(e,t,s,r)=>{for(var i=r>1?void 0:r?_(t,s):t,a=e.length-1,n;a>=0;a--)(n=e[a])&&(i=n(i)||i);return i};let o=class extends g{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.user.isAuthenticated().pipe(v(1)).subscribe(e=>{this.isLogged=e,this.updateDOM()}),this.handleLikedRecipe())}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const e=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!e)return;const{pageSize:t,storeId:s,loadMoreURL:r,displayRecipeVariant:i,search:a,sessionId:n,path:d}=JSON.parse(e);if(this.analyticsPath=d,this.sendPageViewEvent(),this.favorites=this.querySelector(".mealz-catalog-favorites__list"),!this.favorites)return;const l=this.querySelector(".mealz-catalog__list");l&&(h(n),this.loadMoreRecipesOnScroll({displayRecipeVariant:i,loadMoreURL:r,sessionId:n,pageSize:t,storeId:s,packageId:null,search:a,listHTML:l}),this.removeAttribute("starting-data"))}updateDOM(){const e=this.querySelector(".mealz-catalog-favorites__list__not-logged"),t=this.querySelector(".mealz-catalog-favorites__list__logged");!e||!t||(e.classList.toggle("hidden",this.isLogged),t.classList.toggle("hidden",!this.isLogged))}sendPageViewEvent(){var e;window.mealzInternal?((e=window.mealzInternal.analytics)==null||e.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}handleLikedRecipe(){return window.mealzInternal.recipes.recipeLikeUpdated().subscribe(({id:e,isPast:t})=>{const s=document.getElementById("mealz-recipe-card-"+e);s&&s.classList.toggle("hidden",t),this.requestUpdate()})}};o=L([u("mealz-catalog-favorites")],o);customElements.get("mealz-catalog-favorites")||customElements.define("mealz-catalog-favorites",o);
@@ -1 +1 @@
1
- import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{C as m}from"../catalog-load-more.min.js";import{h as u}from"../../assets/session-handler-BPS5vj92.js";import{M as p}from"../../drawer/drawer.min.js";import"../../assets/no-shadow-element-BjktO6El.js";import"../../assets/async-CN53vnBN.js";var w=Object.getOwnPropertyDescriptor,y=(t,r,a,s)=>{for(var e=s>1?void 0:s?w(r,a):r,i=t.length-1,o;i>=0;i--)(o=t[i])&&(e=o(e)||e);return e};let n=class extends m{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const t=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!t||(this.historyOrderListHTML=this.querySelector(".mealz-catalog__list")||this.querySelector(".mealz-catalog__list__row"),!this.historyOrderListHTML))return;const{pageSize:r,storeId:a,loadMoreURL:s,sessionId:e,drawerDataURL:i,historyStyle:o,path:d}=JSON.parse(t);this.analyticsPath=d,u(e),this.sendPageViewEvent(),this.loadMoreRecipesOnScroll({displayRecipeVariant:"",loadMoreURL:s,sessionId:e,pageSize:r,storeId:a,packageId:null,search:"",listHTML:this.historyOrderListHTML,historyStyle:o});const l=new URL(window.location.href).searchParams.get("order");l&&this.initializeDrawer(i,l,e,a),this.removeAttribute("starting-data")}initializeDrawer(t,r,a,s){let e=document.querySelector("mealz-drawer");e||(e=new p,document.body.appendChild(e)),e.openDrawer(),e.loadDrawerData(t,r,a,s)}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}};n=y([h("mealz-catalog-history")],n);customElements.get("mealz-catalog-history")||customElements.define("mealz-catalog-history",n);
1
+ import{t as h}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-Dl16SZ0M.js";import{C as m}from"../catalog-load-more.min.js";import{h as u}from"../../assets/session-handler-BPS5vj92.js";import{M as p}from"../../drawer/drawer.min.js";import"../../assets/async-CN53vnBN.js";var w=Object.getOwnPropertyDescriptor,y=(t,r,a,s)=>{for(var e=s>1?void 0:s?w(r,a):r,i=t.length-1,o;i>=0;i--)(o=t[i])&&(e=o(e)||e);return e};let n=class extends m{constructor(){super(...arguments),this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){var c;const t=(c=this.attributes["starting-data"])==null?void 0:c.value;if(!t||(this.historyOrderListHTML=this.querySelector(".mealz-catalog__list")||this.querySelector(".mealz-catalog__list__row"),!this.historyOrderListHTML))return;const{pageSize:r,storeId:a,loadMoreURL:s,sessionId:e,drawerDataURL:i,historyStyle:o,path:d}=JSON.parse(t);this.analyticsPath=d,u(e),this.sendPageViewEvent(),this.loadMoreRecipesOnScroll({displayRecipeVariant:"",loadMoreURL:s,sessionId:e,pageSize:r,storeId:a,packageId:null,search:"",listHTML:this.historyOrderListHTML,historyStyle:o});const l=new URL(window.location.href).searchParams.get("order");l&&this.initializeDrawer(i,l,e,a),this.removeAttribute("starting-data")}initializeDrawer(t,r,a,s){let e=document.querySelector("mealz-drawer");e||(e=new p,document.body.appendChild(e)),e.openDrawer(),e.loadDrawerData(t,r,a,s)}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}};n=y([h("mealz-catalog-history")],n);customElements.get("mealz-catalog-history")||customElements.define("mealz-catalog-history",n);
@@ -1 +1 @@
1
- .mealz-catalog-home{width:100%;position:relative;background-color:var(--miam-ds-color-neutral-white, #fff)}.mealz-catalog-home .mealz-catalog-home__header{display:flex;height:250px;border-bottom:1px solid var(--miam-ds-color-neutral-200, #D9DDE1)}@media (max-width: 607px){.mealz-catalog-home .mealz-catalog-home__header{flex-direction:column;height:auto}.mealz-catalog-home .mealz-catalog-home__header .mealz-catalog-home__header-right{padding:0}}.mealz-catalog-home .mealz-catalog-home__promotions-banner{display:none;justify-content:center;margin-bottom:24px}.mealz-catalog-home .mealz-catalog-home__header-left{display:flex;justify-content:center;align-items:center;flex:1;max-width:548px}.mealz-catalog-home .mealz-catalog-home__header-left .mealz-catalog__title{font-size:40px;line-height:120%}@media (max-width: 607px){.mealz-catalog-home .mealz-catalog-home__header-left{justify-content:left;padding:16px}.mealz-catalog-home .mealz-catalog-home__header-left .mealz-catalog__title{font-size:24px}}.mealz-catalog-home .mealz-catalog-home__header-right{flex:1;background-repeat:no-repeat;background-size:cover;background-image:url(https://storage.googleapis.com/assets.miam.tech/pictures/catalog_settings/coursesu/2-banner/2-banner_1200x215.jpg)}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom{display:flex;justify-content:space-between;gap:16px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom .mealz-catalog-home__category__link{display:flex;align-items:center;color:var(--miam-ds-color-primary, #24748F);white-space:nowrap;gap:8px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom .mealz-catalog-home__category__link img{width:16px;height:16px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content{position:relative;overflow:hidden;padding:16px 0;width:100%;height:var(--mealz-recipe-card-height, 500px);box-sizing:content-box;display:flex;flex-direction:row;flex-wrap:wrap;transition-duration:.5s;gap:16px}@media (max-width: 1023px){.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content{height:320px;overflow-x:scroll;flex-wrap:nowrap;scrollbar-width:none;-ms-overflow-style:none}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content::-webkit-scrollbar{display:none}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-recipe-card{width:240px;height:320px}}@media (max-width: 1023px){.mealz-catalog-home .mealz-catalog__content{padding:0 0 0 24px}.mealz-catalog-home .mealz-catalog__category-title-container{padding-right:24px}}@media (max-width: 700px){.mealz-catalog-home .mealz-catalog__content{padding:0 0 0 16px}.mealz-catalog-home .mealz-catalog__category-title-container{padding-right:16px}}
1
+ .mealz-catalog-home{width:100%;position:relative;background-color:var(--miam-ds-color-neutral-white, #fff)}.mealz-catalog-home .mealz-catalog-home__promotions-banner{display:none;justify-content:center;margin-bottom:24px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom{display:flex;justify-content:space-between;gap:16px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom .mealz-catalog-home__category__link{display:flex;align-items:center;color:var(--miam-ds-color-primary, #24748F);white-space:nowrap;gap:8px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__header-bottom .mealz-catalog-home__category__link img{width:16px;height:16px}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content{position:relative;overflow:hidden;padding:16px 0;width:100%;height:var(--mealz-recipe-card-height, 500px);box-sizing:content-box;display:flex;flex-direction:row;flex-wrap:wrap;transition-duration:.5s;gap:16px}@media (max-width: 1023px){.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content{height:320px;overflow-x:scroll;flex-wrap:nowrap;scrollbar-width:none;-ms-overflow-style:none}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-catalog-home__category__content::-webkit-scrollbar{display:none}.mealz-catalog-home .mealz-catalog-home__categories .mealz-catalog-home__category .mealz-recipe-card{width:240px;height:320px}}@media (max-width: 1023px){.mealz-catalog-home .mealz-catalog__content{padding:0 0 0 24px}.mealz-catalog-home .mealz-catalog__category-title-container{padding-right:24px}}@media (max-width: 700px){.mealz-catalog-home .mealz-catalog__content{padding:0 0 0 16px}.mealz-catalog-home .mealz-catalog__category-title-container{padding-right:16px}}
@@ -1 +1 @@
1
- import{t as c}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{h as l}from"../../assets/session-handler-BPS5vj92.js";import{N as h}from"../../assets/no-shadow-element-BjktO6El.js";import{V as d}from"../../assets/viewport-listener-BrYUdpmX.js";import"../../assets/async-CN53vnBN.js";var m=Object.getOwnPropertyDescriptor,g=(t,e,s,i)=>{for(var a=i>1?void 0:i?m(e,s):e,r=t.length-1,o;r>=0;r--)(o=t[r])&&(a=o(a)||a);return a};let n=class extends h{constructor(){super(...arguments),this.categories=[],this.viewportListeners=[],this.subscriptions=[],this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe()),this.viewportListeners.forEach(t=>t.disconnect()),this.viewportListeners=[]}render(){var a;const t=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!t)return;const{categories:e,path:s,sessionId:i}=JSON.parse(t);l(i),this.analyticsPath=s,this.categories=e,this.sendPageViewEvent(),this.addEventListeners(),this.listenCategoriesInView(),this.removeAttribute("starting-data")}addEventListeners(){Array.from(this.getElementsByClassName("mealz-catalog__link")).forEach((e,s)=>{e==null||e.addEventListener("click",()=>this.sendCategoryDisplay(s))})}listenCategoriesInView(){Array.from(this.getElementsByClassName("mealz-catalog-home__category")).forEach((e,s)=>{const i=new d(e,()=>this.sendCategoryShow(s),{threshold:.8,debounce:1e3});this.viewportListeners.push(i)})}reloadPage(){location.reload()}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}sendCategoryDisplay(t){var e;window.mealzInternal.analytics.sendEvent("category.display",this.analyticsPath,{category_id:(e=this.categories[Math.floor(t/2)])==null?void 0:e.id})}sendCategoryShow(t){var e;window.mealzInternal.analytics.sendEvent("category.show",this.analyticsPath,{category_id:(e=this.categories[t])==null?void 0:e.id})}};n=g([c("mealz-catalog-home")],n);customElements.get("mealz-catalog-home")||customElements.define("mealz-catalog-home",n);
1
+ import{t as c}from"../../assets/custom-element-BhZVzxrc.js";import{N as l}from"../../assets/no-shadow-element-Dl16SZ0M.js";import{h}from"../../assets/session-handler-BPS5vj92.js";import{V as d}from"../../assets/viewport-listener-BrYUdpmX.js";import"../../assets/async-CN53vnBN.js";var m=Object.getOwnPropertyDescriptor,g=(t,e,s,i)=>{for(var a=i>1?void 0:i?m(e,s):e,r=t.length-1,o;r>=0;r--)(o=t[r])&&(a=o(a)||a);return a};let n=class extends l{constructor(){super(...arguments),this.categories=[],this.viewportListeners=[],this.subscriptions=[],this.retryCount=0,this.maxRetries=30}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe()),this.viewportListeners.forEach(t=>t.disconnect()),this.viewportListeners=[]}render(){var a;const t=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!t)return;const{categories:e,path:s,sessionId:i}=JSON.parse(t);h(i),this.analyticsPath=s,this.categories=e,this.sendPageViewEvent(),this.addEventListeners(),this.listenCategoriesInView(),this.removeAttribute("starting-data")}addEventListeners(){Array.from(this.getElementsByClassName("mealz-catalog__link")).forEach((e,s)=>{e==null||e.addEventListener("click",()=>this.sendCategoryDisplay(s))})}listenCategoriesInView(){Array.from(this.getElementsByClassName("mealz-catalog-home__category")).forEach((e,s)=>{const i=new d(e,()=>this.sendCategoryShow(s),{threshold:.8,debounce:1e3});this.viewportListeners.push(i)})}reloadPage(){location.reload()}sendPageViewEvent(){window.mealzInternal?(window.mealzInternal.analytics.sendEvent("pageview",this.analyticsPath,{}),this.retryCount=0):this.retryCount<this.maxRetries&&(this.retryCount++,setTimeout(()=>this.sendPageViewEvent(),10))}sendCategoryDisplay(t){var e;window.mealzInternal.analytics.sendEvent("category.display",this.analyticsPath,{category_id:(e=this.categories[Math.floor(t/2)])==null?void 0:e.id})}sendCategoryShow(t){var e;window.mealzInternal.analytics.sendEvent("category.show",this.analyticsPath,{category_id:(e=this.categories[t])==null?void 0:e.id})}};n=g([c("mealz-catalog-home")],n);customElements.get("mealz-catalog-home")||customElements.define("mealz-catalog-home",n);
@@ -0,0 +1 @@
1
+ .mealz-catalog-home-header{position:relative;height:124px;overflow:hidden}.mealz-catalog-home-header__image{position:absolute;top:0;left:0;width:100%;height:100%;z-index:1;object-fit:cover}.mealz-catalog-home-header__image:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%;background:linear-gradient(90deg,#0009,#0000 60%);z-index:2;pointer-events:none}.mealz-catalog-home-header__image img{width:100%;height:100%;object-fit:cover;object-position:center}.mealz-catalog-home-header__image-desktop{display:block}.mealz-catalog-home-header__image-mobile{display:none}.mealz-catalog-home-header__content{position:relative;z-index:3;display:flex;justify-content:space-between;align-items:center;height:100%;padding:0 80px}.mealz-catalog-home-header__title{display:flex;justify-content:center;align-items:center;max-width:548px}.mealz-catalog-home-header__title-text{color:#fff;text-shadow:0px 2px 6px rgba(0,0,0,.4)}.mealz-catalog-home-header__banner{display:flex;justify-content:center;height:fit-content;align-items:center;padding:12px;background-color:#fff6;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);border-radius:12px;max-width:224px;text-align:center;border:1px solid rgba(255,255,255,.4);box-sizing:border-box}.mealz-catalog-home-header__banner-content{display:flex;flex-direction:column}.mealz-catalog-home-header__banner-content .mealz-catalog-home-header__banner-subtitle{text-align:left;margin-bottom:8px;overflow:hidden;display:-webkit-box;line-clamp:2;-webkit-line-clamp:2;-webkit-box-orient:vertical;white-space:normal}.mealz-catalog-home-header__banner-content .mealz-catalog-home-header__banner-button{padding:8px 16px;text-decoration:none}@media (max-width: 1023px){.mealz-catalog-home-header__content{padding:0 24px}}@media (max-width: 767px){.mealz-catalog-home-header{height:168px}.mealz-catalog-home-header__image-desktop{display:none}.mealz-catalog-home-header__image-mobile{display:block}.mealz-catalog-home-header__image:after{content:"";position:absolute;left:0;top:0;width:100%;height:100%;background:linear-gradient(to top,#0009,#0000);z-index:2;pointer-events:none}.mealz-catalog-home-header__content{display:flex;flex-direction:column;justify-content:end;height:100%;box-sizing:border-box;padding:8px}.mealz-catalog-home-header__title{width:100%;max-width:100%;justify-content:left;margin-bottom:8px}.mealz-catalog-home-header__title .mealz-catalog-home-header__title-text{font-size:28px;line-height:32px}.mealz-catalog-home-header__title.center{align-items:center;height:100%}.mealz-catalog-home-header__banner{max-width:100%;width:100%;padding:8px}.mealz-catalog-home-header__banner-content{flex-direction:row;justify-content:space-between;align-items:center;width:100%}.mealz-catalog-home-header__banner-content .mealz-catalog-home-header__banner-subtitle{margin-bottom:0;margin-right:8px}.mealz-catalog-home-header__banner-button{min-width:fit-content}}
@@ -1 +1 @@
1
- import{t as d}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{C as p}from"../catalog-load-more.min.js";import{h as m}from"../../assets/session-handler-BPS5vj92.js";import"../../assets/no-shadow-element-BjktO6El.js";import"../../assets/async-CN53vnBN.js";var g=Object.getOwnPropertyDescriptor,u=(t,s,l,r)=>{for(var e=r>1?void 0:r?g(s,l):s,a=t.length-1,i;a>=0;a--)(i=t[a])&&(e=i(e)||e);return e};let o=class extends p{connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback()}render(){var n;const t=(n=this.attributes["starting-data"])==null?void 0:n.value;if(!t||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{pageSize:s,storeId:l,loadMoreURL:r,displayRecipeVariant:e,search:a,promotions:i,sessionId:c}=JSON.parse(t);m(c),this.loadMoreRecipesOnScroll({displayRecipeVariant:e,loadMoreURL:r,sessionId:c,pageSize:s,storeId:l,packageId:null,search:a,listHTML:this.recipeCardListHTML,promotions:i}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}};o=u([d("mealz-catalog-list")],o);customElements.get("mealz-catalog-list")||customElements.define("mealz-catalog-list",o);
1
+ import{t as d}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/no-shadow-element-Dl16SZ0M.js";import{C as p}from"../catalog-load-more.min.js";import{h as m}from"../../assets/session-handler-BPS5vj92.js";import"../../assets/async-CN53vnBN.js";var g=Object.getOwnPropertyDescriptor,u=(t,s,l,r)=>{for(var e=r>1?void 0:r?g(s,l):s,a=t.length-1,i;a>=0;a--)(i=t[a])&&(e=i(e)||e);return e};let o=class extends p{connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>this.reloadPage()))}disconnectedCallback(){super.disconnectedCallback()}render(){var n;const t=(n=this.attributes["starting-data"])==null?void 0:n.value;if(!t||(this.recipeCardListHTML=this.querySelector(".mealz-catalog__list"),!this.recipeCardListHTML))return;const{pageSize:s,storeId:l,loadMoreURL:r,displayRecipeVariant:e,search:a,promotions:i,sessionId:c}=JSON.parse(t);m(c),this.loadMoreRecipesOnScroll({displayRecipeVariant:e,loadMoreURL:r,sessionId:c,pageSize:s,storeId:l,packageId:null,search:a,listHTML:this.recipeCardListHTML,promotions:i}),this.removeAttribute("starting-data")}reloadPage(){location.reload()}};o=u([d("mealz-catalog-list")],o);customElements.get("mealz-catalog-list")||customElements.define("mealz-catalog-list",o);
@@ -1 +1 @@
1
- import{N as D}from"../assets/no-shadow-element-BjktO6El.js";import{i as h,a as R,_ as H,b as A,d as x,O as v,r as z,e as P,f as G,g as N,o as k,c as w,h as V,j as C,k as $,l as q}from"../assets/async-CN53vnBN.js";import"../assets/lit-element-CNB4fo5J.js";function B(e){return e&&h(e.schedule)}var T=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function F(e){return h(e==null?void 0:e.then)}function U(e){return h(e[R])}function Y(e){return Symbol.asyncIterator&&h(e==null?void 0:e[Symbol.asyncIterator])}function j(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function J(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Q=J();function K(e){return h(e==null?void 0:e[Q])}function W(e){return H(this,arguments,function(){var t,r,o,a;return A(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,x(t.read())];case 3:return r=i.sent(),o=r.value,a=r.done,a?[4,x(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,x(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function X(e){return h(e==null?void 0:e.getReader)}function L(e){if(e instanceof v)return e;if(e!=null){if(U(e))return Z(e);if(T(e))return ee(e);if(F(e))return ne(e);if(Y(e))return _(e);if(K(e))return te(e);if(X(e))return re(e)}throw j(e)}function Z(e){return new v(function(n){var t=e[R]();if(h(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ee(e){return new v(function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()})}function ne(e){return new v(function(n){e.then(function(t){n.closed||(n.next(t),n.complete())},function(t){return n.error(t)}).then(null,z)})}function te(e){return new v(function(n){var t,r;try{for(var o=P(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(n.next(i),n.closed)return}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}n.complete()})}function _(e){return new v(function(n){oe(e,n).catch(function(t){return n.error(t)})})}function re(e){return _(W(e))}function oe(e,n){var t,r,o,a;return G(this,void 0,void 0,function(){var i,c;return A(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),t=N(e),s.label=1;case 1:return[4,t.next()];case 2:if(r=s.sent(),!!r.done)return[3,4];if(i=r.value,n.next(i),n.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=s.sent(),o={error:c},[3,11];case 6:return s.trys.push([6,,9,10]),r&&!r.done&&(a=t.return)?[4,a.call(t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})}function ae(e){return e instanceof Date&&!isNaN(e)}function S(e,n){return k(function(t,r){var o=0;t.subscribe(w(r,function(a){r.next(e.call(n,a,o++))}))})}var ie=Array.isArray;function se(e,n){return ie(n)?e.apply(void 0,V([],C(n))):e(n)}function le(e){return S(function(n){return se(e,n)})}function ue(e,n,t,r,o,a,i,c){var s=[],u=0,d=0,l=!1,f=function(){l&&!s.length&&!u&&n.complete()},p=function(y){return u<r?E(y):s.push(y)},E=function(y){u++;var g=!1;L(t(y,d++)).subscribe(w(n,function(m){n.next(m)},function(){g=!0},void 0,function(){if(g)try{u--;for(var m=function(){var I=s.shift();i||E(I)};s.length&&u<r;)m();f()}catch(I){n.error(I)}}))};return e.subscribe(w(n,p,function(){l=!0,f()})),function(){}}function O(e,n,t){return t===void 0&&(t=1/0),h(n)?O(function(r,o){return S(function(a,i){return n(r,a,o,i)})(L(e(r,o)))},t):(typeof n=="number"&&(t=n),k(function(r,o){return ue(r,o,e,t)}))}var ce=["addListener","removeListener"],fe=["addEventListener","removeEventListener"],de=["on","off"];function b(e,n,t,r){if(h(t)&&(r=t,t=void 0),r)return b(e,n,t).pipe(le(r));var o=C(ve(e)?fe.map(function(c){return function(s){return e[c](n,s,t)}}):he(e)?ce.map(M(e,n)):me(e)?de.map(M(e,n)):[],2),a=o[0],i=o[1];if(!a&&T(e))return O(function(c){return b(c,n,t)})(L(e));if(!a)throw new TypeError("Invalid event target");return new v(function(c){var s=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];return c.next(1<u.length?u:u[0])};return a(s),function(){return i(s)}})}function M(e,n){return function(t){return function(r){return e[t](n,r)}}}function he(e){return h(e.addListener)&&h(e.removeListener)}function me(e){return h(e.on)&&h(e.off)}function ve(e){return h(e.addEventListener)&&h(e.removeEventListener)}function pe(e,n,t){t===void 0&&(t=$);var r=-1;return n!=null&&(B(n)?t=n:r=n),new v(function(o){var a=ae(e)?+e-t.now():e;a<0&&(a=0);var i=0;return t.schedule(function(){o.closed||(o.next(i++),0<=r?this.schedule(void 0,r):o.complete())},a)})}function ye(e,n){return k(function(t,r){var o=n??{},a=o.leading,i=a===void 0?!0:a,c=o.trailing,s=c===void 0?!1:c,u=!1,d=null,l=null,f=!1,p=function(){l==null||l.unsubscribe(),l=null,s&&(g(),f&&r.complete())},E=function(){l=null,f&&r.complete()},y=function(m){return l=L(e(m)).subscribe(w(r,p,E))},g=function(){if(u){u=!1;var m=d;d=null,r.next(m),!f&&y(m)}};t.subscribe(w(r,function(m){u=!0,d=m,!(l&&!l.closed)&&(i?g():y(m))},function(){f=!0,!(s&&u&&l&&!l.closed)&&r.complete()}))})}function ge(e,n,t){n===void 0&&(n=q);var r=pe(e,n);return ye(function(){return r},t)}const we=300;class xe extends D{constructor(){super(...arguments),this.noMoreData=!1,this.isLoading=!1,this.page=2,this.loaderElement=null,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.createLoader()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(n=>n.unsubscribe()),this.removeLoader()}loadMoreRecipesOnScroll({displayRecipeVariant:n,loadMoreURL:t,sessionId:r,pageSize:o,storeId:a,packageId:i,search:c,listHTML:s,promotions:u=!1,historyStyle:d=""}){const l=b(window,"scroll");this.subscriptions.push(l.pipe(ge(100)).subscribe(()=>{const f=this.getBoundingClientRect(),p=f.bottom>0&&f.bottom<=window.innerHeight+we;!this.noMoreData&&!this.isLoading&&p&&this.getMoreRecipes({loadMoreURL:t,sessionId:r,pageSize:o,storeId:a,displayRecipeVariant:n,packageId:i,search:c,promotions:u,listHTML:s,historyStyle:d})}))}buildHeaders(n){const t={"language-id":window.mealzInternal.user.getLanguage(),"supplier-token":window.mealzInternal.supplier.getToken(),"session-id":n},r=localStorage.getItem("_miam/userId");return r?t.authorization=`user_id ${r}`:t["authless-id"]=localStorage.getItem("_miam/authlessId"),t}async getMoreRecipes({loadMoreURL:n,sessionId:t,pageSize:r,storeId:o,displayRecipeVariant:a,packageId:i,search:c,promotions:s,listHTML:u,historyStyle:d=""}){if(this.checkIfMoreRecipes(u.innerHTML,r),this.noMoreData||this.isLoading)return;this.isLoading=!0,this.toggleLoader(!0);const l=new URLSearchParams;l.append("size",r.toString()),l.append("page",this.page.toString()),a&&l.append("display_recipe_variant",a),i&&l.append("category_id",i),o&&l.append("store_id",o),c&&l.append("search",c),s&&l.append("promotions",s),d&&l.append("history_style",d);try{const f=await fetch(n+"?"+l,{method:"GET",headers:this.buildHeaders(t)});if(!f.ok)throw new Error(`Load more request failed with status: ${f.status}`);const p=await f.text();this.appendRecipesToList(p,u,r)}catch(f){console.error(f),this.isLoading=!1}}appendRecipesToList(n,t,r){this.checkIfMoreRecipes(n,r),t.insertAdjacentHTML("beforeend",n),this.isLoading=!1,this.toggleLoader(!1),this.page++}checkIfMoreRecipes(n,t){const r=n.match(/<mealz-recipe-card(?=\s|>)/gi)||n.match(/<mealz-history-order(?=\s|>)/gi)||n.match(/<mealz-history-order-expanded(?=\s|>)/gi);(r?r.length:0)<t&&(this.noMoreData=!0)}createLoader(){const n=this.querySelector(".mealz-catalog__content");!this.loaderElement&&n&&(this.loaderElement=document.createElement("div"),this.loaderElement.className="miam-ds-loader",this.loaderElement.style.display="none",n.appendChild(this.loaderElement))}removeLoader(){this.loaderElement&&this.loaderElement.parentElement&&(this.loaderElement.parentElement.removeChild(this.loaderElement),this.loaderElement=null)}toggleLoader(n){this.loaderElement&&(this.loaderElement.style.display=n?"block":"none")}}export{xe as C};
1
+ import{N as D}from"../assets/no-shadow-element-Dl16SZ0M.js";import{i as h,a as R,_ as H,b as A,d as x,O as v,r as z,e as P,f as G,g as N,o as k,c as w,h as V,j as C,k as $,l as q}from"../assets/async-CN53vnBN.js";function B(e){return e&&h(e.schedule)}var T=function(e){return e&&typeof e.length=="number"&&typeof e!="function"};function F(e){return h(e==null?void 0:e.then)}function U(e){return h(e[R])}function Y(e){return Symbol.asyncIterator&&h(e==null?void 0:e[Symbol.asyncIterator])}function j(e){return new TypeError("You provided "+(e!==null&&typeof e=="object"?"an invalid object":"'"+e+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function J(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var Q=J();function K(e){return h(e==null?void 0:e[Q])}function W(e){return H(this,arguments,function(){var t,r,o,a;return A(this,function(i){switch(i.label){case 0:t=e.getReader(),i.label=1;case 1:i.trys.push([1,,9,10]),i.label=2;case 2:return[4,x(t.read())];case 3:return r=i.sent(),o=r.value,a=r.done,a?[4,x(void 0)]:[3,5];case 4:return[2,i.sent()];case 5:return[4,x(o)];case 6:return[4,i.sent()];case 7:return i.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function X(e){return h(e==null?void 0:e.getReader)}function L(e){if(e instanceof v)return e;if(e!=null){if(U(e))return Z(e);if(T(e))return ee(e);if(F(e))return ne(e);if(Y(e))return _(e);if(K(e))return te(e);if(X(e))return re(e)}throw j(e)}function Z(e){return new v(function(n){var t=e[R]();if(h(t.subscribe))return t.subscribe(n);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function ee(e){return new v(function(n){for(var t=0;t<e.length&&!n.closed;t++)n.next(e[t]);n.complete()})}function ne(e){return new v(function(n){e.then(function(t){n.closed||(n.next(t),n.complete())},function(t){return n.error(t)}).then(null,z)})}function te(e){return new v(function(n){var t,r;try{for(var o=P(e),a=o.next();!a.done;a=o.next()){var i=a.value;if(n.next(i),n.closed)return}}catch(c){t={error:c}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(t)throw t.error}}n.complete()})}function _(e){return new v(function(n){oe(e,n).catch(function(t){return n.error(t)})})}function re(e){return _(W(e))}function oe(e,n){var t,r,o,a;return G(this,void 0,void 0,function(){var i,c;return A(this,function(s){switch(s.label){case 0:s.trys.push([0,5,6,11]),t=N(e),s.label=1;case 1:return[4,t.next()];case 2:if(r=s.sent(),!!r.done)return[3,4];if(i=r.value,n.next(i),n.closed)return[2];s.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return c=s.sent(),o={error:c},[3,11];case 6:return s.trys.push([6,,9,10]),r&&!r.done&&(a=t.return)?[4,a.call(t)]:[3,8];case 7:s.sent(),s.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return n.complete(),[2]}})})}function ae(e){return e instanceof Date&&!isNaN(e)}function S(e,n){return k(function(t,r){var o=0;t.subscribe(w(r,function(a){r.next(e.call(n,a,o++))}))})}var ie=Array.isArray;function se(e,n){return ie(n)?e.apply(void 0,V([],C(n))):e(n)}function le(e){return S(function(n){return se(e,n)})}function ue(e,n,t,r,o,a,i,c){var s=[],u=0,d=0,l=!1,f=function(){l&&!s.length&&!u&&n.complete()},p=function(y){return u<r?E(y):s.push(y)},E=function(y){u++;var g=!1;L(t(y,d++)).subscribe(w(n,function(m){n.next(m)},function(){g=!0},void 0,function(){if(g)try{u--;for(var m=function(){var I=s.shift();i||E(I)};s.length&&u<r;)m();f()}catch(I){n.error(I)}}))};return e.subscribe(w(n,p,function(){l=!0,f()})),function(){}}function O(e,n,t){return t===void 0&&(t=1/0),h(n)?O(function(r,o){return S(function(a,i){return n(r,a,o,i)})(L(e(r,o)))},t):(typeof n=="number"&&(t=n),k(function(r,o){return ue(r,o,e,t)}))}var ce=["addListener","removeListener"],fe=["addEventListener","removeEventListener"],de=["on","off"];function b(e,n,t,r){if(h(t)&&(r=t,t=void 0),r)return b(e,n,t).pipe(le(r));var o=C(ve(e)?fe.map(function(c){return function(s){return e[c](n,s,t)}}):he(e)?ce.map(M(e,n)):me(e)?de.map(M(e,n)):[],2),a=o[0],i=o[1];if(!a&&T(e))return O(function(c){return b(c,n,t)})(L(e));if(!a)throw new TypeError("Invalid event target");return new v(function(c){var s=function(){for(var u=[],d=0;d<arguments.length;d++)u[d]=arguments[d];return c.next(1<u.length?u:u[0])};return a(s),function(){return i(s)}})}function M(e,n){return function(t){return function(r){return e[t](n,r)}}}function he(e){return h(e.addListener)&&h(e.removeListener)}function me(e){return h(e.on)&&h(e.off)}function ve(e){return h(e.addEventListener)&&h(e.removeEventListener)}function pe(e,n,t){t===void 0&&(t=$);var r=-1;return n!=null&&(B(n)?t=n:r=n),new v(function(o){var a=ae(e)?+e-t.now():e;a<0&&(a=0);var i=0;return t.schedule(function(){o.closed||(o.next(i++),0<=r?this.schedule(void 0,r):o.complete())},a)})}function ye(e,n){return k(function(t,r){var o=n??{},a=o.leading,i=a===void 0?!0:a,c=o.trailing,s=c===void 0?!1:c,u=!1,d=null,l=null,f=!1,p=function(){l==null||l.unsubscribe(),l=null,s&&(g(),f&&r.complete())},E=function(){l=null,f&&r.complete()},y=function(m){return l=L(e(m)).subscribe(w(r,p,E))},g=function(){if(u){u=!1;var m=d;d=null,r.next(m),!f&&y(m)}};t.subscribe(w(r,function(m){u=!0,d=m,!(l&&!l.closed)&&(i?g():y(m))},function(){f=!0,!(s&&u&&l&&!l.closed)&&r.complete()}))})}function ge(e,n,t){n===void 0&&(n=q);var r=pe(e,n);return ye(function(){return r},t)}const we=300;class Ie extends D{constructor(){super(...arguments),this.noMoreData=!1,this.isLoading=!1,this.page=2,this.loaderElement=null,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.createLoader()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(n=>n.unsubscribe()),this.removeLoader()}loadMoreRecipesOnScroll({displayRecipeVariant:n,loadMoreURL:t,sessionId:r,pageSize:o,storeId:a,packageId:i,search:c,listHTML:s,promotions:u=!1,historyStyle:d=""}){const l=b(window,"scroll");this.subscriptions.push(l.pipe(ge(100)).subscribe(()=>{const f=this.getBoundingClientRect(),p=f.bottom>0&&f.bottom<=window.innerHeight+we;!this.noMoreData&&!this.isLoading&&p&&this.getMoreRecipes({loadMoreURL:t,sessionId:r,pageSize:o,storeId:a,displayRecipeVariant:n,packageId:i,search:c,promotions:u,listHTML:s,historyStyle:d})}))}buildHeaders(n){const t={"language-id":window.mealzInternal.user.getLanguage(),"supplier-token":window.mealzInternal.supplier.getToken(),"session-id":n},r=localStorage.getItem("_miam/userId");return r?t.authorization=`user_id ${r}`:t["authless-id"]=localStorage.getItem("_miam/authlessId"),t}async getMoreRecipes({loadMoreURL:n,sessionId:t,pageSize:r,storeId:o,displayRecipeVariant:a,packageId:i,search:c,promotions:s,listHTML:u,historyStyle:d=""}){if(this.checkIfMoreRecipes(u.innerHTML,r),this.noMoreData||this.isLoading)return;this.isLoading=!0,this.toggleLoader(!0);const l=new URLSearchParams;l.append("size",r.toString()),l.append("page",this.page.toString()),a&&l.append("display_recipe_variant",a),i&&l.append("category_id",i),o&&l.append("store_id",o),c&&l.append("search",c),s&&l.append("promotions",s),d&&l.append("history_style",d);try{const f=await fetch(n+"?"+l,{method:"GET",headers:this.buildHeaders(t)});if(!f.ok)throw new Error(`Load more request failed with status: ${f.status}`);const p=await f.text();this.appendRecipesToList(p,u,r)}catch(f){console.error(f),this.isLoading=!1}}appendRecipesToList(n,t,r){this.checkIfMoreRecipes(n,r),t.insertAdjacentHTML("beforeend",n),this.isLoading=!1,this.toggleLoader(!1),this.page++}checkIfMoreRecipes(n,t){const r=n.match(/<mealz-recipe-card(?=\s|>)/gi)||n.match(/<mealz-history-order(?=\s|>)/gi)||n.match(/<mealz-history-order-expanded(?=\s|>)/gi);(r?r.length:0)<t&&(this.noMoreData=!0)}createLoader(){const n=this.querySelector(".mealz-catalog__content");!this.loaderElement&&n&&(this.loaderElement=document.createElement("div"),this.loaderElement.className="miam-ds-loader",this.loaderElement.style.display="none",n.appendChild(this.loaderElement))}removeLoader(){this.loaderElement&&this.loaderElement.parentElement&&(this.loaderElement.parentElement.removeChild(this.loaderElement),this.loaderElement=null)}toggleLoader(n){this.loaderElement&&(this.loaderElement.style.display=n?"block":"none")}}export{Ie as C};
@@ -1 +1 @@
1
- import{t as n}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{N as m}from"../../assets/no-shadow-element-BjktO6El.js";var b=Object.getOwnPropertyDescriptor,d=(l,c,r,s)=>{for(var e=s>1?void 0:s?b(c,r):c,a=l.length-1,o;a>=0;a--)(o=l[a])&&(e=o(e)||e);return e};let t=class extends m{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){}};t=d([n("mealz-catalog-tabs")],t);customElements.get("mealz-catalog-tabs")||customElements.define("mealz-catalog-tabs",t);
1
+ import{t as r}from"../../assets/custom-element-BhZVzxrc.js";import{N as m}from"../../assets/no-shadow-element-Dl16SZ0M.js";var b=Object.getOwnPropertyDescriptor,d=(l,c,n,s)=>{for(var e=s>1?void 0:s?b(c,n):c,a=l.length-1,o;a>=0;a--)(o=l[a])&&(e=o(e)||e);return e};let t=class extends m{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){}};t=d([r("mealz-catalog-tabs")],t);customElements.get("mealz-catalog-tabs")||customElements.define("mealz-catalog-tabs",t);
@@ -1 +1 @@
1
- import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{N as c}from"../../assets/no-shadow-element-BjktO6El.js";var h=Object.getOwnPropertyDescriptor,d=(t,e,s,r)=>{for(var a=r>1?void 0:r?h(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(a)||a);return a};let i=class extends c{constructor(){super(...arguments),this.subscriptions=[],this.supplierHeaderHeight=0,this.searchUrl="",this.path=""}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.getStickyHeaderHeight().subscribe(t=>{this.supplierHeaderHeight=t,this.setStickyObserver()}),window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>{const t=this.preferencesButton.querySelector(".mealz-catalog-toolbar__controls__filter-badge"),e=this.preferencesButton.querySelector(".mealz-catalog-toolbar__loader");t&&t.classList.add("hidden"),e&&e.classList.remove("hidden")}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe()),this.toolbarObserver.unobserve(this.anchorElement)}render(){var r;const t=(r=this.attributes["starting-data"])==null?void 0:r.value;if(!t)return;const{searchUrl:e,path:s}=JSON.parse(t);this.searchUrl=e,this.path=s,this.findElementsInDocument(),this.addEveryEventListeners(),this.removeAttribute("starting-data")}firstUpdated(){this.setStickyObserver()}setStickyObserver(){var e;if(this.toolbar=document.querySelector(".mealz-catalog-toolbar"),this.anchorElement=document.querySelector(".mealz-catalog-toolbar__anchor"),!this.anchorElement||!this.toolbar)return;const t={rootMargin:`-${this.supplierHeaderHeight}px 0px 0px 0px`,threshold:1};(e=this.toolbarObserver)==null||e.unobserve(this),setTimeout(()=>this.setStickyToolbarStyle(),50),this.toolbarObserver=new IntersectionObserver(()=>{this.setStickyToolbarStyle()},t),this.toolbarObserver.observe(this.anchorElement)}setStickyToolbarStyle(){const e=this.anchorElement.getBoundingClientRect().top<this.supplierHeaderHeight;this.anchorElement.style.height=e?this.toolbar.clientHeight+"px":"0px",this.toolbar.classList.toggle("sticking",e),this.toolbar.style.top=(e?this.supplierHeaderHeight:0)+"px",this.updateDOM(e)}findElementsInDocument(){this.preferencesButton=this.querySelector(".mealz-catalog-toolbar__controls__preferences"),this.favoritesButton=this.querySelector(".mealz-catalog-toolbar__controls__favorites"),this.searchButton=this.querySelector(".mealz-catalog-toolbar__searchbar-button"),this.searchInput=this.querySelector(".mealz-catalog-toolbar__searchbar-input"),this.backButton=this.querySelector(".mealz-recipe-toolbar__return-button")}addEveryEventListeners(){var t;this.addClickListener(this.preferencesButton,this.openPreferences.bind(this)),this.addClickListener(this.searchButton,this.performSearch.bind(this)),this.addClickListener(this.favoritesButton,this.sendFavoritesDisplay.bind(this)),(t=this.searchInput)==null||t.addEventListener("keypress",e=>{e.key==="Enter"&&this.performSearch()})}addClickListener(t,e){t==null||t.addEventListener("click",s=>{s.stopPropagation(),e()})}performSearch(){const t=this.searchInput.value.trim();if(!t)return;window.mealzInternal.analytics.sendEvent("search",this.path,{search_term:t});const e=this.searchUrl.includes("?")?"&":"?";window.location.href=`${this.searchUrl}${e}search=${encodeURIComponent(t)}`}updateDOM(t){var r;const e=t?["ghost","square"]:["full"],s=t?["full"]:["ghost","square"];this.toggleClasses(this.favoritesButton,e,s),this.toggleClasses(this.preferencesButton,e,s),(r=this.backButton)==null||r.classList.toggle("hidden",!t)}toggleClasses(t,e,s){t==null||t.classList.remove(...s),t==null||t.classList.add(...e)}openPreferences(){window.mealzInternal.analytics.sendEvent("preferences.display",this.path,{}),window.mealzInternal.catalog.openPreferences()}sendFavoritesDisplay(){window.mealzInternal.analytics.sendEvent("liked.display",this.path,{})}};i=d([l("mealz-catalog-toolbar")],i);customElements.get("mealz-catalog-toolbar")||customElements.define("mealz-catalog-toolbar",i);
1
+ import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import{N as c}from"../../assets/no-shadow-element-Dl16SZ0M.js";var h=Object.getOwnPropertyDescriptor,d=(t,e,s,r)=>{for(var a=r>1?void 0:r?h(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=n(a)||a);return a};let i=class extends c{constructor(){super(...arguments),this.subscriptions=[],this.supplierHeaderHeight=0,this.searchUrl="",this.path=""}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealzInternal.getStickyHeaderHeight().subscribe(t=>{this.supplierHeaderHeight=t,this.setStickyObserver()}),window.mealzInternal.catalog.preferencesModalChanged().subscribe(()=>{const t=this.preferencesButton.querySelector(".mealz-catalog-toolbar__controls__filter-badge"),e=this.preferencesButton.querySelector(".mealz-catalog-toolbar__loader");t&&t.classList.add("hidden"),e&&e.classList.remove("hidden")}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe()),this.toolbarObserver.unobserve(this.anchorElement)}render(){var r;const t=(r=this.attributes["starting-data"])==null?void 0:r.value;if(!t)return;const{searchUrl:e,path:s}=JSON.parse(t);this.searchUrl=e,this.path=s,this.findElementsInDocument(),this.addEveryEventListeners(),this.removeAttribute("starting-data")}firstUpdated(){this.setStickyObserver()}setStickyObserver(){var e;if(this.toolbar=document.querySelector(".mealz-catalog-toolbar"),this.anchorElement=document.querySelector(".mealz-catalog-toolbar__anchor"),!this.anchorElement||!this.toolbar)return;const t={rootMargin:`-${this.supplierHeaderHeight}px 0px 0px 0px`,threshold:1};(e=this.toolbarObserver)==null||e.unobserve(this),setTimeout(()=>this.setStickyToolbarStyle(),50),this.toolbarObserver=new IntersectionObserver(()=>{this.setStickyToolbarStyle()},t),this.toolbarObserver.observe(this.anchorElement)}setStickyToolbarStyle(){const e=this.anchorElement.getBoundingClientRect().top<this.supplierHeaderHeight;this.anchorElement.style.height=e?this.toolbar.clientHeight+"px":"0px",this.toolbar.classList.toggle("sticking",e),this.toolbar.style.top=(e?this.supplierHeaderHeight:0)+"px",this.updateDOM(e)}findElementsInDocument(){this.preferencesButton=this.querySelector(".mealz-catalog-toolbar__controls__preferences"),this.favoritesButton=this.querySelector(".mealz-catalog-toolbar__controls__favorites"),this.searchButton=this.querySelector(".mealz-catalog-toolbar__searchbar-button"),this.searchInput=this.querySelector(".mealz-catalog-toolbar__searchbar-input"),this.backButton=this.querySelector(".mealz-recipe-toolbar__return-button")}addEveryEventListeners(){var t;this.addClickListener(this.preferencesButton,this.openPreferences.bind(this)),this.addClickListener(this.searchButton,this.performSearch.bind(this)),this.addClickListener(this.favoritesButton,this.sendFavoritesDisplay.bind(this)),(t=this.searchInput)==null||t.addEventListener("keypress",e=>{e.key==="Enter"&&this.performSearch()})}addClickListener(t,e){t==null||t.addEventListener("click",s=>{s.stopPropagation(),e()})}performSearch(){const t=this.searchInput.value.trim();if(!t)return;window.mealzInternal.analytics.sendEvent("search",this.path,{search_term:t});const e=this.searchUrl.includes("?")?"&":"?";window.location.href=`${this.searchUrl}${e}search=${encodeURIComponent(t)}`}updateDOM(t){var r;const e=t?["ghost","square"]:["full"],s=t?["full"]:["ghost","square"];this.toggleClasses(this.favoritesButton,e,s),this.toggleClasses(this.preferencesButton,e,s),(r=this.backButton)==null||r.classList.toggle("hidden",!t)}toggleClasses(t,e,s){t==null||t.classList.remove(...s),t==null||t.classList.add(...e)}openPreferences(){window.mealzInternal.analytics.sendEvent("preferences.display",this.path,{}),window.mealzInternal.catalog.openPreferences()}sendFavoritesDisplay(){window.mealzInternal.analytics.sendEvent("liked.display",this.path,{})}};i=d([l("mealz-catalog-toolbar")],i);customElements.get("mealz-catalog-toolbar")||customElements.define("mealz-catalog-toolbar",i);
@@ -1 +1 @@
1
- import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import"../../assets/lit-element-CNB4fo5J.js";import{N as u}from"../../assets/no-shadow-element-BjktO6El.js";var c=Object.getOwnPropertyDescriptor,h=(t,e,s,o)=>{for(var i=o>1?void 0:o?c(e,s):e,n=t.length-1,r;n>=0;n--)(r=t[n])&&(i=r(i)||i);return i};let a=class extends u{constructor(){super(...arguments),this.analyticsPath="",this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealz.basket.recipeCount().subscribe(t=>{this.recipesCount=t,this.updateDOM()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}render(){var e;if(this.button=this.querySelector(".mealz-my-meals-button"),!this.button)return;const t=(e=this.attributes["starting-data"])==null?void 0:e.value;if(t){const{path:s}=JSON.parse(t);this.analyticsPath=s,this.removeAttribute("starting-data")}this.button.addEventListener("click",s=>{s.stopPropagation(),this.toggle()})}toggle(){window.mealz.basket.openPreview(this.analyticsPath)}updateDOM(){var e;if(!this.button)return;this.recipesCount?this.button.classList.remove("hidden"):this.button.classList.add("hidden");const t=(e=this.button.querySelector(".mealz-my-meals-button__text"))==null?void 0:e.firstElementChild;t&&(t.innerHTML=`${this.recipesCount||0}`)}};a=h([l("mealz-my-meals-button")],a);customElements.get("mealz-my-meals-button")||customElements.define("mealz-my-meals-button",a);
1
+ import{t as l}from"../../assets/custom-element-BhZVzxrc.js";import{N as u}from"../../assets/no-shadow-element-Dl16SZ0M.js";var c=Object.getOwnPropertyDescriptor,h=(t,e,s,o)=>{for(var i=o>1?void 0:o?c(e,s):e,n=t.length-1,r;n>=0;n--)(r=t[n])&&(i=r(i)||i);return i};let a=class extends u{constructor(){super(...arguments),this.analyticsPath="",this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.subscriptions.push(window.mealz.basket.recipeCount().subscribe(t=>{this.recipesCount=t,this.updateDOM()}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}render(){var e;if(this.button=this.querySelector(".mealz-my-meals-button"),!this.button)return;const t=(e=this.attributes["starting-data"])==null?void 0:e.value;if(t){const{path:s}=JSON.parse(t);this.analyticsPath=s,this.removeAttribute("starting-data")}this.button.addEventListener("click",s=>{s.stopPropagation(),this.toggle()})}toggle(){window.mealz.basket.openPreview(this.analyticsPath)}updateDOM(){var e;if(!this.button)return;this.recipesCount?this.button.classList.remove("hidden"):this.button.classList.add("hidden");const t=(e=this.button.querySelector(".mealz-my-meals-button__text"))==null?void 0:e.firstElementChild;t&&(t.innerHTML=`${this.recipesCount||0}`)}};a=h([l("mealz-my-meals-button")],a);customElements.get("mealz-my-meals-button")||customElements.define("mealz-my-meals-button",a);
@@ -1,4 +1,4 @@
1
- import{t as d}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{N as c}from"../assets/no-shadow-element-BjktO6El.js";var u=Object.getOwnPropertyDescriptor,h=(e,t,r,s)=>{for(var a=s>1?void 0:s?u(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(a=i(a)||a);return a};let l=class extends c{constructor(){super(...arguments),this.isMealzInternalReady=!1}connectedCallback(){super.connectedCallback(),this.classList.add("hidden"),this.checkMealzInternalStatus()}disconnectedCallback(){super.disconnectedCallback()}render(){this.innerHTML=this.createDrawerHTML(),this.addEventListeners()}checkMealzInternalStatus(e=0){var t,r,s,a;if((r=(t=window.mealzInternal)==null?void 0:t.supplier)!=null&&r.getToken()&&((a=(s=window.mealzInternal)==null?void 0:s.user)!=null&&a.getLanguage())){this.isMealzInternalReady=!0;return}else e>50&&console.warn("Unable to find the supplier token or user language. Please verify the configuration."),setTimeout(()=>this.checkMealzInternalStatus(e+1),100)}createDrawerHTML(){return`
1
+ import{t as d}from"../assets/custom-element-BhZVzxrc.js";import{N as c}from"../assets/no-shadow-element-Dl16SZ0M.js";var u=Object.getOwnPropertyDescriptor,h=(e,t,r,s)=>{for(var a=s>1?void 0:s?u(t,r):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(a=i(a)||a);return a};let l=class extends c{constructor(){super(...arguments),this.isMealzInternalReady=!1}connectedCallback(){super.connectedCallback(),this.classList.add("hidden"),this.checkMealzInternalStatus()}disconnectedCallback(){super.disconnectedCallback()}render(){this.innerHTML=this.createDrawerHTML(),this.addEventListeners()}checkMealzInternalStatus(e=0){var t,r,s,a;if((r=(t=window.mealzInternal)==null?void 0:t.supplier)!=null&&r.getToken()&&((a=(s=window.mealzInternal)==null?void 0:s.user)!=null&&a.getLanguage())){this.isMealzInternalReady=!0;return}else e>50&&console.warn("Unable to find the supplier token or user language. Please verify the configuration."),setTimeout(()=>this.checkMealzInternalStatus(e+1),100)}createDrawerHTML(){return`
2
2
  <div class="mealz-shadow-overlay"></div>
3
3
  <div class="mealz-drawer">
4
4
  <div class="mealz-drawer__header">
@@ -1 +1 @@
1
- import{t as n}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{N as l}from"../assets/no-shadow-element-BjktO6El.js";import{M as c}from"../drawer/drawer.min.js";var h=Object.getOwnPropertyDescriptor,m=(t,e,i,s)=>{for(var a=s>1?void 0:s?h(e,i):e,o=t.length-1,r;o>=0;o--)(r=t[o])&&(a=r(a)||a);return a};let d=class extends l{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){var o;if(this.historyOrderHTML=this.querySelector(".mealz-history-order"),!this.historyOrderHTML)return;const t=(o=this.attributes["starting-data"])==null?void 0:o.value;if(!t)return;const{orderId:e,drawerDataURL:i,sessionId:s,storeId:a}=JSON.parse(t);this.historyOrderHTML.addEventListener("click",()=>{this.updateURLWithOrder(e);let r=document.querySelector("mealz-drawer");r||(r=new c,document.body.appendChild(r)),r.openDrawer(),r.loadDrawerData(i,e,s,a)}),this.removeAttribute("starting-data")}updateURLWithOrder(t){const e=new URL(window.location.href);e.searchParams.set("order",t),window.history.pushState({},"",e.toString())}};d=m([n("mealz-history-order")],d);customElements.get("mealz-history-order")||customElements.define("mealz-history-order",d);
1
+ import{t as n}from"../assets/custom-element-BhZVzxrc.js";import{N as l}from"../assets/no-shadow-element-Dl16SZ0M.js";import{M as c}from"../drawer/drawer.min.js";var h=Object.getOwnPropertyDescriptor,m=(t,e,d,o)=>{for(var a=o>1?void 0:o?h(e,d):e,s=t.length-1,r;s>=0;s--)(r=t[s])&&(a=r(a)||a);return a};let i=class extends l{connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback()}render(){var s;if(this.historyOrderHTML=this.querySelector(".mealz-history-order"),!this.historyOrderHTML)return;const t=(s=this.attributes["starting-data"])==null?void 0:s.value;if(!t)return;const{orderId:e,drawerDataURL:d,sessionId:o,storeId:a}=JSON.parse(t);this.historyOrderHTML.addEventListener("click",()=>{this.updateURLWithOrder(e);let r=document.querySelector("mealz-drawer");r||(r=new c,document.body.appendChild(r)),r.openDrawer(),r.loadDrawerData(d,e,o,a)}),this.removeAttribute("starting-data")}updateURLWithOrder(t){const e=new URL(window.location.href);e.searchParams.set("order",t),window.history.pushState({},"",e.toString())}};i=m([n("mealz-history-order")],i);customElements.get("mealz-history-order")||customElements.define("mealz-history-order",i);
@@ -1 +1 @@
1
- import{t as d}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{N as l}from"../assets/no-shadow-element-BjktO6El.js";var p=Object.getOwnPropertyDescriptor,m=(r,s,a,i)=>{for(var t=i>1?void 0:i?p(s,a):s,e=r.length-1,o;e>=0;e--)(o=r[e])&&(t=o(t)||t);return t};let n=class extends l{render(){var a;this.recipesElements=Array.from(this.querySelectorAll(".mealz-history-order-expanded__recipe"));const r=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!r)return;const{recipesInfos:s}=JSON.parse(r);this.recipesElements.forEach((i,t)=>{i.addEventListener("click",()=>{const e=JSON.parse(s[t].startingData);window.mealzInternal.recipes.openDetails(e.id,e.guests,e.initialTabIndex)})}),this.removeAttribute("starting-data")}};n=m([d("mealz-history-order-expanded")],n);customElements.get("mealz-history-order-expanded")||customElements.define("mealz-history-order-expanded",n);
1
+ import{t as d}from"../assets/custom-element-BhZVzxrc.js";import{N as l}from"../assets/no-shadow-element-Dl16SZ0M.js";var p=Object.getOwnPropertyDescriptor,c=(r,s,a,i)=>{for(var t=i>1?void 0:i?p(s,a):s,e=r.length-1,o;e>=0;e--)(o=r[e])&&(t=o(t)||t);return t};let n=class extends l{render(){var a;this.recipesElements=Array.from(this.querySelectorAll(".mealz-history-order-expanded__recipe"));const r=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!r)return;const{recipesInfos:s}=JSON.parse(r);this.recipesElements.forEach((i,t)=>{i.addEventListener("click",()=>{const e=JSON.parse(s[t].startingData);window.mealzInternal.recipes.openDetails(e.id,e.guests,e.initialTabIndex)})}),this.removeAttribute("starting-data")}};n=c([d("mealz-history-order-expanded")],n);customElements.get("mealz-history-order-expanded")||customElements.define("mealz-history-order-expanded",n);
@@ -1 +1 @@
1
- import{N as c}from"../assets/no-shadow-element-BjktO6El.js";import{t as h}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";var o=Object.getOwnPropertyDescriptor,d=(t,i,n,s)=>{for(var e=s>1?void 0:s?o(i,n):i,r=t.length-1,a;r>=0;r--)(a=t[r])&&(e=a(e)||e);return e};let l=class extends c{constructor(){super(...arguments),this.liked=null,this.recipeLikeId="",this.recipeId="",this.analyticsPath="",this.subscriptions=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}render(){this.button=this.querySelector(".mealz-like-button"),this.button&&(this.icon=this.button.querySelector(".mealz-like-button__icon"),this.hearts=Array.from(this.button.querySelectorAll(".mealz-like-button__icon img")),!(!this.icon||!this.hearts)&&(this.getInitialStatus(),this.button.addEventListener("click",t=>{t.stopPropagation(),this.toggle()}),this.subscriptions.push(window.mealzInternal.recipes.recipeLikeUpdated().subscribe(({id:t,isPast:i})=>{t===this.recipeId&&(this.liked=!i,this.updateDOM())}))))}getInitialStatus(){var a;const t=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!t)return;const{id:i,recipeId:n,liked:s,path:e,likeHidden:r}=JSON.parse(t);this.recipeLikeId=i,this.recipeId=n,this.liked=s!==void 0?s:!1,this.analyticsPath=e,r&&this.initHiddenLike(),this.removeAttribute("starting-data")}initHiddenLike(){this.subscriptions.push(window.mealzInternal.recipes.getRecipeLike(this.recipeId).subscribe(t=>{this.recipeLikeId=t.id,this.liked=t.attributes["is-past"]===!1,this.updateDOM(),this.button.classList.remove("hidden")}))}toggle(){window.mealzInternal.recipes.updateRecipeLike(this.recipeLikeId,this.recipeId,this.liked,this.analyticsPath)}updateDOM(){this.icon.classList.toggle("fill",this.liked),this.hearts[0].classList.toggle("active",!this.liked),this.hearts[1].classList.toggle("active",this.liked)}};l=d([h("mealz-like-button")],l);
1
+ import{N as c}from"../assets/no-shadow-element-Dl16SZ0M.js";import{t as h}from"../assets/custom-element-BhZVzxrc.js";var o=Object.getOwnPropertyDescriptor,d=(t,i,n,s)=>{for(var e=s>1?void 0:s?o(i,n):i,r=t.length-1,a;r>=0;r--)(a=t[r])&&(e=a(e)||e);return e};let l=class extends c{constructor(){super(...arguments),this.liked=null,this.recipeLikeId="",this.recipeId="",this.analyticsPath="",this.subscriptions=[]}connectedCallback(){super.connectedCallback()}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(t=>t.unsubscribe())}render(){this.button=this.querySelector(".mealz-like-button"),this.button&&(this.icon=this.button.querySelector(".mealz-like-button__icon"),this.hearts=Array.from(this.button.querySelectorAll(".mealz-like-button__icon img")),!(!this.icon||!this.hearts)&&(this.getInitialStatus(),this.button.addEventListener("click",t=>{t.stopPropagation(),this.toggle()}),this.subscriptions.push(window.mealzInternal.recipes.recipeLikeUpdated().subscribe(({id:t,isPast:i})=>{t===this.recipeId&&(this.liked=!i,this.updateDOM())}))))}getInitialStatus(){var a;const t=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!t)return;const{id:i,recipeId:n,liked:s,path:e,likeHidden:r}=JSON.parse(t);this.recipeLikeId=i,this.recipeId=n,this.liked=s!==void 0?s:!1,this.analyticsPath=e,r&&this.initHiddenLike(),this.removeAttribute("starting-data")}initHiddenLike(){this.subscriptions.push(window.mealzInternal.recipes.getRecipeLike(this.recipeId).subscribe(t=>{this.recipeLikeId=t.id,this.liked=t.attributes["is-past"]===!1,this.updateDOM(),this.button.classList.remove("hidden")}))}toggle(){window.mealzInternal.recipes.updateRecipeLike(this.recipeLikeId,this.recipeId,this.liked,this.analyticsPath)}updateDOM(){this.icon.classList.toggle("fill",this.liked),this.hearts[0].classList.toggle("active",!this.liked),this.hearts[1].classList.toggle("active",this.liked)}};l=d([h("mealz-like-button")],l);
@@ -1 +1 @@
1
- import{N as d}from"../assets/no-shadow-element-BjktO6El.js";import{V as p}from"../assets/viewport-listener-BrYUdpmX.js";import{t as u}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{h as w}from"../assets/session-handler-BPS5vj92.js";import"../assets/async-CN53vnBN.js";class a{constructor(){this.trackedRecipes=new Map,this.hasScrolled=!1,this.scrollListener=null,this.cleanupInterval=null,this.MAX_RECIPES=1e3,this.CLEANUP_INTERVAL=300*1e3,this.handlePageUnload=()=>{this.destroy()},this.setupScrollListener(),this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return a.instance||(a.instance=new a),a.instance}trackRecipeShow(e,s,r){const i=Date.now(),c=!this.trackedRecipes.get(e),l=this.hasScrolled;!c&&!l||(this.trackedRecipes.size>=this.MAX_RECIPES&&this.cleanOldRecipes(),this.trackedRecipes.set(e,i),window.mealzInternal.analytics.sendEvent("recipe.show",s,{recipe_id:e,category_id:r}))}cleanOldRecipes(){const s=Date.now()-3600*1e3;for(const[r,i]of this.trackedRecipes.entries())i<s&&this.trackedRecipes.delete(r)}clearAllRecipes(){this.trackedRecipes.clear()}destroy(){this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener),this.scrollListener=null),window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.trackedRecipes.clear(),this.hasScrolled=!1,a.instance=null}setupScrollListener(){let e;this.scrollListener=()=>{this.hasScrolled=!0,clearTimeout(e),e=window.setTimeout(()=>{this.hasScrolled=!1},2e3)},window.addEventListener("scroll",this.scrollListener)}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldRecipes()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var g=Object.getOwnPropertyDescriptor,m=(t,e,s,r)=>{for(var i=r>1?void 0:r?g(e,s):e,n=t.length-1,c;n>=0;n--)(c=t[n])&&(i=c(i)||i);return i};let o=class extends d{constructor(){super(...arguments),this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.getInitialStatus(),this.listenInView(),this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(t=>{const e=t.find(s=>s.id===this.recipeId);e&&(this.updatedRecipeId=e.id,this.updatedGuests=e.guests,this.updateDOM())}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.subscriptions.forEach(s=>s.unsubscribe()),(e=this.analyticsViewportObserver)==null||e.disconnect(),a.getInstance().cleanOldRecipes()}render(){this.recipeCardTop=this.querySelector(".mealz-recipe-card__top"),this.recipeCardCta=this.querySelector(".mealz-recipe-card__cta"),this.recipeCardTop&&(this.recipeCardTop.addEventListener("click",()=>this.recipeCardTopClick()),this.recipeCardCta&&this.recipeCardCta.addEventListener("click",()=>this.recipeCardCtaClick()))}listenInView(){this.analyticsViewportObserver=new p(this,()=>{this.sendAnalyticsShow()},{threshold:.8,debounce:1e3})}getInitialStatus(){var l;const t=(l=this.attributes["starting-data"])==null?void 0:l.value;if(!t)return;const{id:e,guests:s,path:r,categoryId:i,initialTabIndex:n,sessionId:c}=JSON.parse(t);if(this.recipeId=e,this.analyticsPath=r,this.categoryId=i,this.guests=s,this.initialTabIndex=n,w(c),!s){this.guests=this.getGuests();const h=this.querySelector(".mealz-recipe-card__counter p");h&&(h.innerHTML=this.guests.toString())}this.removeAttribute("starting-data")}recipeCardTopClick(){window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,this.initialTabIndex,this.analyticsPath,this.categoryId)}recipeCardCtaClick(){window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,this.initialTabIndex,this.analyticsPath,this.categoryId)}getGuests(){const t=localStorage.getItem("_miam/preferences/guests");if(t){const e=+t;if(!isNaN(e)&&e>0&&e<=30)return e}return 4}updateDOM(){if(this.recipeId!==this.updatedRecipeId)return;const t=this.querySelector(".mealz-recipe-card__counter p");t&&(this.guests=this.updatedGuests??this.getGuests(),t.innerHTML=this.guests.toString())}sendAnalyticsShow(){a.getInstance().trackRecipeShow(this.recipeId,this.analyticsPath,this.categoryId)}};o=m([u("mealz-recipe-card")],o);customElements.get("mealz-recipe-card")||customElements.define("mealz-recipe-card",o);
1
+ import{N as h}from"../assets/no-shadow-element-Dl16SZ0M.js";import{V as p}from"../assets/viewport-listener-BrYUdpmX.js";import{t as u}from"../assets/custom-element-BhZVzxrc.js";import{h as w}from"../assets/session-handler-BPS5vj92.js";import"../assets/async-CN53vnBN.js";class a{constructor(){this.trackedRecipes=new Map,this.hasScrolled=!1,this.scrollListener=null,this.cleanupInterval=null,this.MAX_RECIPES=1e3,this.CLEANUP_INTERVAL=300*1e3,this.handlePageUnload=()=>{this.destroy()},this.setupScrollListener(),this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return a.instance||(a.instance=new a),a.instance}trackRecipeShow(e,s,r){const i=Date.now(),c=!this.trackedRecipes.get(e),l=this.hasScrolled;!c&&!l||(this.trackedRecipes.size>=this.MAX_RECIPES&&this.cleanOldRecipes(),this.trackedRecipes.set(e,i),window.mealzInternal.analytics.sendEvent("recipe.show",s,{recipe_id:e,category_id:r}))}cleanOldRecipes(){const s=Date.now()-3600*1e3;for(const[r,i]of this.trackedRecipes.entries())i<s&&this.trackedRecipes.delete(r)}clearAllRecipes(){this.trackedRecipes.clear()}destroy(){this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener),this.scrollListener=null),window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.trackedRecipes.clear(),this.hasScrolled=!1,a.instance=null}setupScrollListener(){let e;this.scrollListener=()=>{this.hasScrolled=!0,clearTimeout(e),e=window.setTimeout(()=>{this.hasScrolled=!1},2e3)},window.addEventListener("scroll",this.scrollListener)}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldRecipes()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var I=Object.getOwnPropertyDescriptor,g=(t,e,s,r)=>{for(var i=r>1?void 0:r?I(e,s):e,n=t.length-1,c;n>=0;n--)(c=t[n])&&(i=c(i)||i);return i};let o=class extends h{constructor(){super(...arguments),this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.getInitialStatus(),this.listenInView(),this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(t=>{const e=t.find(s=>s.id===this.recipeId);e&&(this.updatedRecipeId=e.id,this.updatedGuests=e.guests,this.updateDOM())}),window.mealzInternal.recipes.guestsUpdated().subscribe(t=>{t.recipeId===this.recipeId&&(this.updatedGuests=t.guests,this.updatedRecipeId=this.recipeId,this.updateDOM())}))}disconnectedCallback(){var e;super.disconnectedCallback(),this.subscriptions.forEach(s=>s.unsubscribe()),(e=this.analyticsViewportObserver)==null||e.disconnect(),a.getInstance().cleanOldRecipes()}render(){this.recipeCardTop=this.querySelector(".mealz-recipe-card__top"),this.recipeCardCta=this.querySelector(".mealz-recipe-card__cta"),this.recipeCardTop&&(this.recipeCardTop.addEventListener("click",()=>this.recipeCardTopClick()),this.recipeCardCta&&this.recipeCardCta.addEventListener("click",()=>this.recipeCardCtaClick()))}listenInView(){this.analyticsViewportObserver=new p(this,()=>{this.sendAnalyticsShow()},{threshold:.8,debounce:1e3})}getInitialStatus(){var l;const t=(l=this.attributes["starting-data"])==null?void 0:l.value;if(!t)return;const{id:e,guests:s,path:r,categoryId:i,initialTabIndex:n,sessionId:c}=JSON.parse(t);if(this.recipeId=e,this.analyticsPath=r,this.categoryId=i,this.guests=s,this.initialTabIndex=n,w(c),!s){this.guests=this.getGuests();const d=this.querySelector(".mealz-recipe-card__counter p");d&&(d.innerHTML=this.guests.toString())}this.removeAttribute("starting-data")}recipeCardTopClick(){window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,this.initialTabIndex,this.analyticsPath,this.categoryId)}recipeCardCtaClick(){window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,this.initialTabIndex,this.analyticsPath,this.categoryId)}getGuests(){const t=localStorage.getItem("_miam/preferences/guests");if(t){const e=+t;if(!isNaN(e)&&e>0&&e<=30)return e}return 4}updateDOM(){if(this.recipeId!==this.updatedRecipeId)return;const t=this.querySelector(".mealz-recipe-card__counter p");t&&(this.guests=this.updatedGuests??this.getGuests(),t.innerHTML=this.guests.toString())}sendAnalyticsShow(){a.getInstance().trackRecipeShow(this.recipeId,this.analyticsPath,this.categoryId)}};o=g([u("mealz-recipe-card")],o);customElements.get("mealz-recipe-card")||customElements.define("mealz-recipe-card",o);
@@ -1 +1 @@
1
- import{t as l}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{N as d}from"../assets/no-shadow-element-BjktO6El.js";var p=Object.getOwnPropertyDescriptor,o=(e,t,s,i)=>{for(var a=i>1?void 0:i?p(t,s):t,r=e.length-1,c;r>=0;r--)(c=e[r])&&(a=c(a)||a);return a};let n=class extends d{constructor(){super(...arguments),this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.getInitialStatus(),this.setupClickHandler(),this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(e=>{const t=e.map(s=>s.id).includes(this.recipeId);this.updateDOM(t)}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.removeClickHandler()}getInitialStatus(){var t,s;const e=JSON.parse(((t=this.attributes["starting-data"])==null?void 0:t.value)||"{}");if(e){if(e!=null&&e.recipeId)this.recipeId=e.recipeId,this.storeId=e.storeId,this.guests=e.guests,this.standalone=!0,this.inBasket=e.inBasket,this.updateDOM(this.inBasket);else{this.recipeId=(s=this.attributes["starting-data"])==null?void 0:s.value,this.standalone=!1;const i=this.classList.contains("in-basket");this.updateDOM(i)}this.removeAttribute("starting-data")}}setupClickHandler(){this.standalone&&(this.recipeCta=this.querySelector(".mealz-recipe-card-cta"),this.recipeCta&&(this.clickHandler=()=>{window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,0,"/recipes")},this.recipeCta.addEventListener("click",this.clickHandler)))}removeClickHandler(){this.recipeCta&&this.clickHandler&&this.recipeCta.removeEventListener("click",this.clickHandler)}updateDOM(e){const t=this.querySelector(".mealz-recipe-card-cta");t&&(t.classList.remove("hidden"),e?(t.classList.replace("primary","secondary"),t.classList.add("in-basket")):(t.classList.replace("secondary","primary"),t.classList.remove("in-basket")))}};n=o([l("mealz-recipe-card-cta")],n);
1
+ import{t as l}from"../assets/custom-element-BhZVzxrc.js";import{N as d}from"../assets/no-shadow-element-Dl16SZ0M.js";var p=Object.getOwnPropertyDescriptor,h=(e,t,s,i)=>{for(var a=i>1?void 0:i?p(t,s):t,r=e.length-1,c;r>=0;r--)(c=e[r])&&(a=c(a)||a);return a};let n=class extends d{constructor(){super(...arguments),this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.getInitialStatus(),this.setupClickHandler(),this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(e=>{const t=e.map(s=>s.id).includes(this.recipeId);this.updateDOM(t)}))}disconnectedCallback(){super.disconnectedCallback(),this.subscriptions.forEach(e=>e.unsubscribe()),this.removeClickHandler()}getInitialStatus(){var t,s;const e=JSON.parse(((t=this.attributes["starting-data"])==null?void 0:t.value)||"{}");if(e){if(e!=null&&e.recipeId)this.recipeId=e.recipeId,this.storeId=e.storeId,this.guests=e.guests,this.standalone=!0,this.inBasket=e.inBasket,this.updateDOM(this.inBasket);else{this.recipeId=(s=this.attributes["starting-data"])==null?void 0:s.value,this.standalone=!1;const i=this.classList.contains("in-basket");this.updateDOM(i)}this.removeAttribute("starting-data")}}setupClickHandler(){this.standalone&&(this.recipeCta=this.querySelector(".mealz-recipe-card-cta"),this.recipeCta&&(this.clickHandler=()=>{window.mealzInternal.recipes.openDetails(this.recipeId,this.guests,0,"/recipes")},this.recipeCta.addEventListener("click",this.clickHandler)))}removeClickHandler(){this.recipeCta&&this.clickHandler&&this.recipeCta.removeEventListener("click",this.clickHandler)}updateDOM(e){const t=this.querySelector(".mealz-recipe-card-cta");t&&(t.classList.remove("hidden"),e?(t.classList.replace("primary","secondary"),t.classList.add("in-basket")):(t.classList.replace("secondary","primary"),t.classList.remove("in-basket")))}};n=h([l("mealz-recipe-card-cta")],n);
@@ -1 +1 @@
1
- import{N as l}from"../assets/no-shadow-element-BjktO6El.js";import{S as d,V as u}from"../assets/viewport-listener-BrYUdpmX.js";import{t as m}from"../assets/custom-element-BhZVzxrc.js";import"../assets/lit-element-CNB4fo5J.js";import{n as f,O as P,o as p,c as h}from"../assets/async-CN53vnBN.js";var v=function(e){f(i,e);function i(r){var t=e.call(this)||this;return t._value=r,t}return Object.defineProperty(i.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),i.prototype._subscribe=function(r){var t=e.prototype._subscribe.call(this,r);return!t.closed&&r.next(this._value),t},i.prototype.getValue=function(){var r=this,t=r.hasError,s=r.thrownError,c=r._value;if(t)throw s;return this._throwIfClosed(),c},i.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},i}(d),g=new P(function(e){return e.complete()});function I(e){return e<=0?function(){return g}:p(function(i,r){var t=0;i.subscribe(h(r,function(s){++t<=e&&(r.next(s),e<=t&&r.complete())}))})}function y(e){return p(function(i,r){var t=!1,s=0;i.subscribe(h(r,function(c){return(t||(t=!e(c,s++)))&&r.next(c)}))})}class n{constructor(){this.priceMemorized=new Map,this.displayedPrices=new Set,this.cleanupInterval=null,this.MAX_MEMO_SIZE=500,this.CLEANUP_INTERVAL=600*1e3,this.handlePageUnload=()=>{this.destroy()},this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return n.instance||(n.instance=new n),n.instance}getMemorizedPrice(i,r){const t=`${i}-${r}`;return this.priceMemorized.get(t)}memorizedPrice(i,r,t){const s=`${i}-${r}`;this.priceMemorized.size>=this.MAX_MEMO_SIZE&&this.cleanOldPrices(),this.priceMemorized.set(s,{price:t,guests:r})}isPriceDisplayed(i,r){const t=`${i}-${r}`;return this.displayedPrices.has(t)}markPriceAsDisplayed(i,r){const t=`${i}-${r}`;this.displayedPrices.add(t)}cleanOldPrices(){this.priceMemorized.size>this.MAX_MEMO_SIZE*.8&&Array.from(this.priceMemorized.entries()).slice(0,Math.floor(this.priceMemorized.size*.3)).forEach(([t])=>{this.priceMemorized.delete(t),this.displayedPrices.delete(t)})}clearAllPrices(){this.priceMemorized.clear(),this.displayedPrices.clear()}destroy(){window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.priceMemorized.clear(),this.displayedPrices.clear(),n.instance=null}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldPrices()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var b=Object.getOwnPropertyDescriptor,w=(e,i,r,t)=>{for(var s=t>1?void 0:t?b(i,r):i,c=e.length-1,a;c>=0;c--)(a=e[c])&&(s=a(s)||s);return s};let o=class extends l{constructor(){super(...arguments),this.formattedPrice="",this.rendered=new v(!1),this.priceFetched=!1,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.classList.add("re-rendering"),this.getInitialStatus(),this.listenInView(),this.subscriptions.push(window.mealzInternal.recipes.guestsUpdated().subscribe(e=>{e.recipeId===this.recipeId&&(this.serves=e.guests,this.recalculatePrice())}),this.rendered.pipe(y(e=>!e),I(1)).subscribe(()=>{this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(e=>{if(!e)return;const i=e.find(r=>r.id===this.recipeId);e.length>0&&i&&parseFloat(i.price)>0?(this.recipePricingValue=i,this.recalculatePrice()):this.recipePricingValue&&!i&&(this.recipePricingValue=void 0,(this.posId||this.extStoreId)&&this.fetchAndUpdatePrice())}))})),requestAnimationFrame(()=>{this.classList.remove("re-rendering")})}disconnectedCallback(){var e;super.disconnectedCallback(),this.subscriptions.forEach(i=>i.unsubscribe()),(e=this.priceViewportObserver)==null||e.disconnect()}fetchPrice(){const e=n.getInstance(),i=e.getMemorizedPrice(this.recipeId,this.serves);if(i){requestAnimationFrame(()=>{this.applyCurrencyDisplay(i.price),e.markPriceAsDisplayed(this.recipeId,this.serves)});return}this.fetchAndUpdatePrice()}render(){this.recipePricing=this.querySelector(".mealz-recipe-pricing"),this.recipePricing&&(this.recipeId&&this.pricePerServe&&n.getInstance().isPriceDisplayed(this.recipeId,this.serves)&&requestAnimationFrame(()=>{this.applyCurrencyDisplay(this.pricePerServe)}),this.rendered.next(!0))}getInitialStatus(){var a;const e=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!e)return;const{recipeId:i,extStoreId:r,posId:t,pricePerServe:s,serves:c}=JSON.parse(e);this.extStoreId=r,this.posId=t,this.recipeId=i,this.pricePerServe=(s==null?void 0:s.toString())??null,this.serves=c,this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)}applyCurrencyDisplay(e){const i=parseFloat(e);isNaN(i)||(this.formattedPrice=i.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),this.recipePricing||(this.recipePricing=this.querySelector(".mealz-recipe-pricing")),this.updateDOM())}showPrice(){var r,t;const e=(r=this.recipePricing)==null?void 0:r.querySelector(".mealz-recipe-pricing__loading"),i=(t=this.recipePricing)==null?void 0:t.querySelector(".mealz-recipe-pricing__wrapper");e==null||e.classList.replace("active","hidden"),i==null||i.classList.replace("hidden","active")}updateDOM(){var i;const e=(i=this.recipePricing)==null?void 0:i.querySelector(".mealz-recipe-pricing__wrapper__price");e&&(e.innerHTML=this.formattedPrice+" €",this.showPrice())}recalculatePrice(){if(this.recipePricingValue){const e=(parseFloat(this.recipePricingValue.price)/this.recipePricingValue.guests).toString();this.updatePriceDisplay(e,this.recipePricingValue.guests)}}updatePriceDisplay(e,i){requestAnimationFrame(()=>{this.applyCurrencyDisplay(e);const r=n.getInstance();r.memorizedPrice(this.recipeId,i,e),r.markPriceAsDisplayed(this.recipeId,i)})}listenInView(){this.priceViewportObserver=new u(this,()=>{this.priceFetched||(this.priceFetched=!0,this.fetchPrice())})}fetchAndUpdatePrice(){const e=this.posId||this.extStoreId,i=this.extStoreId;if(!e||!this.recipeId||!this.serves)return;const t=window.mealzInternal.recipes.fetchPricing(this.recipeId,e,this.serves,i).subscribe({next:s=>{s&&s["price-per-serve"]&&(this.pricePerServe=s["price-per-serve"].toString(),this.updatePriceDisplay(this.pricePerServe,this.serves))},error:s=>{console.error("Failed to fetch recipe pricing:",s)}});this.subscriptions.push(t)}};o=w([m("mealz-recipe-pricing")],o);
1
+ import{N as l}from"../assets/no-shadow-element-Dl16SZ0M.js";import{S as d,V as u}from"../assets/viewport-listener-BrYUdpmX.js";import{t as m}from"../assets/custom-element-BhZVzxrc.js";import{n as f,O as P,o as p,c as h}from"../assets/async-CN53vnBN.js";var v=function(e){f(i,e);function i(r){var t=e.call(this)||this;return t._value=r,t}return Object.defineProperty(i.prototype,"value",{get:function(){return this.getValue()},enumerable:!1,configurable:!0}),i.prototype._subscribe=function(r){var t=e.prototype._subscribe.call(this,r);return!t.closed&&r.next(this._value),t},i.prototype.getValue=function(){var r=this,t=r.hasError,s=r.thrownError,c=r._value;if(t)throw s;return this._throwIfClosed(),c},i.prototype.next=function(r){e.prototype.next.call(this,this._value=r)},i}(d),g=new P(function(e){return e.complete()});function I(e){return e<=0?function(){return g}:p(function(i,r){var t=0;i.subscribe(h(r,function(s){++t<=e&&(r.next(s),e<=t&&r.complete())}))})}function y(e){return p(function(i,r){var t=!1,s=0;i.subscribe(h(r,function(c){return(t||(t=!e(c,s++)))&&r.next(c)}))})}class n{constructor(){this.priceMemorized=new Map,this.displayedPrices=new Set,this.cleanupInterval=null,this.MAX_MEMO_SIZE=500,this.CLEANUP_INTERVAL=600*1e3,this.handlePageUnload=()=>{this.destroy()},this.startAutoCleanup(),this.setupPageUnloadListener()}static getInstance(){return n.instance||(n.instance=new n),n.instance}getMemorizedPrice(i,r){const t=`${i}-${r}`;return this.priceMemorized.get(t)}memorizedPrice(i,r,t){const s=`${i}-${r}`;this.priceMemorized.size>=this.MAX_MEMO_SIZE&&this.cleanOldPrices(),this.priceMemorized.set(s,{price:t,guests:r})}isPriceDisplayed(i,r){const t=`${i}-${r}`;return this.displayedPrices.has(t)}markPriceAsDisplayed(i,r){const t=`${i}-${r}`;this.displayedPrices.add(t)}cleanOldPrices(){this.priceMemorized.size>this.MAX_MEMO_SIZE*.8&&Array.from(this.priceMemorized.entries()).slice(0,Math.floor(this.priceMemorized.size*.3)).forEach(([t])=>{this.priceMemorized.delete(t),this.displayedPrices.delete(t)})}clearAllPrices(){this.priceMemorized.clear(),this.displayedPrices.clear()}destroy(){window.removeEventListener("beforeunload",this.handlePageUnload),this.cleanupInterval&&(clearInterval(this.cleanupInterval),this.cleanupInterval=null),this.priceMemorized.clear(),this.displayedPrices.clear(),n.instance=null}startAutoCleanup(){this.cleanupInterval=window.setInterval(()=>{this.cleanOldPrices()},this.CLEANUP_INTERVAL)}setupPageUnloadListener(){window.addEventListener("beforeunload",this.handlePageUnload)}}var b=Object.getOwnPropertyDescriptor,w=(e,i,r,t)=>{for(var s=t>1?void 0:t?b(i,r):i,c=e.length-1,a;c>=0;c--)(a=e[c])&&(s=a(s)||s);return s};let o=class extends l{constructor(){super(...arguments),this.formattedPrice="",this.rendered=new v(!1),this.priceFetched=!1,this.subscriptions=[]}connectedCallback(){super.connectedCallback(),this.classList.add("re-rendering"),this.getInitialStatus(),this.listenInView(),this.subscriptions.push(window.mealzInternal.recipes.guestsUpdated().subscribe(e=>{e.recipeId===this.recipeId&&(this.serves=e.guests,this.recalculatePrice(this.recipePricingValue.price,this.serves))}),window.mealzInternal.recipes.recipePriceUpdated().subscribe(e=>{e.recipeId===this.recipeId&&!e.inBasket&&(this.recipePricingValue.price=e.remaining,this.recalculatePrice(e.remaining,this.serves))}),this.rendered.pipe(y(e=>!e),I(1)).subscribe(()=>{this.subscriptions.push(window.mealzInternal.basket.recipeDataInBasket$().subscribe(e=>{if(!e)return;const i=e.find(r=>r.id===this.recipeId);e.length>0&&i&&parseFloat(i.price)>0&&(this.recipePricingValue=i,this.recalculatePrice(i.price,i.guests))}))})),requestAnimationFrame(()=>{this.classList.remove("re-rendering")})}disconnectedCallback(){var e;super.disconnectedCallback(),this.subscriptions.forEach(i=>i.unsubscribe()),(e=this.priceViewportObserver)==null||e.disconnect()}fetchPrice(){const e=n.getInstance(),i=e.getMemorizedPrice(this.recipeId,this.serves);if(i){requestAnimationFrame(()=>{this.applyCurrencyDisplay(i.price),e.markPriceAsDisplayed(this.recipeId,this.serves)});return}this.fetchAndUpdatePrice()}render(){this.recipePricing=this.querySelector(".mealz-recipe-pricing"),this.recipePricing&&(this.recipeId&&this.pricePerServe&&n.getInstance().isPriceDisplayed(this.recipeId,this.serves)&&requestAnimationFrame(()=>{this.applyCurrencyDisplay(this.pricePerServe)}),this.rendered.next(!0))}getInitialStatus(){var a;const e=(a=this.attributes["starting-data"])==null?void 0:a.value;if(!e)return;const{recipeId:i,extStoreId:r,posId:t,pricePerServe:s,serves:c}=JSON.parse(e);this.extStoreId=r,this.posId=t,this.recipeId=i,this.pricePerServe=(s==null?void 0:s.toString())??null,this.serves=c,this.recipePricingValue={id:this.recipeId,price:null,guests:this.serves},this.pricePerServe&&this.applyCurrencyDisplay(this.pricePerServe)}applyCurrencyDisplay(e){const i=parseFloat(e);isNaN(i)||(this.formattedPrice=i.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}),this.recipePricing||(this.recipePricing=this.querySelector(".mealz-recipe-pricing")),this.updateDOM())}showPrice(){var r,t;const e=(r=this.recipePricing)==null?void 0:r.querySelector(".mealz-recipe-pricing__loading"),i=(t=this.recipePricing)==null?void 0:t.querySelector(".mealz-recipe-pricing__wrapper");e==null||e.classList.replace("active","hidden"),i==null||i.classList.replace("hidden","active")}updateDOM(){var i;const e=(i=this.recipePricing)==null?void 0:i.querySelector(".mealz-recipe-pricing__wrapper__price");e&&(e.innerHTML=this.formattedPrice+" €",this.showPrice())}recalculatePrice(e,i){const r=(e/i).toString();this.updatePriceDisplay(r,i)}updatePriceDisplay(e,i){requestAnimationFrame(()=>{this.applyCurrencyDisplay(e);const r=n.getInstance();r.memorizedPrice(this.recipeId,i,e),r.markPriceAsDisplayed(this.recipeId,i)})}listenInView(){this.priceViewportObserver=new u(this,()=>{var e;!this.priceFetched&&((e=this.recipePricingValue)==null?void 0:e.price)===null&&(this.fetchPrice(),this.priceFetched=!0)})}fetchAndUpdatePrice(){const e=this.posId||this.extStoreId,i=this.extStoreId;if(!e||!this.recipeId||!this.serves)return;const t=window.mealzInternal.recipes.fetchPricing(this.recipeId,e,this.serves,i).subscribe({next:s=>{s&&s["price-per-serve"]&&(this.pricePerServe=s["price-per-serve"].toString(),this.recipePricingValue={id:this.recipeId,price:s.price,guests:this.serves},this.recalculatePrice(s.price,this.serves))},error:s=>{console.error("Failed to fetch recipe pricing:",s)}});this.subscriptions.push(t)}};o=w([m("mealz-recipe-pricing")],o);
@@ -0,0 +1,105 @@
1
+ import{f as h,u as b,i as m,N as f,k as d}from"../assets/no-shadow-element-Dl16SZ0M.js";import{t as _}from"../assets/custom-element-BhZVzxrc.js";/**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ * SPDX-License-Identifier: BSD-3-Clause
5
+ */const v={attribute:!0,type:String,converter:b,reflect:!1,hasChanged:h},g=(e=v,s,t)=>{const{kind:i,metadata:a}=t;let r=globalThis.litPropertyMetadata.get(a);if(r===void 0&&globalThis.litPropertyMetadata.set(a,r=new Map),r.set(t.name,e),i==="accessor"){const{name:o}=t;return{set(n){const u=s.get.call(this);s.set.call(this,n),this.requestUpdate(o,u,e)},init(n){return n!==void 0&&this.P(o,void 0,e),n}}}if(i==="setter"){const{name:o}=t;return function(n){const u=this[o];s.call(this,n),this.requestUpdate(o,u,e)}}throw Error("Unsupported decorator location: "+i)};function p(e){return(s,t)=>typeof t=="object"?g(e,s,t):((i,a,r)=>{const o=a.hasOwnProperty(r);return a.constructor.createProperty(r,o?{...i,wrapped:!0}:i),o?Object.getOwnPropertyDescriptor(a,r):void 0})(e,s,t)}/**
6
+ * @license
7
+ * Copyright 2017 Google LLC
8
+ * SPDX-License-Identifier: BSD-3-Clause
9
+ */function x(e){return p({...e,state:!0,attribute:!1})}var y=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,s,t,i)=>{for(var a=i>1?void 0:i?w(s,t):s,r=e.length-1,o;r>=0;r--)(o=e[r])&&(a=(i?o(s,t,a):o(a))||a);return i&&a&&y(s,t,a),a};let l=class extends f{constructor(){super(...arguments),this.options=[],this.value="",this.placeholder="",this.disabled=!1,this._open=!1,this._onWindowClick=e=>{e.composedPath().includes(this)||this._open&&(this._open=!1,this.requestUpdate())}}connectedCallback(){super.connectedCallback(),this._attachOutsideClick()}disconnectedCallback(){this._detachOutsideClick(),super.disconnectedCallback()}render(){const e=this.options.find(t=>t.id===this.value),s=(e==null?void 0:e.label)||this.placeholder||"";return d`
10
+ <div class="mealz-select">
11
+ <button
12
+ type="button"
13
+ class="mealz-select__button"
14
+ ?disabled="${this.disabled}"
15
+ aria-haspopup="listbox"
16
+ aria-expanded="${this._open?"true":"false"}"
17
+ @click="${()=>this._toggle()}"
18
+ >
19
+ <span>${s}</span>
20
+ <img
21
+ src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Caret.svg"
22
+ alt="caret"
23
+ style="transform: rotate(${this._open?270:90}deg); width:16px; height:16px;"
24
+ />
25
+ </button>
26
+
27
+ ${this._open?d`
28
+ <div class="mealz-select__menu">
29
+ ${this.options.map(t=>d`
30
+ <button
31
+ type="button"
32
+ class="mealz-select__option"
33
+ aria-pressed="${t.id===this.value}"
34
+ @click="${()=>this._select(t)}"
35
+ >
36
+ ${t.label}
37
+ </button>
38
+ `)}
39
+ </div>
40
+ `:d``}
41
+ </div>
42
+ `}_toggle(){this.disabled||(this._open=!this._open,this.requestUpdate())}_select(e){this.value=e.id,this._open=!1,this.dispatchEvent(new CustomEvent("valueChange",{detail:{value:e.id,label:e.label},bubbles:!0,composed:!0})),this.requestUpdate()}_attachOutsideClick(){window.addEventListener("click",this._onWindowClick,{passive:!0})}_detachOutsideClick(){window.removeEventListener("click",this._onWindowClick)}};l.styles=[m`
43
+ :host {
44
+ display: block;
45
+ }
46
+
47
+ .mealz-select {
48
+ display: block;
49
+ width: 100%;
50
+ position: relative;
51
+
52
+ .mealz-select__button {
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: space-between;
56
+ width: 100%;
57
+ height: 40px;
58
+ padding: 8px 12px;
59
+ border-radius: 4px;
60
+ border: 1px solid var(--mealz-ds-color-neutral-200, #d9dde1);
61
+ background: var(--mealz-ds-color-neutral-white, #ffffff);
62
+ font-size: 14px;
63
+ cursor: pointer;
64
+ }
65
+
66
+ .mealz-select__button[disabled] {
67
+ opacity: 0.6;
68
+ cursor: not-allowed;
69
+ }
70
+
71
+ .mealz-select__menu {
72
+ position: absolute;
73
+ top: calc(100% + 4px);
74
+ left: 0;
75
+ right: 0;
76
+ max-height: 288px;
77
+ overflow: auto;
78
+ border-radius: 8px;
79
+ border: 1px solid var(--mealz-ds-color-neutral-200, #d9dde1);
80
+ background: var(--mealz-ds-color-neutral-white, #ffffff);
81
+ box-shadow: 0px 8px 16px rgba(15, 25, 31, 0.12);
82
+ padding: 8px 0;
83
+ z-index: 10;
84
+ }
85
+
86
+ .mealz-select__option {
87
+ padding: 10px 16px;
88
+ font-size: 14px;
89
+ color: var(--mealz-ds-color-neutral-black, #0f191f);
90
+ cursor: pointer;
91
+ width: 100%;
92
+ text-align: left;
93
+ background: transparent;
94
+ border: none;
95
+ appearance: none;
96
+ }
97
+
98
+ .mealz-select__option:hover,
99
+ .mealz-select__option[aria-pressed='true'] {
100
+ color: var(--mealz-ds-color-primary, #24748f);
101
+ background-color: var(--mealz-ds-color-primary-100, #e4eaec);
102
+ }
103
+ }
104
+
105
+ `];c([p({type:Array})],l.prototype,"options",2);c([p({type:String})],l.prototype,"value",2);c([p({type:String})],l.prototype,"placeholder",2);c([p({type:Boolean})],l.prototype,"disabled",2);c([x()],l.prototype,"_open",2);l=c([_("mealz-select")],l);customElements.get("mealz-select")||customElements.define("mealz-select",l);export{p as n,x as r};
@@ -1,41 +1,35 @@
1
- import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js";import{t as b}from"../assets/custom-element-BhZVzxrc.js";/**
1
+ import{i as c,N as h,k as l}from"../assets/no-shadow-element-Dl16SZ0M.js";import{n as d,r as u}from"../select/select.min.js";import{t as z}from"../assets/custom-element-BhZVzxrc.js";/**
2
2
  * @license
3
3
  * Copyright 2017 Google LLC
4
4
  * SPDX-License-Identifier: BSD-3-Clause
5
- */const _={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:u},x=(t=_,e,s)=>{const{kind:i,metadata:o}=s;let a=globalThis.litPropertyMetadata.get(o);if(a===void 0&&globalThis.litPropertyMetadata.set(o,a=new Map),a.set(s.name,t),i==="accessor"){const{name:r}=s;return{set(p){const h=e.get.call(this);e.set.call(this,p),this.requestUpdate(r,h,t)},init(p){return p!==void 0&&this.P(r,void 0,t),p}}}if(i==="setter"){const{name:r}=s;return function(p){const h=this[r];e.call(this,p),this.requestUpdate(r,h,t)}}throw Error("Unsupported decorator location: "+i)};function c(t){return(e,s)=>typeof s=="object"?x(t,e,s):((i,o,a)=>{const r=o.hasOwnProperty(a);return o.constructor.createProperty(a,r?{...i,wrapped:!0}:i),r?Object.getOwnPropertyDescriptor(o,a):void 0})(t,e,s)}/**
5
+ */const g=(e,t,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof t!="object"&&Object.defineProperty(e,t,s),s);/**
6
6
  * @license
7
7
  * Copyright 2017 Google LLC
8
8
  * SPDX-License-Identifier: BSD-3-Clause
9
- */function v(t){return c({...t,state:!0,attribute:!1})}/**
10
- * @license
11
- * Copyright 2017 Google LLC
12
- * SPDX-License-Identifier: BSD-3-Clause
13
- */const w=(t,e,s)=>(s.configurable=!0,s.enumerable=!0,Reflect.decorate&&typeof e!="object"&&Object.defineProperty(t,e,s),s);/**
14
- * @license
15
- * Copyright 2017 Google LLC
16
- * SPDX-License-Identifier: BSD-3-Clause
17
- */function y(t,e){return(s,i,o)=>{const a=r=>{var p;return((p=r.renderRoot)==null?void 0:p.querySelector(t))??null};return w(s,i,{get(){return a(this)}})}}class S{get extId(){return this.attributes["ext-id"]}}var C=Object.defineProperty,L=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var o=i>1?void 0:i?L(e,s):e,a=t.length-1,r;a>=0;a--)(r=t[a])&&(o=(i?r(e,s,o):r(o))||o);return i&&o&&C(e,s,o),o};let l=class extends f{constructor(){var t,e,s,i,o,a;super(...arguments),this.selectedRadius=50,this.getByAddress=(e=(t=window.mealz)==null?void 0:t.pos)==null?void 0:e.getByAddress,this.getByCoordinates=(i=(s=window.mealz)==null?void 0:s.pos)==null?void 0:i.getByCoordinates,this.getAffiliateSuppliers=(a=(o=window.mealz)==null?void 0:o.supplier)==null?void 0:a.getAffiliateSuppliers,this._posList=[],this._markers=[],this._searchingPos=!1,this._searchSubmitted=!1,this._previousSearchMethod=()=>{},this._suppliers=[],this._selectedSuppliers=[],this._showPosList=!1,this._posSelected=!1,this.subscriptions=[]}set geolocationCoordinates(t){var e,s;this._geolocationCoordinates=t,(e=t==null?void 0:t.coords)!=null&&e.latitude&&((s=t==null?void 0:t.coords)!=null&&s.longitude)&&this.setGeolocation()}get geolocationCoordinates(){return this._geolocationCoordinates}_nameOfStore(t){return`${t.supplier.attributes.name} - ${t.attributes.name}`}connectedCallback(){super.connectedCallback(),this.initLeaflet(),this.fetchSuppliers(),this.initEvents()}disconnectedCallback(){this.subscriptions.forEach(t=>t.unsubscribe()),super.disconnectedCallback(),this._leafletCss.remove(),this._miamDs.remove(),this._leafletJs.remove()}render(){if(this.show)return this.posSelectionTemplate()}firstUpdated(){this._posSelected=!1,this.loadMap(),this.geolocationTimeout(),this.listenFormSubmit()}posSelectionTemplate(){return n`
18
- <div class="wrapper miam-ds-body">
19
- <div class="pos-selection">
20
- <div class="title">
21
- <button @click=${()=>this.dispatchShow(!1)}><</button>
9
+ */function b(e,t){return(s,o,i)=>{const a=p=>{var m;return((m=p.renderRoot)==null?void 0:m.querySelector(e))??null};return g(s,o,{get(){return a(this)}})}}class f{get extId(){return this.attributes["ext-id"]}}var _=Object.defineProperty,x=Object.getOwnPropertyDescriptor,n=(e,t,s,o)=>{for(var i=o>1?void 0:o?x(t,s):t,a=e.length-1,p;a>=0;a--)(p=e[a])&&(i=(o?p(t,s,i):p(i))||i);return o&&i&&_(t,s,i),i};let r=class extends h{constructor(){var e,t,s,o,i,a;super(...arguments),this.show=!1,this.selectedRadius=50,this.getByAddress=(t=(e=window.miam)==null?void 0:e.pos)==null?void 0:t.getByAddress,this.getByCoordinates=(o=(s=window.miam)==null?void 0:s.pos)==null?void 0:o.getByCoordinates,this.getAffiliateSuppliers=(a=(i=window.miam)==null?void 0:i.supplier)==null?void 0:a.getAffiliateSuppliers,this._posList=[],this._markers=[],this._searchingPos=!1,this._searchSubmitted=!1,this._prevAddress="",this._previousSearchMethod=()=>{},this._suppliers=[],this._selectedSuppliers=[],this._showPosList=!1,this._posSelected=!1,this.subscriptions=[],this.setGeolocation=()=>{this._prevAddress="",this._previousSearchMethod=()=>this.setGeolocation(),this.getPosByCoordinates()}}set geolocationCoordinates(e){var t,s;this._geolocationCoordinates=e,(t=e==null?void 0:e.coords)!=null&&t.latitude&&((s=e==null?void 0:e.coords)!=null&&s.longitude)&&this.setGeolocation()}get geolocationCoordinates(){return this._geolocationCoordinates}get L(){return window.L}_nameOfStore(e){return`${e.supplier.attributes.name} - ${e.attributes.name}`}connectedCallback(){super.connectedCallback(),this.initLeaflet(),this.fetchSuppliers()}disconnectedCallback(){this.subscriptions.forEach(e=>e.unsubscribe()),super.disconnectedCallback(),this._leafletCss.remove(),this._miamDs.remove(),this._leafletJs.remove()}render(){if(this.show)return this.classList.add("mealz-store-locator"),this.posSelectionTemplate()}firstUpdated(){this._posSelected=!1,this.loadMap(),this.geolocationTimeout(),this.listenFormSubmit()}posSelectionTemplate(){return l`
10
+ <div class="mealz-wrapper mealz-ds-body">
11
+ <div class="mealz-pos-selection">
12
+ <div class="mealz-title">
13
+ <button class="mealz-ds-button square ghost mealz-back-button" @click=${()=>this.dispatchShow(!1)}>
14
+ <img src="https://storage.googleapis.com/assets.miam.tech/generic/icons/Caret.svg" alt="Caret" />
15
+ </button>
22
16
  <span>Sélectionner un magasin</span>
23
17
  </div>
24
- <form id="store-locator-form">
25
- <div class="address-input-container">
18
+ <form id="mealz-store-locator-form">
19
+ <div class="mealz-address-input-container">
26
20
  ${this.geolocButtonTemplate()}
27
- <input required class="address-input" type="text" name="address"
21
+ <input required class="mealz-address-input" type="text" name="address"
28
22
  placeholder="Votre code postal ou ville">
29
- <button type="submit" class="miam-ds-button primary search-address-button">OK</button>
23
+ <button type="submit" class="mealz-ds-button primary search-address-button">OK</button>
30
24
  </div>
31
25
  ${this.selectSupplierTemplate()}
32
26
  </form>
33
27
  ${this.posListTemplate()}
34
- ${this._posList.length>0?n`
35
- <div id="mobile-buttons-wrapper"
36
- class="${this._showPosList?"mobile-buttons-wrapper__see-map":"mobile-buttons-wrapper__see-list"}">
28
+ ${this._posList.length>0?l`
29
+ <div id="mealz-mobile-buttons-wrapper"
30
+ class="${this._showPosList?"mealz-mobile-buttons-wrapper__see-map":"mealz-mobile-buttons-wrapper__see-list"}">
37
31
  <button @click=${()=>this.togglePosList(this._showPosList)}
38
- class="miam-ds-button primary hide-pos-button">
32
+ class="mealz-ds-button secondary hide-pos-button ${this._showPosList?"secondary":"primary"}">
39
33
  ${this.getButtonLabel()}
40
34
  </button>
41
35
  </div>`:""}
@@ -43,81 +37,85 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
43
37
  </div>
44
38
  ${this.posMapTemplate()}
45
39
  </div>
46
- `}geolocButtonTemplate(){var e,s,i,o;let t;if(this.geolocationCoordinates===void 0)t=n`
47
- <div class="miam-ds-loader"></div>`;else if((s=(e=this.geolocationCoordinates)==null?void 0:e.coords)!=null&&s.longitude&&((o=(i=this.geolocationCoordinates)==null?void 0:i.coords)!=null&&o.latitude))t=n`<img title="Votre position" class="geolocation-icon"
40
+ `}geolocButtonTemplate(){var t,s,o,i;let e;if(this.geolocationCoordinates===void 0)e=l`
41
+ <div class="mealz-ds-loader"></div>`;else if((s=(t=this.geolocationCoordinates)==null?void 0:t.coords)!=null&&s.longitude&&((i=(o=this.geolocationCoordinates)==null?void 0:o.coords)!=null&&i.latitude))e=l`<img title="Votre position" class="geolocation-icon"
48
42
  src="https://storage.googleapis.com/assets.miam.tech/generic/icons/locate-primary.svg"
49
- alt="Geolocaliser"/>`;else return n``;return n`
43
+ alt="Geolocaliser"/>`;else return l``;return l`
50
44
  <button type="button" ?disabled=${this.geolocationCoordinates===void 0}
51
- class="miam-ds-button square ghost locate-button" @click=${this.setGeolocation}>
52
- ${t}
45
+ class="mealz-ds-button square ghost mealz-locate-button" @click=${this.setGeolocation}>
46
+ ${e}
53
47
  </button>
54
- `}posMapTemplate(){return n`
55
- <div id="map"></div>
56
- `}selectSupplierTemplate(){return n`
57
- <div class="select-supplier miam-ds-dropdown">
58
- <select @change=${this.supplierSelected}>
59
- <option ?selected=${this._selectedSuppliers.length<1} value="${null}">Toutes les enseignes</option>
60
- ${this._suppliers.map(t=>n`
61
- <option ?selected=${t===this._selectedSuppliers[0]} value=${t.id}>
62
- ${t.name}
63
- </option>`)}
64
- </select>
65
- </div>`}supplierSelected(t){t.target.value?this._selectedSuppliers[0]=t.target.value:this._selectedSuppliers=[];const e=this._suppliers.find(s=>s.id===t.target.value);e?this._filterEvent.detail.supplierName=e.name:this._filterEvent.detail.supplierName="",this.dispatchEvent(this._filterEvent),this._previousSearchMethod(!0)}posListTemplate(){if(this._searchingPos)return n`
66
- <div class="pos-loader">
67
- <div class="miam-ds-loader"></div>
48
+ `}posMapTemplate(){return l`
49
+ <div id="mealz-map"></div>
50
+ `}selectSupplierTemplate(){const e=this._selectedSuppliers[0],t=[{id:"",label:"Toutes les enseignes"},...this._suppliers.map(s=>({id:s.id,label:s.name}))];return l`
51
+ <div class="mealz-select-supplier">
52
+ <mealz-select
53
+ .options=${t}
54
+ .value=${e||""}
55
+ .placeholder=${"Toutes les enseignes"}
56
+ @valueChange=${s=>{var o;return this.handleSupplierChange(((o=s.detail)==null?void 0:o.value)??null)}}
57
+ ></mealz-select>
58
+ </div>
59
+ `}handleSupplierChange(e){const t={target:{value:e||""}};this.supplierSelected(t)}supplierSelected(e){const t=e.target;t!=null&&t.value?this._selectedSuppliers[0]=t.value:this._selectedSuppliers=[];const s=this._suppliers.find(a=>a.id===(t==null?void 0:t.value)),i={detail:{supplierName:s?s.name:""},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("filterChange",i)),this._previousSearchMethod(!0)}posListTemplate(){if(this._searchingPos)return l`
60
+ <div class="mealz-pos-loader">
61
+ <div class="mealz-ds-loader"></div>
68
62
  </div>
69
- `;if(this._posList.length<1&&this._searchSubmitted)return n`
70
- <div class="no-pos-found">
63
+ `;if(this._posList.length<1&&this._searchSubmitted)return l`
64
+ <div class="mealz-no-pos-found">
71
65
  <b>Aucun magasin trouvé à proximité.</b>
72
66
  <span>Essayez une autre adresse.</span>
73
67
  </div>
74
- `;if(this._posList.length<1)return;const t=this.shadowRoot.querySelector(".pos-selection");return t&&t.classList.toggle("pos-selection__height",this._showPosList),n`
75
- <div id="pos-list" class="${this._showPosList?"pos-list__visible":"pos-list__hidden"}">
76
- ${this._posList.map(e=>n`
77
- <div class="pos-item">
78
- <div class="top">
79
- <img src="${e.supplier.attributes.logo}" alt="${e.supplier.attributes.name}"/>
80
- <div class="top-right">
81
- <div class="name">${this._nameOfStore(e)}</div>
82
- <div class="address">${e.attributes.address}</div>
68
+ `;if(this._posList.length<1)return;const e=this.querySelector(".mealz-pos-selection");return e&&e.classList.toggle("mealz-pos-selection__height",this._showPosList),l`
69
+ <div id="mealz-pos-list" class="${this._showPosList?"mealz-pos-list__visible":"mealz-pos-list__hidden"}">
70
+ ${this._posList.map(t=>l`
71
+ <div class="mealz-pos-item">
72
+ <div class="mealz-top">
73
+ <img src="${t.supplier.attributes.logo}" alt="${t.supplier.attributes.name}"/>
74
+ <div class="mealz-top-right">
75
+ <div class="mealz-name">${this._nameOfStore(t)}</div>
76
+ <div class="mealz-address">${t.attributes.address}</div>
83
77
  </div>
84
78
  </div>
85
- <div class="bottom">
86
- <button @click=${()=>this.dispatchPos(e)}
87
- class="miam-ds-button primary select-pos-button"
79
+ <div class="mealz-bottom">
80
+ <button @click=${()=>this.dispatchPos(t)}
81
+ class="mealz-ds-button primary small mealz-select-pos-button"
88
82
  ?disabled=${this._posSelected}>
89
- ${this._posSelected?n`
90
- <div class="miam-ds-loader"></div>`:"Sélectionner"}
83
+ ${this._posSelected?l`
84
+ <div class="mealz-ds-loader"></div>`:"Sélectionner"}
91
85
  </button>
92
86
  </div>
93
87
  </div>
94
88
  `)}
95
89
  </div>
96
- `}getButtonLabel(){if(this._showPosList)return"Voir la carte";const t=this._posList.length;return t===1?"Voir le magasin":`Voir les ${t} magasins`}setAddress(t=!1){!this._addressInput.value||this._addressInput.value.length<3||this._searchingPos||!t&&this._prevAddress===this._addressInput.value+", France"||(this.shadowRoot.getElementById("pos-list"),this._previousSearchMethod=this.setAddress,this._prevAddress=this._addressInput.value+", France",this._searchingPos=!0,this.requestUpdate(),this.subscriptions.push(this.getByAddress(this._prevAddress,this.selectedRadius,this._selectedSuppliers).subscribe(e=>{this.setPosList(e),this.setNewLocation(),this.dispatchSearch(this._prevAddress,e.data.length),this._searchingPos=!1,this._searchSubmitted=!0,this.togglePosList(!1),this.requestUpdate()})))}setGeolocation(t=!1){this._prevAddress="",this._previousSearchMethod=this.setGeolocation,this.getPosByCoordinates()}getPosByCoordinates(){this._searchingPos=!0,this.requestUpdate(),this.subscriptions.push(this.getByCoordinates(this.geolocationCoordinates.coords.latitude,this.geolocationCoordinates.coords.longitude,this.selectedRadius,this._selectedSuppliers).subscribe(t=>{this._addressInput.value="",this.setPosList(t),this._searchingPos=!1,this.setNewLocation(),this._searchSubmitted=!0,this.togglePosList(!1),this.requestUpdate()}))}setPosList(t){this._posList=t.data.map(e=>{const s=Object.assign(new S,e);return s.supplier=t.included.find(i=>i.id===s.relationships.supplier.data.id),s}).sort((e,s)=>e.attributes.name.includes("onoprix")?-1:s.attributes.name.includes("onoprix")?1:0)}dispatchPos(t){this._posSelected=!0,this.requestUpdate();const e={detail:{posId:t.id,posExtId:t.extId,supplierId:t.supplier.id,supplierName:t.supplier.attributes.name,posName:this._nameOfStore(t)},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("posIdChange",e))}dispatchShow(t){const e={detail:{show:t},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("showChange",e))}dispatchSearch(t,e){const s={detail:{searchTerm:t,storesFoundCount:e},bubbles:!0,composed:!0};console.debug("[MealzComponents] dispatchEvent searchChange",s),this.dispatchEvent(new CustomEvent("searchChange",s))}initLeaflet(){this._leafletCss=document.createElement("link"),this._leafletCss.setAttribute("rel","stylesheet"),this._leafletCss.setAttribute("href","https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),this._leafletCss.setAttribute("integrity","sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="),this._leafletCss.setAttribute("crossorigin",""),this._leafletJs=document.createElement("script"),this._leafletJs.setAttribute("src","https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"),this._leafletJs.setAttribute("integrity","sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="),this._leafletJs.setAttribute("crossorigin",""),this._miamDs=document.createElement("link"),this._miamDs.setAttribute("rel","stylesheet"),this._miamDs.setAttribute("href","https://unpkg.com/miam-ds@1.2.6/miam-ds.min.css"),this.shadowRoot.appendChild(this._miamDs),this.shadowRoot.appendChild(this._leafletCss),document.head.appendChild(this._leafletJs)}waitForLeaflet(t){let i=50;console.debug("[Map] Checking for window.L");const o=setInterval(()=>{window.L!==void 0||i===0?(clearInterval(o),window.L!==void 0?(console.debug("[Map] window.L is defined"),t(!0)):(console.error("[Map] Failed to load Leaflet after",5e3,"ms"),t(!1))):i--},100)}initMap(){this._map&&(this._map.off(),this._map.remove()),this.setNewLocation(),window.L.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",{maxZoom:19,attribution:"Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."}).addTo(this._map)}loadMap(){this.waitForLeaflet(t=>{t&&this.initMap()})}initEvents(){this._filterEvent=new CustomEvent("filterChange",{detail:{supplierName:""},bubbles:!0,composed:!0})}fetchSuppliers(){this.subscriptions.push(this.getAffiliateSuppliers().subscribe(t=>{this._suppliers=t.map(e=>({id:e.id,name:e.attributes.name})),this.requestUpdate()}))}setNewLocation(){var e;const t=this.shadowRoot.getElementById("map");t&&(this._map?(this._markers.forEach(s=>{this._map.removeLayer(s)}),this._markers=[],this._map.panTo(this.getCoordinates())):this._map=(e=window.L)==null?void 0:e.map(t).setView(this.getCoordinates(),13),this.addMarkers())}getCoordinates(){return this._posList.length<1?[48.866667,2.333333]:[this._posList[0].attributes.latitude,this._posList[0].attributes.longitude]}addMarkers(){this._posList.length>0&&this._posList.forEach((t,e)=>{this._markers.push(window.L.marker([t.attributes.latitude,t.attributes.longitude],{icon:this.buildIcon(t.supplier)}).addTo(this._map));let s=window.L.popup({content:`
97
- <div class="pos-item">
98
- <div class="top">
99
- <img class="pos-img" src="${t.supplier.attributes.logo}" alt="${t.supplier.attributes.name}"/>
100
- <div class="top-right">
101
- <div class="name">${this._nameOfStore(t)}</div>
102
- <div class="address">${t.attributes.address}</div>
90
+ `}getButtonLabel(){if(this._showPosList)return"Voir la carte";const e=this._posList.length;return e===1?"Voir le magasin":`Voir les ${e} magasins`}setAddress(e=!1){!this._addressInput.value||this._addressInput.value.length<3||this._searchingPos||!e&&this._prevAddress===this._addressInput.value+", France"||(this._previousSearchMethod=t=>this.setAddress(t),this._prevAddress=this._addressInput.value+", France",this._searchingPos=!0,this.requestUpdate(),this.subscriptions.push(this.getByAddress(this._prevAddress,this.selectedRadius,this._selectedSuppliers).subscribe(t=>{this.setPosList(t),this.setNewLocation(),this.dispatchSearch(this._prevAddress,t.data.length),this._searchingPos=!1,this._searchSubmitted=!0,this.togglePosList(!1),this.requestUpdate()})))}getPosByCoordinates(){this._searchingPos=!0,this.requestUpdate(),this.subscriptions.push(this.getByCoordinates(this.geolocationCoordinates.coords.latitude,this.geolocationCoordinates.coords.longitude,this.selectedRadius,this._selectedSuppliers).subscribe(e=>{this._addressInput.value="",this.setPosList(e),this._searchingPos=!1,this.setNewLocation(),this._searchSubmitted=!0,this.togglePosList(!1),this.requestUpdate()}))}setPosList(e){this._posList=e.data.map(t=>{const s=Object.assign(new f,t),o=e.included.find(i=>i.id===s.relationships.supplier.data.id);return o&&(s.supplier=o),s}).sort((t,s)=>t.attributes.name.includes("onoprix")?-1:s.attributes.name.includes("onoprix")?1:0)}dispatchPos(e){this._posSelected=!0,this.requestUpdate();const t={detail:{posId:e.id,posExtId:e.extId,supplierId:e.supplier.id,supplierName:e.supplier.attributes.name,posName:this._nameOfStore(e)},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("posIdChange",t))}dispatchShow(e){const t={detail:{show:e},bubbles:!0,composed:!0};this.dispatchEvent(new CustomEvent("showChange",t))}dispatchSearch(e,t){const s={detail:{searchTerm:e,storesFoundCount:t},bubbles:!0,composed:!0};console.debug("[MealzComponents] dispatchEvent searchChange",s),this.dispatchEvent(new CustomEvent("searchChange",s))}initLeaflet(){this._leafletCss=document.createElement("link"),this._leafletCss.setAttribute("rel","stylesheet"),this._leafletCss.setAttribute("href","https://unpkg.com/leaflet@1.9.4/dist/leaflet.css"),this._leafletCss.setAttribute("integrity","sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY="),this._leafletCss.setAttribute("crossorigin",""),this._leafletJs=document.createElement("script"),this._leafletJs.setAttribute("src","https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"),this._leafletJs.setAttribute("integrity","sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo="),this._leafletJs.setAttribute("crossorigin",""),this._miamDs=document.createElement("link"),this._miamDs.setAttribute("rel","stylesheet"),this._miamDs.setAttribute("href","https://unpkg.com/mealz-ds@2.0.0/mealz-ds.min.css"),this.appendChild(this._miamDs),this.appendChild(this._leafletCss),document.head.appendChild(this._leafletJs)}waitForLeaflet(e){let o=50;console.debug("[Map] Checking for window.L");const i=setInterval(()=>{typeof window.L<"u"||o===0?(clearInterval(i),typeof window.L<"u"?(console.debug("[Map] window.L is defined"),e(!0)):(console.error("[Map] Failed to load Leaflet after",5e3,"ms"),e(!1))):o--},100)}initMap(){this._map&&(this._map.off(),this._map.remove()),this.setNewLocation(),this.L.tileLayer("https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png",{maxZoom:19,attribution:"Map tiles by Carto, under CC BY 3.0. Data by OpenStreetMap, under ODbL."}).addTo(this._map)}loadMap(){this.waitForLeaflet(e=>{e&&this.initMap()})}fetchSuppliers(){this.subscriptions.push(this.getAffiliateSuppliers().subscribe(e=>{this._suppliers=e.map(t=>({id:t.id,name:t.attributes.name})),this.requestUpdate()}))}setNewLocation(){const e=this.querySelector("#mealz-map");if(e){if(this._map){const t=this._map;this._markers.forEach(s=>{t.removeLayer(s)}),this._markers=[],t.panTo(this.getCoordinates())}else this._map=this.L.map(e).setView(this.getCoordinates(),13);this._map&&this.addMarkers()}}getCoordinates(){return this._posList.length<1?[48.866667,2.333333]:[Number(this._posList[0].attributes.latitude),Number(this._posList[0].attributes.longitude)]}addMarkers(){this._posList.length>0&&this._posList.forEach((e,t)=>{this._markers.push(this.L.marker([Number(e.attributes.latitude),Number(e.attributes.longitude)],{icon:this.buildIcon(e.supplier)}).addTo(this._map));const s=this.L.popup({content:`
91
+ <div class="mealz-pos-item">
92
+ <div class="mealz-top">
93
+ <img class="mealz-pos-img" src="${e.supplier.attributes.logo}" alt="${e.supplier.attributes.name}"/>
94
+ <div class="mealz-top-right">
95
+ <div class="mealz-name">${this._nameOfStore(e)}</div>
96
+ <div class="mealz-address">${e.attributes.address}</div>
103
97
  </div>
104
98
  </div>
105
- <div class="bottom">
106
- <button id="select" class="miam-ds-button primary select-pos-button">Sélectionner</button>
99
+ <div class="mealz-bottom">
100
+ <button id="mealz-select" class="mealz-ds-button primary small mealz-select-pos-button">Sélectionner</button>
107
101
  </div>
108
102
  </div>
109
- `});this._markers[e].bindPopup(s).on("popupopen",i=>{i.target.getPopup().getElement().querySelector("#select").addEventListener("click",()=>{this.dispatchPos(t)})})})}buildIcon(t){return window.L.icon({iconUrl:t.attributes.logo||"https://cdn-icons-png.flaticon.com/512/3515/3515146.png",shadowUrl:"https://storage.googleapis.com/assets.miam.tech/mealz-components/store-locator/marker.svg",iconSize:[32,32],shadowSize:[44,53],iconAnchor:[16,45],shadowAnchor:[22,45],popupAnchor:[0,-55]})}togglePosList(t){this._showPosList=!t;const e=this.shadowRoot.getElementById("pos-list"),s={bubbles:!0,composed:!0};e&&(t?(e.style.display="none",this.dispatchEvent(new CustomEvent("mapSelected",s))):(e.style.display="flex",this.dispatchEvent(new CustomEvent("listSelected",s))),this.requestUpdate())}geolocationTimeout(){setTimeout(()=>{this.geolocationCoordinates===void 0&&(this.geolocationCoordinates={})},2e4)}listenFormSubmit(){this.shadowRoot.getElementById("store-locator-form").addEventListener("submit",e=>{e.preventDefault(),this.setAddress()})}};l.styles=[g`
103
+ `});this._markers[t].bindPopup(s).on("popupopen",o=>{var a,p;const i=(a=o.target.getPopup())==null?void 0:a.getElement();(p=i==null?void 0:i.querySelector("#mealz-select"))==null||p.addEventListener("click",()=>{this.dispatchPos(e)})})})}buildIcon(e){return this.L.icon({iconUrl:e.attributes.logo||"https://cdn-icons-png.flaticon.com/512/3515/3515146.png",shadowUrl:"https://storage.googleapis.com/assets.miam.tech/mealz-components/store-locator/marker.svg",iconSize:[24,24],shadowSize:[44,53],iconAnchor:[16,43],shadowAnchor:[22,45],popupAnchor:[0,-55],className:"mealz-marker-icon"})}togglePosList(e){this._showPosList=!e;const t=this.querySelector("#mealz-pos-list"),s={bubbles:!0,composed:!0};t&&(e?(t.style.display="none",this.dispatchEvent(new CustomEvent("mapSelected",s))):(t.style.display="flex",this.dispatchEvent(new CustomEvent("listSelected",s))),this.requestUpdate())}geolocationTimeout(){setTimeout(()=>{this.geolocationCoordinates===void 0&&(this.geolocationCoordinates={})},2e4)}listenFormSubmit(){const e=this.querySelector("#mealz-store-locator-form");e&&e.addEventListener("submit",t=>{t.preventDefault(),this.setAddress()})}};r.styles=[c`
110
104
  :host {
111
105
  display: block;
106
+ }
107
+
108
+ .mealz-store-locator {
109
+ display: block;
112
110
  height: 100%;
113
111
  }
114
112
 
115
- .wrapper {
113
+ .mealz-store-locator .mealz-wrapper {
116
114
  height: 100%;
117
115
  display: flex;
118
116
  }
119
117
 
120
- .pos-selection {
118
+ .mealz-store-locator .mealz-pos-selection {
121
119
  display: flex;
122
120
  width: 320px;
123
121
  padding: 40px var(--spacing-padding-16-px, 16px);
@@ -125,50 +123,51 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
125
123
  align-items: stretch;
126
124
  gap: var(--spacing-padding-16-px, 16px);
127
125
  flex-shrink: 0;
128
- background: var(--miam-ds-color-neutral-50, #FFF);
126
+ background: var(--mealz-ds-color-neutral-white, #FFFFFF);
129
127
  box-shadow: 2px 0px 16px 0px rgba(0, 0, 0, 0.15);
130
128
  z-index: 1;
131
-
132
- #store-locator-form {
133
- display: flex;
134
- flex-direction: column;
135
- gap: 8px;
136
- }
137
129
  }
138
130
 
139
- .pos-selection .title {
140
- color: var(--miam-ds-color-neutral-black, #3F3735);
131
+ .mealz-store-locator .mealz-pos-selection #mealz-store-locator-form {
132
+ display: flex;
133
+ flex-direction: column;
134
+ gap: 8px;
135
+ }
136
+
137
+ .mealz-store-locator .mealz-pos-selection .mealz-title {
138
+ color: var(--mealz-ds-color-neutral-black, #0F191F);
141
139
  font-size: 28px;
142
140
  font-weight: 700;
143
141
  line-height: 120%;
144
142
  }
145
143
 
146
- .pos-selection .title button {
144
+ .mealz-store-locator .mealz-pos-selection .mealz-title .mealz-back-button {
147
145
  display: none;
148
146
  }
149
147
 
150
- .pos-selection .address-input-container {
148
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container {
151
149
  display: flex;
152
150
  gap: 8px;
153
151
  height: 40px;
154
152
  position: relative;
155
153
  }
156
-
157
- .pos-selection .address-input-container {
158
- .address-input {
159
- padding-left: 8px;
160
- }
161
-
162
- .locate-button + .address-input {
163
- padding-left: 40px;
164
- }
165
-
166
- .address-input {
167
- flex: 1;
168
- }
154
+
155
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container .mealz-address-input {
156
+ padding-left: 8px;
157
+ }
158
+
159
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container .mealz-locate-button + .mealz-address-input {
160
+ padding-left: 40px;
161
+ }
162
+
163
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container .mealz-address-input {
164
+ flex: 1;
165
+ border: 1px solid var(--mealz-ds-color-neutral-200, #D9DDE1);
166
+ border-radius: 4px;
167
+ font-size: 14px;
169
168
  }
170
-
171
- .pos-selection .address-input-container .locate-button {
169
+
170
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container .mealz-locate-button {
172
171
  position: absolute;
173
172
  background: unset;
174
173
  border: unset;
@@ -178,14 +177,14 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
178
177
  width: 24px;
179
178
  height: 24px;
180
179
  }
181
-
182
- .pos-selection .address-input-container .locate-button img {
180
+
181
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container .mealz-locate-button img {
183
182
  cursor: pointer;
184
183
  width: 24px;
185
184
  height: 24px;
186
185
  }
187
186
 
188
- .pos-selection #pos-list {
187
+ .mealz-store-locator .mealz-pos-selection #mealz-pos-list {
189
188
  flex-direction: column;
190
189
  align-items: flex-start;
191
190
  gap: var(--spacing-padding-12-px, 12px);
@@ -193,12 +192,12 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
193
192
  overflow: auto;
194
193
  }
195
194
 
196
- .pos-list__visible,
197
- .pos-list__hidden {
195
+ .mealz-store-locator .mealz-pos-list__visible,
196
+ .mealz-store-locator .mealz-pos-list__hidden {
198
197
  display: flex;
199
198
  }
200
199
 
201
- .pos-selection .pos-loader {
200
+ .mealz-store-locator .mealz-pos-selection .mealz-pos-loader {
202
201
  flex: 1;
203
202
  width: 100%;
204
203
  display: flex;
@@ -206,7 +205,7 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
206
205
  align-items: center;
207
206
  }
208
207
 
209
- .pos-selection .pos-loader .miam-ds-loader {
208
+ .mealz-store-locator .mealz-pos-selection .mealz-pos-loader .mealz-ds-loader {
210
209
  margin: 16px;
211
210
  display: flex;
212
211
  width: 72px;
@@ -214,8 +213,8 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
214
213
  background-position-x: 36px;
215
214
  background-size: 36px 36px;
216
215
  }
217
-
218
- .pos-selection .no-pos-found {
216
+
217
+ .mealz-store-locator .mealz-pos-selection .mealz-no-pos-found {
219
218
  margin-bottom: 16px;
220
219
  width: 100%;
221
220
  flex: 1;
@@ -224,18 +223,13 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
224
223
  align-items: center;
225
224
  flex-direction: column;
226
225
  }
227
-
228
- .pos-selection .select-supplier {
229
- display: flex;
230
- }
231
-
232
- .pos-selection .select-supplier select {
233
- flex: 1;
234
- padding: 10px;
235
- max-width: initial;
226
+
227
+ .mealz-store-locator .mealz-ds-dropdown::after {
228
+ right: 12px;
229
+ top: 17px;
236
230
  }
237
231
 
238
- .pos-item {
232
+ .mealz-store-locator .mealz-pos-item {
239
233
  display: flex;
240
234
  flex-direction: column;
241
235
  padding: 8px;
@@ -243,47 +237,51 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
243
237
  gap: 16px;
244
238
  align-self: stretch;
245
239
  border-radius: 8px;
246
- border: 1px solid var(--miam-ds-color-border, #D5D5D5);
240
+ border: 1px solid var(--mealz-ds-color-neutral-200, #D9DDE1);
247
241
  }
248
242
 
249
- .pos-item .top {
243
+ .mealz-store-locator .mealz-pos-item .mealz-top {
250
244
  display: flex;
251
245
  align-items: flex-start;
252
246
  gap: 8px;
253
247
  align-self: stretch;
254
248
  }
255
249
 
256
- .pos-item .top img {
250
+ .mealz-store-locator .mealz-pos-item .mealz-top img {
257
251
  width: 40px;
258
252
  height: 40px;
259
253
  flex-shrink: 0;
260
254
  }
261
255
 
262
- .pos-item .top .name {
263
- color: var(--miam-ds-color-neutral-black, #3F3735);
256
+ .mealz-store-locator .mealz-pos-item .mealz-top .mealz-name {
257
+ color: var(--mealz-ds-color-neutral-black, #0F191F);
264
258
  font-size: 14px;
265
259
  font-weight: 700;
266
260
  line-height: 150%;
267
261
  }
268
262
 
269
- .pos-item .top .address {
270
- color: var(--miam-ds-color-neutral-500, #989898);
263
+ .mealz-store-locator .mealz-pos-item .mealz-top .mealz-address {
264
+ color: var(--mealz-ds-color-neutral-500, #8C96A2);
271
265
  font-size: 12px;
272
266
  font-weight: 600;
273
267
  line-height: 150%;
274
268
  }
275
269
 
276
- .pos-item .bottom {
270
+ .mealz-store-locator .mealz-pos-item .mealz-bottom {
277
271
  display: flex;
278
272
  justify-content: flex-end;
279
273
  width: 100%;
280
274
  }
281
275
 
282
- #mobile-buttons-wrapper {
276
+ .mealz-store-locator .mealz-pos-item .mealz-bottom .mealz-select-pos-button {
277
+ border-radius: 1000px;
278
+ }
279
+
280
+ .mealz-store-locator #mealz-mobile-buttons-wrapper {
283
281
  display: none;
284
282
  }
285
283
 
286
- #map {
284
+ .mealz-store-locator #mealz-map {
287
285
  width: 100%;
288
286
  min-height: 100%;
289
287
  z-index: 0;
@@ -291,13 +289,22 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
291
289
  top: 0;
292
290
  }
293
291
 
294
- #map .pos-item {
292
+ .mealz-store-locator #mealz-map .mealz-pos-item {
295
293
  border: none;
296
294
  padding: 0;
297
295
  }
298
296
 
297
+ /* Rounded marker icon inside Leaflet map */
298
+ .mealz-store-locator #mealz-map .leaflet-marker-pane .mealz-marker-icon {
299
+ border-radius: 50%;
300
+ overflow: hidden;
301
+ object-fit: cover;
302
+ border: 4px solid var(--mealz-ds-color-neutral-white, #FFFFFF);
303
+ box-sizing: content-box;
304
+ }
305
+
299
306
  @media(max-width: 768px) {
300
- .wrapper {
307
+ .mealz-store-locator .mealz-wrapper {
301
308
  position: absolute;
302
309
  flex-direction: column;
303
310
  top: 0;
@@ -306,111 +313,116 @@ import{f as u,u as m,i as g,h as f,k as n}from"../assets/lit-element-CNB4fo5J.js
306
313
  bottom: 0;
307
314
  }
308
315
 
309
- .pos-selection {
316
+ .mealz-store-locator .mealz-pos-selection {
310
317
  width: 100%;
311
318
  padding: 0;
312
319
  gap: 0;
320
+ }
313
321
 
314
- #store-locator-form {
315
- padding: 24px 16px;
316
- }
322
+ .mealz-store-locator .mealz-pos-selection #mealz-store-locator-form {
323
+ padding: 24px 16px;
317
324
  }
318
325
 
319
- .pos-selection .title {
326
+ .mealz-store-locator .mealz-pos-selection .mealz-title {
320
327
  position: relative;
321
328
  min-height: 56px;
322
329
  font-size: 16px;
323
330
  display: flex;
324
331
  align-items: center;
325
332
  justify-content: center;
326
- border-bottom: solid 1px #D5D5D5;
333
+ border-bottom: solid 1px var(--mealz-ds-color-neutral-200, #D9DDE1);
327
334
  }
328
335
 
329
- .pos-selection .title button {
336
+ .mealz-store-locator .mealz-pos-selection .mealz-title .mealz-back-button {
330
337
  position: absolute;
331
- display: block;
338
+ display: flex;
339
+ transform: rotate(180deg);
332
340
  top: 12px;
333
341
  left: 8px;
334
342
  width: 32px;
335
343
  height: 32px;
336
344
  }
337
345
 
338
- .pos-selection .address-input-container input {
346
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container input {
339
347
  width: calc(100% - 44px);
340
348
  }
341
349
 
342
- .pos-selection .address-input-container button {
350
+ .mealz-store-locator .mealz-pos-selection .mealz-address-input-container button {
343
351
  width: 36px;
344
352
  }
345
353
 
346
- .pos-selection .suppliers-selection-container {
354
+ .mealz-store-locator .mealz-pos-selection .mealz-suppliers-selection-container {
347
355
  width: calc(100% - 32px);
348
356
  margin: 8px 16px 24px 16px;
349
357
  }
350
-
351
- .pos-selection #pos-list {
358
+
359
+ .mealz-store-locator .mealz-pos-selection #mealz-pos-list {
352
360
  padding: 0 16px 12px;
353
361
  align-items: center;
354
362
  }
355
363
 
356
- .pos-list__visible {
364
+ .mealz-store-locator .mealz-pos-list__visible {
357
365
  display: flex;
358
366
  }
359
367
 
360
- .pos-list__hidden {
368
+ .mealz-store-locator .mealz-pos-list__hidden {
361
369
  display: none;
362
370
  }
363
371
 
364
- .pos-selection__height {
372
+ .mealz-store-locator .mealz-pos-selection__height {
365
373
  height: 100%;
366
374
  }
367
375
 
368
- .pos-selection .pos-loader {
376
+ .mealz-store-locator .mealz-pos-selection .mealz-pos-loader {
369
377
  position: absolute;
370
378
  height: 100%;
371
379
  }
372
380
 
373
- .suppliers-list-wrapper__not-mobile {
381
+ .mealz-store-locator .mealz-suppliers-list-wrapper__not-mobile {
374
382
  display: none;
375
383
  }
376
384
 
377
- .suppliers-list-wrapper__mobile {
385
+ .mealz-store-locator .mealz-suppliers-list-wrapper__mobile {
378
386
  display: block;
387
+ }
379
388
 
380
- .suppliers-list {
381
- position: relative;
382
- z-index: 1;
383
- width: calc(100% - 32px);
384
- margin: -16px 16px 8px 16px;
389
+ .mealz-store-locator .mealz-suppliers-list-wrapper__mobile .mealz-suppliers-list {
390
+ position: relative;
391
+ z-index: 1;
392
+ width: calc(100% - 32px);
393
+ margin: -16px 16px 8px 16px;
394
+ }
385
395
 
386
- .suppliers-list__supplier {
387
- padding: 8px 16px;
388
- }
389
- }
396
+ .mealz-store-locator .mealz-suppliers-list-wrapper__mobile .mealz-suppliers-list .mealz-suppliers-list__supplier {
397
+ padding: 8px 16px;
390
398
  }
391
-
392
- #mobile-buttons-wrapper {
399
+
400
+ .mealz-store-locator #mealz-mobile-buttons-wrapper {
393
401
  width: 100%;
394
402
  display: flex;
395
403
  justify-content: center;
396
404
  padding: 12px 0;
397
405
  }
398
406
 
399
- .mobile-buttons-wrapper__see-list {
407
+ .mealz-store-locator #mealz-mobile-buttons-wrapper button {
408
+ border-radius: 1000px;
409
+ }
410
+
411
+ .mealz-store-locator .mealz-mobile-buttons-wrapper__see-list {
400
412
  z-index: 1;
401
413
  bottom: 40px;
402
414
  position: absolute;
403
415
  }
404
416
 
405
- .mobile-buttons-wrapper__see-map {
417
+ .mealz-store-locator .mealz-mobile-buttons-wrapper__see-map {
406
418
  margin-top: auto;
407
419
  }
408
420
 
409
- #map {
421
+ .mealz-store-locator #mealz-map {
410
422
  min-height: unset;
411
423
  position: absolute;
412
424
  bottom: 0;
413
425
  top: 0;
414
426
  }
415
427
  }
416
- `];d([c({type:Boolean})],l.prototype,"show",2);d([c({type:Number})],l.prototype,"selectedRadius",2);d([c({type:GeolocationPosition})],l.prototype,"geolocationCoordinates",1);d([c()],l.prototype,"getByAddress",2);d([c()],l.prototype,"getByCoordinates",2);d([c()],l.prototype,"getAffiliateSuppliers",2);d([v()],l.prototype,"_geolocationCoordinates",2);d([y("input")],l.prototype,"_addressInput",2);l=d([b("mealz-store-locator")],l);customElements.get("mealz-store-locator")||customElements.define("mealz-store-locator",l);
428
+ `];n([d({type:Boolean})],r.prototype,"show",2);n([d({type:Number})],r.prototype,"selectedRadius",2);n([d({attribute:!1})],r.prototype,"geolocationCoordinates",1);n([d()],r.prototype,"getByAddress",2);n([d()],r.prototype,"getByCoordinates",2);n([d()],r.prototype,"getAffiliateSuppliers",2);n([u()],r.prototype,"_geolocationCoordinates",2);n([b("input")],r.prototype,"_addressInput",2);r=n([z("mealz-store-locator")],r);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mealz-components",
3
3
  "type": "module",
4
- "version": "1.3.15",
4
+ "version": "1.3.17",
5
5
  "main": "./dist/mealz-components.js",
6
6
  "module": "./dist/mealz-components.js",
7
7
  "scripts": {
@@ -29,6 +29,7 @@
29
29
  "dist/"
30
30
  ],
31
31
  "dependencies": {
32
+ "@types/leaflet": "^1.9.20",
32
33
  "lit": "^3.1.2",
33
34
  "rxjs": "^7.8.1"
34
35
  },
@@ -1 +0,0 @@
1
- import{h as e}from"./lit-element-CNB4fo5J.js";class r extends e{createRenderRoot(){return this}}export{r as N};