!function(t){"function"==typeof define&&define.amd?define(t):t()}((function(){"use strict";var t=Object.defineProperty,e=(e,n)=>t(e,"name",{value:n,configurable:!0});const n=Symbol("isProxy");function r(t){return t.replace(/\B([A-Z])(?=[a-z])/g,"-$1").replace(/\B([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}function i(t){return t.replace(/-([a-z])/g,(t=>t[1].toUpperCase()))}function s(t,e,n={attributes:!0,childList:!0,subtree:!0}){const r=new MutationObserver(e);return r.observe(t,n),r}function o(t,...e){console.warn(`[Minze warn] ${t}`,...e)}var a;e(r,"camelToDash"),e(i,"dashToCamel"),e(s,"createObserver"),e(o,"warn");const c=(a=class{static define(t,e){customElements.get(t)??customElements.define(t,e)}static defineAll(t,n,r=t=>t.replace(/^\.\/lib\/|\.(ts|js)$/gi,"")){const i=e((t=>"function"==typeof t&&"define"in t&&"function"==typeof t.define),"isMinzeElement");function s(t){i(t)&&t.define()}function o(t){"object"==typeof t&&null!==t&&Object.values(t).forEach((async t=>{s(t)}))}!Array.isArray(t)&&Array.isArray(n)&&n.every((t=>"string"==typeof t))&&(t=a.enhanceModules(t,n,r)),e(s,"defineMinzeElement"),e(o,"defineModule"),Object.values(t).forEach((async t=>{if(i(t))s(t);else if("object"==typeof t||"function"==typeof t){const e="function"==typeof t?await t():t;i(e)?s(e):o(e)}}))}static enhanceModules(t,e,n){return Object.fromEntries(Object.entries(t).map((([t,r])=>(n&&"function"==typeof n&&(t=n(t)),null!=e&&e.includes(t)||!e?[t,r]:[]))).filter((t=>t.length)))}static dispatch(t,e){dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))}static cast(t,e){o("cast is deprecated use dispatch instead."),this.dispatch(t,e)}static listen(t,e){addEventListener(t,e)}static stopListen(t,e){removeEventListener(t,e)}},e(a,"_Minze"),a);c.version="1.10.1";let l=c;function h(t,n,r){const i=e((t=>{t="function"==typeof t?t():t;const e=document.createElement("template");return e.innerHTML=t,e}),"render");d(i(t),r),u(i(t),i(n),r)}function d(t,e){const n=t instanceof HTMLTemplateElement?t.content.childNodes:t.childNodes;n.length===e.childNodes.length?Array.from(n).forEach(((t,n)=>{const r=t,i=e.childNodes[n];r.isEqualNode(i)||(i.nodeType===Node.TEXT_NODE||i.nodeType===Node.COMMENT_NODE?i.textContent=r.textContent:i.nodeType===Node.ELEMENT_NODE&&d(r,i))})):e.textContent=t.textContent}function u(t,n,r){const i=e((t=>t instanceof HTMLTemplateElement?t.content.children:t.children),"children"),s=i(t),o=i(n);s.length===r.children.length?Array.from(s).some(((t,e)=>{const n=t,i=o[e],s=r.children[e];if(!n.isEqualNode(s)){if(n.nodeName!==s.nodeName)return void s.replaceWith(n);Array.from(n.attributes).forEach((t=>{t.value!==s.getAttribute(t.name)&&s.setAttribute(t.name,t.value)})),Array.from(s.attributes).forEach((t=>{!n.hasAttribute(t.name)&&i.hasAttribute(t.name)&&s.removeAttribute(t.name)})),u(n,i,s)}})):r.innerHTML=t.innerHTML}var p;e(h,"deepPatch"),e(d,"deepPatchText"),e(u,"deepPatchElement");const m=(p=class extends HTMLElement{constructor(){super(),this._html={cached:null,template:async()=>{var t;return(null==(t=this.html)?void 0:t.call(this))??"<slot></slot>"}},this._css={cached:null,template:async()=>{var t,e,n;const r=(null==(t=this.options)?void 0:t.cssReset)||void 0===(null==(e=this.options)?void 0:e.cssReset);return`\n        @layer reset, default; @layer reset {\n          :host { box-sizing: border-box; display: block; }\n          :host([hidden]) { display: none; }\n          :where(*, ::before, ::after, :host::before, :host::after):not([no-css-reset]) { box-sizing: border-box; ${r?"color: inherit; text-decoration: inherit; font-size: inherit; line-height: inherit; font-weight: inherit; font-family: inherit; text-indent: 0; background-color: transparent; border: 0 solid transparent; padding: 0; margin: 0;":""}}\n          ${r?'\n          :where(table):not([no-css-reset]) { border-color: inherit; border-collapse: collapse; }\n          :where(img, svg, video, canvas, audio, iframe, embed, object):not([no-css-reset]) { display: block; max-width: 100%; height: auto; }\n          :where(button, [role="button"]):not([no-css-reset]) { font-size: 100%; text-transform: none; cursor: pointer; }\n          ':""}}\n        ${`@layer default {${null==(n=this.css)?void 0:n.call(this)}}`??""}\n      `}},this.attachShadow({mode:"open"})}static get dashName(){return r(this.name)}get dashName(){return r(this.constructor.name)}get name(){return this.constructor.name}static define(t){t??(t=r(this.name)),customElements&&(customElements.get(t)??customElements.define(t,this))}async render(t){var e,n,r,i,s;if(this.shadowRoot){const o=await this._html.template(),a=await this._css.template();if((a!==this._css.cached||t)&&(async()=>{this._css.cached=a,this.shadowRoot&&(this.shadowRoot.adoptedStyleSheets=[await(new CSSStyleSheet).replace(a)])})(),o!==this._html.cached||t){const a=this._html.cached;this._html.cached=o,await(null==(e=this.beforeRender)?void 0:e.call(this)),null==(n=this._eventListeners)||n.forEach((async t=>this.registerEvent(t,"remove"))),!a||t?this.shadowRoot.innerHTML=o:h(o,a,this.shadowRoot);const c=await this.mergeEvents(this._eventListeners,this.html);this._eventListeners=await this.bindEvents(c),null==(r=this._eventListeners)||r.forEach((async t=>this.registerEvent(t,"add"))),null==(i=this.afterRender)||i.call(this),null==(s=this.onRender)||s.call(this)}}}async renderWithTransition(t){var e;null!=(e=this.options)&&e.viewTransitions&&document.startViewTransition?document.startViewTransition((async()=>this.render(t))):this.render(t)}rerender(){this.renderWithTransition(!0)}select(t){const e=this.shadowRoot;return(null==e?void 0:e.querySelector(t))??null}selectAll(t){const e=this.shadowRoot;return(null==e?void 0:e.querySelectorAll(t))??null}slotted(t){var e;const n=this.selectAll("slot");if(n){const r="default"===t||void 0===t?"":t,i=Array.from(n).filter((t=>t.name===r));return(null==(e=null==i?void 0:i[0])?void 0:e.assignedElements())??null}return null}exposeAttr(t,e){const n=r(t);this.setAttribute(n,"object"==typeof e?JSON.stringify(e):String(e))}async reactiveChange(t,e,n,i,s,o){var a;const c=e,l=r(e);null==(a=this.watch)||a.forEach((async([e,r])=>{(e===c||"attr"===t&&e===l)&&(r=r.bind(this))(s,o,i,n)})),this.renderWithTransition()}makeComplexReactive(t,r,i){const s=t,o=r;i&&this.exposeAttr(s,o);const a=e((()=>({get:(t,e)=>{if(e===n)return!0;let r=Reflect.get(t,e);return"object"==typeof r&&r&&!r[n]&&(r=c(r),Reflect.set(t,e,r)),r},set:(t,e,n)=>{const r=Reflect.get(t,e);return r!==n&&(Reflect.set(t,e,n),i&&this.exposeAttr(s,o),this.reactiveChange("complex",s,t,e,n,r)),!0}})),"createTrap"),c=e((t=>new Proxy(t,a())),"createProxy");this[s]=c(o)}makePrimitiveReactive(t,e,n){const r=t,i=`_$reactive-${t}`;this[i]=e,n&&this.exposeAttr(t,e),Object.defineProperty(this,t,{get:()=>this[i],set:e=>{const s=this[i];s!==e&&(this[i]=e,n&&this.exposeAttr(t,e),this.reactiveChange("primitive",r,this,r,e,s))}})}registerProp(t){const e="string"==typeof t?t:t[0],n="string"==typeof t?null:t[1],r="string"==typeof t?void 0:t[2],i=e;i in this?o(`A property with the name "${i}" already exists in this component.`):n&&"object"==typeof n?this.makeComplexReactive(i,n,r):this.makePrimitiveReactive(i,n,r)}registerAttr(t){const e="string"==typeof t?t:t[0],n="string"==typeof t?null:t[1],r=i(e),s=e,a=r,c="object"==typeof n?JSON.stringify(n):String(n);if(r in this)return void o(`A property with the name "${r}" already exists.`);const l=`_$attr-${r}`;this[l]=c,Array.isArray(t)&&2===t.length&&!this.getAttribute(s)&&this.setAttribute(s,c),Object.defineProperty(this,r,{get:()=>{var t;const e=null==(t=this.getAttribute(s))?void 0:t.trim();if(null==e)return null;if("undefined"!==e){if(""===e)return!0;try{return JSON.parse(e)}catch{return e}}},set:t=>{const e=this[l];e!==t&&(this[l]=t,this.reactiveChange("attr",a,this,a,t,e))}})}async mergeEvents(t,n){if(!n)return t;n="function"==typeof n?n():n;const r=new RegExp("(?<=\\s+)(?:on:|@)([\\w\\-:.]+)(?:=(?:\"|')?(\\w+)(?:\"|')?)?(?=\\s+|\\/|>)","gi"),i=[...new Set([...n.matchAll(r)].map((t=>JSON.stringify(t.slice(0,3)))))].map((t=>JSON.parse(t))),s=i.length,o=(null==t?void 0:t.length)??0;if(s&&o!==o+s){t??(t=[]);const n=e((t=>t.replace(/(@|:|\.)/g,((t,e)=>`\\${e}`))),"escape");return i.map((([t,e,r])=>[`[${n(t)}]`,e,this[r??e]]))}return t}async bindEvents(t){if(t)return t.map((t=>{const e=t[2];return e&&this[e.name]&&!e.name.startsWith("bound ")&&(t[2]=e.bind(this)),t}))}registerEvent(t,e){var n;const[r,i,s]=t;let o;r===window||r instanceof BroadcastChannel?o=[r]:r instanceof p?o=[this]:"string"==typeof r&&(o=null==(n=this.shadowRoot)?void 0:n.querySelectorAll(r)),null==o||o.forEach((t=>{"add"===e?t.addEventListener(i,s):t.removeEventListener(i,s)}))}dispatch(t,e){this.dispatchEvent(new CustomEvent(t,{detail:e,bubbles:!0,composed:!0,cancelable:!0}))}cast(t,e){o("cast is deprecated use dispatch instead."),this.dispatch(t,e)}exportParts(t){t="function"==typeof t?t():t;const e=[...new Set([...t.matchAll(/(?:part|exportparts)=["']?([\w\-_,\s]+)["']?/gi)].flatMap((t=>{var e;return null==(e=t.at(1))?void 0:e.trim().replace(/,?\s+/g,",").split(",")})))].sort();e.length&&this.setAttribute("exportparts",e.join(", "))}registerExportpartsObserver(t){const n="_exportpartsObserver",r="add"===t&&!this[n],i="remove"===t&&this[n];if(r&&this.shadowRoot){const t=e((t=>{t&&this.shadowRoot&&this.exportParts(this.shadowRoot.innerHTML)}),"callback"),r={subtree:!0,attributeFilter:["exportparts"]};this[n]=s(this.shadowRoot,t,r)}else i&&(this[n].disconnect(),delete this[n])}debuglog(){if(!console)return;const t=Object.fromEntries(["onStart","onReactive","beforeRender","afterRender","onReady","onDestroy","onMove","beforeAttributeChange","afterAttributeChange"].filter((t=>this[t])).map((t=>[[t],this[t]])));console.groupCollapsed(`%c[Minze: ${this.name}] 🚧`,"color: rgb(110, 150, 245);"),[["Class: %O",this],["Element: %o",this]].forEach((([t,e])=>console.log(t,e))),console.groupCollapsed("Internals"),[["🧨 eventListeners: %o",this._eventListeners],["🪝 hooks: %o",Object.keys(t).length?t:void 0],["🔩 options: %o",this.options],["🧬 reactive: %o",{attrs:this.attrs,observedAttributes:this.constructor.observedAttributes,reactive:this.reactive,watch:this.watch}],["✨ template: %o",{css:this._css,html:this._html}]].forEach((([t,e])=>console.log(t,e))),console.groupEnd(),console.groupEnd()}async connectedCallback(){var t,e,n,r,i,s,o,a,c;null==(t=this.onStart)||t.call(this),this.eventListeners&&(this._eventListeners=[...this.eventListeners]),null==(e=this.reactive)||e.forEach((async t=>this.registerProp(t))),null==(n=this.attrs)||n.forEach((async t=>this.registerAttr(t))),null==(r=this.onReactive)||r.call(this),null!=(s=null==(i=this.options)?void 0:i.exposeAttrs)&&s.exportparts&&(this.html&&this.exportParts(this.html),this.registerExportpartsObserver("add")),await this.render(),null!=(a=null==(o=this.options)?void 0:o.exposeAttrs)&&a.rendered&&this.setAttribute("rendered",""),null==(c=this.onReady)||c.call(this),this.debug&&this.debuglog()}async disconnectedCallback(){var t,e,n,r;this._html.cached=null,this._css.cached=null,null!=(e=null==(t=this.options)?void 0:t.exposeAttrs)&&e.exportparts&&this.registerExportpartsObserver("remove"),null==(n=this._eventListeners)||n.forEach((async t=>this.registerEvent(t,"remove"))),null==(r=this.onDestroy)||r.call(this)}async adoptedCallback(){var t,e;null==(t=this._eventListeners)||t.forEach((async t=>this.registerEvent(t,"remove"))),null==(e=this.onMove)||e.call(this)}async attributeChangedCallback(t,e,n){var r,s,o;await(null==(r=this.beforeAttributeChange)?void 0:r.call(this,t,e,n));const a=i(t);a in this&&n!==e&&(this[a]=n),null==(s=this.afterAttributeChange)||s.call(this,t,e,n),null==(o=this.onAttributeChange)||o.call(this,t,e,n)}},e(p,"_MinzeElement"),p);m.version="1.10.1",m.isMinzeElement=!0;let v=m;const g=Object.freeze(Object.defineProperty({__proto__:null,MauveLoadingIndicator:class MauveLoadingIndicator extends v{constructor(){super(...arguments),this.options={exposeAttrs:{exportparts:!0}},this.attrs=["no-style"],this.html=()=>'\n    <div part="mauve-loading-indicator"></div>\n  ',this.css=()=>this.noStyle?"":"\n    :host {\n      display: flex;\n      justify-content: center;\n      align-items: center;\n      grid-column: 1 / -1;\n    }\n\n    [part=mauve-loading-indicator] {\n      pointer-events: none;\n      width: 42px;\n      height: 42px;\n      border: 6px solid transparent;\n      border-color: var(--mauve-loading-indicator-color-bg, rgb(230 230 230));\n      border-top-color: var(--mauve-loading-indicator-color-fg, rgb(20 99 159));\n      border-radius: 50%;\n      animation: spin 1s linear infinite;\n    }\n\n    @keyframes spin {\n      100% {\n        transform: rotate(360deg);\n      }\n    }\n  "}},MauveProduct:class MauveProduct extends v{constructor(){super(...arguments),this.options={exposeAttrs:{exportparts:!0}},this.attrs=["no-style","product-data"],this.html=()=>{var t,e,n,r,i,s,o,a,c,l,h,d;return`\n    <a\n      href="${null==(t=this.productData)?void 0:t.shopUrl}"\n      target="_blank"\n      part="mauve-product__image"\n    >\n      <img\n        src="${null==(e=this.productData)?void 0:e.listImageUrl}"\n        loading="lazy"\n        width="120"\n        height="120"\n        onerror="this.src = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxIiBzdHJva2U9InJnYigyMzAgMjMwIDIzMCkiIGNsYXNzPSJ3LTYgaC02Ij4gPHBhdGggc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBkPSJNMi4yNSAxNS43NWw1LjE1OS01LjE1OWEyLjI1IDIuMjUgMCAwMTMuMTgyIDBsNS4xNTkgNS4xNTltLTEuNS0xLjVsMS40MDktMS40MDlhMi4yNSAyLjI1IDAgMDEzLjE4MiAwbDIuOTA5IDIuOTA5bS0xOCAzLjc1aDE2LjVhMS41IDEuNSAwIDAwMS41LTEuNVY2YTEuNSAxLjUgMCAwMC0xLjUtMS41SDMuNzVBMS41IDEuNSAwIDAwMi4yNSA2djEyYTEuNSAxLjUgMCAwMDEuNSAxLjV6bTEwLjUtMTEuMjVoLjAwOHYuMDA4aC0uMDA4VjguMjV6bS4zNzUgMGEuMzc1LjM3NSAwIDExLS43NSAwIC4zNzUuMzc1IDAgMDEuNzUgMHoiIC8+PC9zdmc+'"\n      >\n    </a>\n\n    <div part="mauve-product__caption">\n      Abb. ähnlich\n    </div>\n\n    <a\n      href="${null==(n=this.productData)?void 0:n.shopUrl}"\n      target="_blank"\n      part="mauve-product__name"\n    >\n      ${null==(r=this.productData)?void 0:r.name}\n    </a>\n\n    <div part="mauve-product__property">\n      Artikelnummer: ${null==(i=this.productData)?void 0:i.sku}\n    </div>\n\n    <div part="mauve-product__price">\n      ${this.formatPrice(null==(s=this.productData)?void 0:s.price)}${null==(o=this.productData)?void 0:o.currencySymbol}\n\n      ${(null==(a=this.productData)?void 0:a.suggestedRetailPrice)?`<span part="mauve-product__suggested-price">\n              ${this.formatPrice(null==(c=this.productData)?void 0:c.suggestedRetailPrice)}${null==(l=this.productData)?void 0:l.currencySymbol}\n            </span>`:""}\n    </div>\n\n    ${Number(null==(h=this.productData)?void 0:h.suggestedRetailPrice)>Number(null==(d=this.productData)?void 0:d.price)?'<div part="mauve-product__sale-badge">SALE</div>':""}\n  `},this.css=()=>this.noStyle?"":"\n    :host {\n      display: flex;\n      flex-direction: column;\n      position: relative;\n      background: var(--mauve-product-background, rgb(255 255 255));\n      border: 1px solid var(--mauve-product-border-color, rgb(230 230 230));\n      padding: 20px 15px 15px 15px;\n    }\n\n    [part^=mauve-] {\n      transition: all .125s ease-in-out;\n    }\n\n    [part=mauve-product__image] {\n      display: flex;\n      justify-content: center;\n      width: auto;\n      height: 120px;\n      margin-bottom: 8px;\n    }\n\n    [part=mauve-product__image] img {\n      width: auto;\n      height: 100%;\n      max-width: 100%;\n    }\n\n    [part=mauve-product__image]:hover {\n      opacity: 80%;\n    }\n\n    [part=mauve-product__caption] {\n      color: var(--mauve-product__caption-color, rgb(135 149 161));\n      font-size: 10px;\n      margin-bottom: 12px;\n    }\n\n    [part=mauve-product__name] {\n      display: -webkit-box;\n      color: var(--mauve-product__name-color, rgb(20 99 159));\n      font-size: 15px;\n      font-weight: 700;\n      line-height: 1.5rem;\n      text-decoration: none;\n      overflow: hidden;\n      -webkit-line-clamp: 2;\n      -webkit-box-orient: vertical;\n      margin-bottom: 4px;\n    }\n\n    [part=mauve-product__name]:hover {\n      color: var(--mauve-product__name-color-hover, rgb(135 181 210));\n    }\n\n    [part=mauve-product__property] {\n      color: var(--mauve-product__property-color, rgb(96 111 123));\n      font-size: 11px;\n      margin-top: 4px;\n    }\n\n    [part=mauve-product__price] {\n      color: var(--mauve-product__price-color, rgb(20 20 20));\n      font-size: 15px;\n      font-weight: 700;\n      padding-top: 16px;\n      margin-top: auto;\n    }\n\n    [part=mauve-product__suggested-price] {\n      color: var(--mauve-product__suggested-price-color, rgb(255 0 0));\n      text-decoration: line-through;\n      font-size: 13px;\n      font-weight: 400;\n      margin-left: 4px;\n    }\n\n    [part=mauve-product__sale-badge] {\n      background: var(--mauve-product__sale-badge-background, rgb(255 0 0));\n      color: var(--mauve-product__sale-badge-color, rgb(255 255 255));\n      font-size: 12px;\n      font-weight: 700;\n      padding: 4px 8px;\n      position: absolute;\n      top: 0;\n      left: 0;\n    }\n  "}formatPrice(t){return void 0!==t?t.toFixed(2).replace(".",","):""}},MauveProducts:class MauveProducts extends v{constructor(){super(...arguments),this.options={exposeAttrs:{exportparts:!0}},this.reactive=[["products",null]],this.attrs=["no-style",["columns",[["640px",2],["1024px",3],["1536px",4]]],["key"],["category-id",1],["limit",8]],this.html=()=>{var t;return`${this.products?null==(t=this.products)?void 0:t.map((t=>`\n        <mauve-product\n          no-css-reset\n          part="mauve-product"\n          product-data='${JSON.stringify(t)}'\n          ${this.noStyle?"no-style":""}\n        ></mauve-product>\n      `)).join(""):`<mauve-loading-indicator\n        no-css-reset\n        ${this.noStyle?"no-style":""}\n      ></mauve-loading-indicator>`}`},this.css=()=>`\n    :host {\n      display: -ms-grid;\n      display: grid;\n      -ms-grid-columns: repeat(1, 1fr);\n      grid-template-columns: repeat(1, 1fr);\n      grid-gap: var(--mauve-products-grid-gap, 15px);\n    }\n\n    ${this.columns.map((([t,e])=>`\n      @media (min-width: ${t}) {\n        :host { grid-template-columns: repeat(${e}, minmax(0, 1fr)); }\n      }\n    `)).join("")}\n  `}get api(){return{key:this.key??"MxkfPYaITzUlaILwRU2EbohHswPoSOob",url:"https://shop.api.mauve.de"}}async getCategory(t,e){const n=`${this.api.url}/categories/${t}/products?limit=${e}`,r=await fetch(n,{method:"GET",headers:{Authorization:`Bearer ${this.api.key}`}});return(await r.json()).products}async onReactive(){try{this.products=await this.getCategory(this.categoryId,this.limit)}catch(t){console.error(t)}}}},Symbol.toStringTag,{value:"Module"}));l.defineAll(g)}));
