var KachingBundlesBlock=function(){"use strict";var t=Object.defineProperty,e=(e,n,a)=>(((e,n,a)=>{n in e?t(e,n,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[n]=a})(e,"symbol"!=typeof n?n+"":n,a),a);function n(){}function a(t){return t()}function i(){return Object.create(null)}function r(t){t.forEach(a)}function s(t){return"function"==typeof t}function c(t,e){return t!=t?e==e:t!==e||t&&"object"==typeof t||"function"==typeof t}let o,l;function u(t,e){return t===e||(o||(o=document.createElement("a")),o.href=e,t===o.href)}function d(t,e){t.appendChild(e)}function h(t,e,n){t.insertBefore(e,n||null)}function m(t){t.parentNode&&t.parentNode.removeChild(t)}function p(t,e){for(let n=0;nt.removeEventListener(e,n,a)}function v(t,e,n){null==n?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function _(t,e){e=""+e,t.data!==e&&(t.data=e)}function k(t,e){t.value=null==e?"":e}function S(t,e,n){for(let a=0;a{const i=t.$$.callbacks[e];if(i){const r=function(t,e,{bubbles:n=!1,cancelable:a=!1}={}){return new CustomEvent(t,{detail:e,bubbles:n,cancelable:a})}(e,n,{cancelable:a});return i.slice().forEach((e=>{e.call(t,r)})),!r.defaultPrevented}return!0}}const T=[],V=[];let M=[];const L=[],O=Promise.resolve();let E=!1;function F(){E||(E=!0,O.then(A))}function N(t){M.push(t)}const q=new Set;let D=0;function A(){if(0!==D)return;const t=l;do{try{for(;D{Q.delete(t),a&&(n&&t.d(1),a())})),t.o(e)}else a&&a()}function K(t){return void 0!==(null==t?void 0:t.length)?t:Array.from(t)}function W(t){t&&t.c()}function X(t,e,n){const{fragment:i,after_update:c}=t.$$;i&&i.m(e,n),N((()=>{const e=t.$$.on_mount.map(a).filter(s);t.$$.on_destroy?t.$$.on_destroy.push(...e):r(e),t.$$.on_mount=[]})),c.forEach(N)}function Y(t,e){const n=t.$$;null!==n.fragment&&(!function(t){const e=[],n=[];M.forEach((a=>-1===t.indexOf(a)?e.push(a):n.push(a))),n.forEach((t=>t())),M=e}(n.after_update),r(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function tt(t,e,a,s,c,o,u=null,d=[-1]){const h=l;z(t);const p=t.$$={fragment:null,ctx:[],props:o,update:n,not_equal:c,bound:i(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(h?h.$$.context:[])),callbacks:i(),dirty:d,skip_bound:!1,root:e.target||h.$$.root};u&&u(p.root);let $=!1;if(p.ctx=a?a(t,e.props||{},((e,n,...a)=>{const i=a.length?a[0]:n;return p.ctx&&c(p.ctx[e],p.ctx[e]=i)&&(!p.skip_bound&&p.bound[e]&&p.bound[e](i),$&&function(t,e){-1===t.$$.dirty[0]&&(T.push(t),F(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<(e[t].attribute||t).toLowerCase()))}};return Object.keys(e).forEach((t=>{Object.defineProperty(s.prototype,t,{get(){return this.$$c&&t in this.$$c?this.$$c[t]:this.$$d[t]},set(n){var a;n=et(t,n,e),this.$$d[t]=n,null==(a=this.$$c)||a.$set({[t]:n})}})})),a.forEach((t=>{Object.defineProperty(s.prototype,t,{get(){var e;return null==(e=this.$$c)?void 0:e[t]}})})),r&&(s=r(s)),t.element=s,s}"function"==typeof HTMLElement&&(j=class extends HTMLElement{constructor(t,n,a){super(),e(this,"$$ctor"),e(this,"$$s"),e(this,"$$c"),e(this,"$$cn",!1),e(this,"$$d",{}),e(this,"$$r",!1),e(this,"$$p_d",{}),e(this,"$$l",{}),e(this,"$$l_u",new Map),this.$$ctor=t,this.$$s=n,a&&this.attachShadow({mode:"open"})}addEventListener(t,e,n){if(this.$$l[t]=this.$$l[t]||[],this.$$l[t].push(e),this.$$c){const n=this.$$c.$on(t,e);this.$$l_u.set(e,n)}super.addEventListener(t,e,n)}removeEventListener(t,e,n){if(super.removeEventListener(t,e,n),this.$$c){const t=this.$$l_u.get(e);t&&(t(),this.$$l_u.delete(e))}}async connectedCallback(){if(this.$$cn=!0,!this.$$c){let t=function(t){return()=>{let e;return{c:function(){e=$("slot"),"default"!==t&&v(e,"name",t)},m:function(t,n){h(t,e,n)},d:function(t){t&&m(e)}}}};if(await Promise.resolve(),!this.$$cn||this.$$c)return;const e={},n=function(t){const e={};return t.childNodes.forEach((t=>{e[t.slot||"default"]=!0})),e}(this);for(const i of this.$$s)i in n&&(e[i]=[t(i)]);for(const i of this.attributes){const t=this.$$g_p(i.name);t in this.$$d||(this.$$d[t]=et(t,i.value,this.$$p_d,"toProp"))}for(const i in this.$$p_d)i in this.$$d||void 0===this[i]||(this.$$d[i]=this[i],delete this[i]);this.$$c=new this.$$ctor({target:this.shadowRoot||this,props:{...this.$$d,$$slots:e,$$scope:{ctx:[]}}});const a=()=>{this.$$r=!0;for(const t in this.$$p_d)if(this.$$d[t]=this.$$c.$$.ctx[this.$$c.$$.props[t]],this.$$p_d[t].reflect){const e=et(t,this.$$d[t],this.$$p_d,"toAttribute");null==e?this.removeAttribute(this.$$p_d[t].attribute||t):this.setAttribute(this.$$p_d[t].attribute||t,e)}this.$$r=!1};this.$$c.$$.after_update.push(a),a();for(const i in this.$$l)for(const t of this.$$l[i]){const e=this.$$c.$on(i,t);this.$$l_u.set(t,e)}this.$$l={}}}attributeChangedCallback(t,e,n){var a;this.$$r||(t=this.$$g_p(t),this.$$d[t]=et(t,n,this.$$p_d,"toProp"),null==(a=this.$$c)||a.$set({[t]:this.$$d[t]}))}disconnectedCallback(){this.$$cn=!1,Promise.resolve().then((()=>{!this.$$cn&&this.$$c&&(this.$$c.$destroy(),this.$$c=void 0)}))}$$g_p(t){return Object.keys(this.$$p_d).find((e=>this.$$p_d[e].attribute===t||!this.$$p_d[e].attribute&&e.toLowerCase()===t))||t}});class at{constructor(){e(this,"$$"),e(this,"$$set")}$destroy(){Y(this,1),this.$destroy=n}$on(t,e){if(!s(e))return n;const a=this.$$.callbacks[t]||(this.$$.callbacks[t]=[]);return a.push(e),()=>{const t=a.indexOf(e);-1!==t&&a.splice(t,1)}}$set(t){var e;this.$$set&&(e=t,0!==Object.keys(e).length)&&(this.$$.skip_bound=!0,this.$$set(t),this.$$.skip_bound=!1)}}function it(t){const e={bold:"bold",light:"300",medium:"500",regular:"normal"};for(const n in e)if(t.includes(n))return e[n];return"normal"}function rt(t){return t.includes("italic")?"italic":"normal"}function st(t){return`rgba(${t.red}, ${t.green}, ${t.blue}, ${t.alpha})`}function ct(t){return Object.entries(t).reduce(((t,[e,n])=>(n&&t.push(`--${e}:${n}`),t)),[]).join(";")}function ot(t){const{colors:e,fonts:n,cornerRadius:a,imageSize:i,imageCornerRadius:r}=t,s=e.border||e.primary;return ct({"block-title-color":st(e.title),"block-title-font-size":n.blockTitle.size+"px","block-title-font-weight":it(n.blockTitle.style),"block-title-font-style":rt(n.blockTitle.style),"bar-border-radius":(a||0)+"px","bar-background-color":st(e.background),"bar-selected-background-color":st(e.selectedBackground||e.background),"bar-border-color":st({...s,alpha:.3*s.alpha}),"bar-selected-border-color":st(s),"block-block-title-color":st(e.blockTitle||e.title),"bar-title-color":st(e.title),"bar-title-font-size":n.title.size+"px","bar-title-font-weight":it(n.title.style),"bar-title-font-style":rt(n.title.style),"bar-subtitle-color":st(e.subtitle),"bar-subtitle-font-size":n.subtitle.size+"px","bar-subtitle-font-weight":it(n.subtitle.style),"bar-subtitle-font-style":rt(n.subtitle.style),"bar-price-color":st(e.price||e.title),"bar-full-price-color":st(e.fullPrice||e.subtitle),"bar-label-border-top-radius":(a?a-1:0)+"px","bar-label-background-color":st(e.labelBackground),"bar-label-color":st(e.label),"bar-label-font-size":n.label.size+"px","bar-label-font-weight":it(n.label.style),"bar-label-font-style":rt(n.label.style),"bar-most-popular-background-color":st(e.badgeBackground),"bar-most-popular-color":st(e.badgeText),"bar-variant-select-border-radius":(a||0)/2+"px","bar-image-size":(i||48)+"px","bar-image-border-radius":(r||0)+"px","kaching-free-gift-background-color":e.freeGiftBackground&&st(e.freeGiftBackground),"kaching-free-gift-text-color":e.freeGiftText&&st(e.freeGiftText),"kaching-free-gift-selected-background-color":e.freeGiftSelectedBackground&&st(e.freeGiftSelectedBackground),"kaching-free-gift-selected-text-color":e.freeGiftSelectedText&&st(e.freeGiftSelectedText),"kaching-free-gift-font-size":n.freeGift&&n.freeGift.size+"px","kaching-free-gift-font-weight":n.freeGift&&it(n.freeGift.style),"kaching-free-gift-font-style":n.freeGift&&rt(n.freeGift.style),"kaching-free-gift-image-border-radius":(a||0)/2+"px"})}"undefined"!=typeof window&&(window.__svelte||(window.__svelte={v:new Set})).v.add("4");const lt={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]},ut=t=>{const e=t.replace(/[^a-zA-Z]+/g,"").toLowerCase();if(!(e in lt))return;const n=lt[e];return{red:n[0],green:n[1],blue:n[2],alpha:1}},dt=(t,e)=>({red:Math.max(0,t.red-Math.round(t.red*e)),green:Math.max(0,t.green-Math.round(t.green*e)),blue:Math.max(0,t.blue-Math.round(t.blue*e)),alpha:t.alpha});function ht(t){let e;return{c(){e=$("div"),v(e,"class","kaching-bundles__swatch"),v(e,"style",t[0])},m(t,n){h(t,e,n)},p(t,[n]){1&n&&v(e,"style",t[0])},i:n,o:n,d(t){t&&m(e)}}}function mt(t,e,n){let a,{color:i}=e,{image:r}=e,{size:s}=e,{shape:c}=e,o="";return t.$$set=t=>{"color"in t&&n(1,i=t.color),"image"in t&&n(2,r=t.image),"size"in t&&n(3,s=t.size),"shape"in t&&n(4,c=t.shape)},t.$$.update=()=>{if(2&t.$$.dirty&&n(5,a=i?function(t){t=t.replace(/^#/,"");let e=parseInt(t,16);return{red:e>>16&255,green:e>>8&255,blue:255&e,alpha:1}}(i):null),60&t.$$.dirty){let t={"kaching-swatch-size":`${s-2}px`};const e={rounded:20,circle:50}[c];e&&(t={...t,"kaching-swatch-border-radius":`${e}%`}),r?t={...t,"kaching-swatch-image-url":`url(${r})`}:a&&(t={...t,"kaching-swatch-color":st(a),"kaching-swatch-border-color":st(dt(a,.1))}),n(0,o=ct(t))}},[o,i,r,s,c,a]}class pt extends at{constructor(t){super(),tt(this,t,mt,ht,c,{color:1,image:2,size:3,shape:4})}get color(){return this.$$.ctx[1]}set color(t){this.$$set({color:t}),A()}get image(){return this.$$.ctx[2]}set image(t){this.$$set({image:t}),A()}get size(){return this.$$.ctx[3]}set size(t){this.$$set({size:t}),A()}get shape(){return this.$$.ctx[4]}set shape(t){this.$$set({shape:t}),A()}}function $t(t,e,n){const a=t.slice();return a[13]=e[n],a[15]=n,a}function ft(t){let e,n,a=K(t[0].optionValues),i=[];for(let s=0;sJ(i[t],1,1,(()=>{i[t]=null}));return{c(){e=$("div");for(let t=0;t{x=null})),U()),(!f||1&n&&p!==(p=t[0].name))&&v(e,"data-name",p)},i(t){f||(Z(i.$$.fragment,t),Z(x),f=!0)},o(t){J(i.$$.fragment,t),J(x),f=!1},d(t){t&&m(e),Y(i),x&&x.d(),y=!1,r(k)}}}function yt(t,e){const n=n=>{t.contains(n.target)||e()};return document.addEventListener("click",n,!0),{destroy(){document.removeEventListener("click",n,!0)}}}function wt(t,e,n){let a,{option:i}=e,{swatchSize:r}=e,{swatchShape:s}=e,{value:c}=e,o=!1;const l=G();function u(t){n(3,o=!o),t.preventDefault()}function d(t){n(8,c=t),n(3,o=!1),l("change",c)}return t.$$set=t=>{"option"in t&&n(0,i=t.option),"swatchSize"in t&&n(1,r=t.swatchSize),"swatchShape"in t&&n(2,s=t.swatchShape),"value"in t&&n(8,c=t.value)},t.$$.update=()=>{257&t.$$.dirty&&n(4,a=i.optionValues.find((t=>t.name===c)))},[i,r,s,o,a,u,function(){n(3,o=!1)},d,c,t=>("Enter"===t.key||" "===t.key)&&u(t),t=>d(t.name),(t,e)=>("Enter"===e.key||" "===e.key)&&d(t.name)]}nt(pt,{color:{},image:{},size:{},shape:{}},[],[],!0);class vt extends at{constructor(t){super(),tt(this,t,wt,bt,c,{option:0,swatchSize:1,swatchShape:2,value:8})}get option(){return this.$$.ctx[0]}set option(t){this.$$set({option:t}),A()}get swatchSize(){return this.$$.ctx[1]}set swatchSize(t){this.$$set({swatchSize:t}),A()}get swatchShape(){return this.$$.ctx[2]}set swatchShape(t){this.$$set({swatchShape:t}),A()}get value(){return this.$$.ctx[8]}set value(t){this.$$set({value:t}),A()}}function _t(t,e,n){const a=t.slice();return a[4]=e[n],a}function kt(t){let e,n,a,i,r,s=t[4].name+"";return{c(){e=$("option"),n=g(s),a=b(),e.__value=i=t[4].name,k(e,e.__value),v(e,"class","kaching-bundles-option-value"),v(e,"data-value",r=t[4].name)},m(t,i){h(t,e,i),d(e,n),d(e,a)},p(t,a){1&a&&s!==(s=t[4].name+"")&&_(n,s),1&a&&i!==(i=t[4].name)&&(e.__value=i,k(e,e.__value)),1&a&&r!==(r=t[4].name)&&v(e,"data-value",r)},d(t){t&&m(e)}}}function St(t){let e,a,i,r,s=K(t[0].optionValues),c=[];for(let n=0;n{"option"in t&&n(0,a=t.option),"value"in t&&n(1,i=t.value)},[a,i,function(t){r("change",t.target.value)}]}nt(vt,{option:{},swatchSize:{},swatchShape:{},value:{}},[],[],!0);class It extends at{constructor(t){super(),tt(this,t,xt,St,c,{option:0,value:1})}get option(){return this.$$.ctx[0]}set option(t){this.$$set({option:t}),A()}get value(){return this.$$.ctx[1]}set value(t){this.$$set({value:t}),A()}}function zt(t,e,n){const a=t.slice();return a[8]=e[n],a[10]=n,a}function Bt(t){let e,n,a,i,s,c,o,l;function u(){return t[5](t[8])}function p(...e){return t[6](t[8],...e)}return n=new pt({props:{color:t[8].swatch.color,image:t[8].swatch.image,size:t[2],shape:t[3]}}),{c(){e=$("span"),W(n.$$.fragment),a=b(),v(e,"role","button"),v(e,"tabindex",t[10]),v(e,"class","kaching-bundles__swatch-buttons__button kaching-bundles-option-value"),v(e,"title",i=t[8].name),v(e,"data-value",s=t[8].name),x(e,"kaching-bundles__swatch-buttons__button--selected",t[8].name===t[0])},m(t,i){h(t,e,i),X(n,e,null),d(e,a),c=!0,o||(l=[w(e,"click",u),w(e,"keydown",p)],o=!0)},p(a,r){t=a;const o={};2&r&&(o.color=t[8].swatch.color),2&r&&(o.image=t[8].swatch.image),4&r&&(o.size=t[2]),8&r&&(o.shape=t[3]),n.$set(o),(!c||2&r&&i!==(i=t[8].name))&&v(e,"title",i),(!c||2&r&&s!==(s=t[8].name))&&v(e,"data-value",s),(!c||3&r)&&x(e,"kaching-bundles__swatch-buttons__button--selected",t[8].name===t[0])},i(t){c||(Z(n.$$.fragment,t),c=!0)},o(t){J(n.$$.fragment,t),c=!1},d(t){t&&m(e),Y(n),o=!1,r(l)}}}function Pt(t){let e,n,a,i=K(t[1].optionValues),r=[];for(let c=0;cJ(r[t],1,1,(()=>{r[t]=null}));return{c(){e=$("div");for(let t=0;t{"option"in t&&n(1,a=t.option),"swatchSize"in t&&n(2,i=t.swatchSize),"swatchShape"in t&&n(3,r=t.swatchShape),"value"in t&&n(0,s=t.value)},[s,a,i,r,o,t=>o(t.name),(t,e)=>("Enter"===e.key||" "===e.key)&&o(t.name)]}nt(It,{option:{},value:{}},[],[],!0);class Tt extends at{constructor(t){super(),tt(this,t,Gt,Pt,c,{option:1,swatchSize:2,swatchShape:3,value:0})}get option(){return this.$$.ctx[1]}set option(t){this.$$set({option:t}),A()}get swatchSize(){return this.$$.ctx[2]}set swatchSize(t){this.$$set({swatchSize:t}),A()}get swatchShape(){return this.$$.ctx[3]}set swatchShape(t){this.$$set({swatchShape:t}),A()}get value(){return this.$$.ctx[0]}set value(t){this.$$set({value:t}),A()}}function Vt(t){let e,n;return e=new It({props:{option:t[1],value:t[0]}}),e.$on("change",t[5]),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};2&n&&(a.option=t[1]),1&n&&(a.value=t[0]),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function Mt(t){let e,n;return e=new Tt({props:{option:t[1],swatchSize:t[2],swatchShape:t[3],value:t[0]}}),e.$on("change",t[5]),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};2&n&&(a.option=t[1]),4&n&&(a.swatchSize=t[2]),8&n&&(a.swatchShape=t[3]),1&n&&(a.value=t[0]),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function Lt(t){let e,n;return e=new vt({props:{option:t[1],swatchSize:t[2],swatchShape:t[3],value:t[0]}}),e.$on("change",t[5]),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};2&n&&(a.option=t[1]),4&n&&(a.swatchSize=t[2]),8&n&&(a.swatchShape=t[3]),1&n&&(a.value=t[0]),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function Ot(t){let e,n,a,i;const r=[Lt,Mt,Vt],s=[];function c(t,e){return"colorDropdown"===t[4]||"imageDropdown"===t[4]||"mixedDropdown"===t[4]?0:"colorButtons"===t[4]||"imageButtons"===t[4]?1:2}return e=c(t),n=s[e]=r[e](t),{c(){n.c(),a=y()},m(t,n){s[e].m(t,n),h(t,a,n),i=!0},p(t,[i]){let o=e;e=c(t),e===o?s[e].p(t,i):(R(),J(s[o],1,1,(()=>{s[o]=null})),U(),n=s[e],n?n.p(t,i):(n=s[e]=r[e](t),n.c()),Z(n,1),n.m(a.parentNode,a))},i(t){i||(Z(n),i=!0)},o(t){J(n),i=!1},d(t){t&&m(a),s[e].d(t)}}}function Et(t,e,n){let{value:a}=e,{option:i}=e,{swatchSize:r=18}=e,{swatchShape:s="circle"}=e,{swatchType:c}=e;const o=G();return t.$$set=t=>{"value"in t&&n(0,a=t.value),"option"in t&&n(1,i=t.option),"swatchSize"in t&&n(2,r=t.swatchSize),"swatchShape"in t&&n(3,s=t.swatchShape),"swatchType"in t&&n(4,c=t.swatchType)},[a,i,r,s,c,function(t){o("change",{position:i.position,value:t.detail})}]}nt(Tt,{option:{},swatchSize:{},swatchShape:{},value:{}},[],[],!0);class Ft extends at{constructor(t){super(),tt(this,t,Et,Ot,c,{value:0,option:1,swatchSize:2,swatchShape:3,swatchType:4})}get value(){return this.$$.ctx[0]}set value(t){this.$$set({value:t}),A()}get option(){return this.$$.ctx[1]}set option(t){this.$$set({option:t}),A()}get swatchSize(){return this.$$.ctx[2]}set swatchSize(t){this.$$set({swatchSize:t}),A()}get swatchShape(){return this.$$.ctx[3]}set swatchShape(t){this.$$set({swatchShape:t}),A()}get swatchType(){return this.$$.ctx[4]}set swatchType(t){this.$$set({swatchType:t}),A()}}function Nt(t,e,n){const a=t.slice();return a[18]=e[n],a}function qt(t){let e,n,a,i,r;return{c(){e=$("div"),n=$("span"),n.textContent="#",a=b(),i=$("span"),r=g(t[2]),v(e,"class","kaching-bundles__bar-variant-number")},m(t,s){h(t,e,s),d(e,n),d(e,a),d(e,i),d(i,r)},p(t,e){4&e&&_(r,t[2])},d(t){t&&m(e)}}}function Dt(t){let e,n;return e=new Ft({props:{option:t[18],swatchSize:t[0],swatchShape:t[1],swatchType:t[18].swatchType,value:t[5][t[18].position-1]}}),e.$on("change",t[7]),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};64&n&&(a.option=t[18]),1&n&&(a.swatchSize=t[0]),2&n&&(a.swatchShape=t[1]),64&n&&(a.swatchType=t[18].swatchType),96&n&&(a.value=t[5][t[18].position-1]),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function At(t){let e,n,a=t[3].invalidVariant+"";return{c(){e=$("div"),n=g(a),v(e,"class","kaching-bundles__invalid-variant-error")},m(t,a){h(t,e,a),d(e,n)},p(t,e){8&e&&a!==(a=t[3].invalidVariant+"")&&_(n,a)},d(t){t&&m(e)}}}function Ht(t){let e,n,a,i,r,s,c=t[2]&&qt(t),o=K(t[6]),l=[];for(let d=0;dJ(l[t],1,1,(()=>{l[t]=null}));let f=!t[4]&&t[3]&&At(t);return{c(){e=$("div"),n=$("div"),c&&c.c(),a=b(),i=$("div");for(let t=0;te.name===t.defaultName)))?void 0:e.swatchType;if(n&&"default"!==n)return n;if(c.nativeSwatchesEnabled)for(const a of t.optionValues)if(a.swatch.image||a.swatch.color)return"mixedDropdown";return"default"}function b(t,e){var n,a,i;const r=c.nativeSwatchesEnabled?e.swatch:null,s=u.find((e=>e.name===t.defaultName));if(!s||"default"===s.swatchType)return r||{color:null,image:null};if("colorButtons"===s.swatchType||"colorDropdown"===s.swatchType){return{color:Qt(null==(n=s.colors.find((t=>t.name===e.defaultName)))?void 0:n.color)||(null==r?void 0:r.color)||Qt(ut(e.defaultName))||null,image:null}}if("imageButtons"===s.swatchType||"imageDropdown"===s.swatchType){const t=null==(a=s.images.find((t=>t.name===e.defaultName)))?void 0:a.mediaImageGID,n=null==(i=m.find((e=>e.gid===t)))?void 0:i.url;return{color:(null==r?void 0:r.color)||null,image:n||(null==r?void 0:r.image)||null}}return{color:null,image:null}}return t.$$set=t=>{"config"in t&&n(8,c=t.config),"product"in t&&n(9,o=t.product),"selectedVariantId"in t&&n(10,l=t.selectedVariantId),"swatchOptions"in t&&n(11,u=t.swatchOptions),"swatchSize"in t&&n(0,d=t.swatchSize),"swatchShape"in t&&n(1,h=t.swatchShape),"mediaImages"in t&&n(12,m=t.mediaImages),"number"in t&&n(2,p=t.number),"translations"in t&&n(3,$=t.translations)},t.$$.update=()=>{1536&t.$$.dirty&&n(13,a=o.variants.find((t=>t.id===l))),8192&t.$$.dirty&&n(4,i=a),8192&t.$$.dirty&&n(5,r=a?a.options:[]),6656&t.$$.dirty&&n(6,s=o&&u&&m&&o.options.map((t=>({defaultName:t.defaultName,name:t.name,position:t.position,swatchType:g(t),optionValues:t.optionValues.map((e=>({defaultName:e.defaultName,name:e.name,swatch:b(t,e)})))}))))},[d,h,p,$,i,r,s,function(t){const{position:e,value:a}=t.detail,s=[...r];s[e-1]=a,n(5,r=s);const c=o.variants.find((t=>r.every(((e,n)=>t.options[n]==e))));n(4,i=c),i&&f("change",{variantId:i.id})},c,o,l,u,m,a]}nt(Ft,{value:{},option:{},swatchSize:{},swatchShape:{},swatchType:{}},[],[],!0);class jt extends at{constructor(t){super(),tt(this,t,Ct,Ht,c,{config:8,product:9,selectedVariantId:10,swatchOptions:11,swatchSize:0,swatchShape:1,mediaImages:12,number:2,translations:3})}get config(){return this.$$.ctx[8]}set config(t){this.$$set({config:t}),A()}get product(){return this.$$.ctx[9]}set product(t){this.$$set({product:t}),A()}get selectedVariantId(){return this.$$.ctx[10]}set selectedVariantId(t){this.$$set({selectedVariantId:t}),A()}get swatchOptions(){return this.$$.ctx[11]}set swatchOptions(t){this.$$set({swatchOptions:t}),A()}get swatchSize(){return this.$$.ctx[0]}set swatchSize(t){this.$$set({swatchSize:t}),A()}get swatchShape(){return this.$$.ctx[1]}set swatchShape(t){this.$$set({swatchShape:t}),A()}get mediaImages(){return this.$$.ctx[12]}set mediaImages(t){this.$$set({mediaImages:t}),A()}get number(){return this.$$.ctx[2]}set number(t){this.$$set({number:t}),A()}get translations(){return this.$$.ctx[3]}set translations(t){this.$$set({translations:t}),A()}}function Rt(t){let e,a,i,r,s,c,o,l,u,p,$;return{c(){var t,n;e=f("svg"),a=f("ellipse"),i=f("ellipse"),r=f("mask"),s=f("ellipse"),c=f("g"),o=f("ellipse"),l=f("path"),u=f("path"),p=f("path"),$=f("path"),v(a,"cx","47.9"),v(a,"cy","23.5"),v(a,"rx","47.9"),v(a,"ry","23.5"),v(a,"transform","matrix(.9929 .11897 -.14278 .98975 6.7 2)"),v(a,"fill","currentColor"),v(i,"cx","47.9"),v(i,"cy","23.5"),v(i,"rx","47.9"),v(i,"ry","23.5"),v(i,"transform","matrix(.9929 .11897 -.14278 .98975 6.7 2)"),v(i,"fill","#000"),v(i,"fill-opacity",".3"),v(s,"cx","47.9"),v(s,"cy","23.5"),v(s,"rx","47.9"),v(s,"ry","23.5"),v(s,"transform","matrix(.9929 .11897 -.14278 .98975 6.7 0)"),v(s,"fill","currentColor"),v(r,"id","a"),t="mask-type",n="alpha",r.style.setProperty(t,n,""),v(r,"maskUnits","userSpaceOnUse"),v(r,"x","3"),v(r,"y","5"),v(r,"width","96"),v(r,"height","48"),v(o,"cx","47.9"),v(o,"cy","23.5"),v(o,"rx","47.9"),v(o,"ry","23.5"),v(o,"transform","matrix(.9929 .11897 -.14278 .98975 6.7 0)"),v(o,"fill","currentColor"),v(c,"mask","url(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2 2 0 0 0-2 2v1-1a2 2 0 0 0-2-2h-1 1a2 2 0 0 0 2-2v-1zM13 22v3a4 4 0 0 0 4 4h3-3a4 4 0 0 0-4 4v3-3a4 4 0 0 0-4-4H6h3a4 4 0 0 0 4-4v-3zM67 4v3a4 4 0 0 0 4 4h3-3a4 4 0 0 0-4 4v3-3a4 4 0 0 0-4-4h-3 3a4 4 0 0 0 4-4V4z"),v($,"fill","#fff"),v(e,"width","102"),v(e,"height","60"),v(e,"fill","none"),v(e,"xmlns","http://www.w3.org/2000/svg")},m(t,n){h(t,e,n),d(e,a),d(e,i),d(e,r),d(r,s),d(e,c),d(c,o),d(e,l),d(e,u),d(e,p),d(e,$)},p:n,i:n,o:n,d(t){t&&m(e)}}}nt(jt,{config:{},product:{},selectedVariantId:{},swatchOptions:{},swatchSize:{},swatchShape:{},mediaImages:{},number:{},translations:{}},[],[],!0);class Ut extends at{constructor(t){super(),tt(this,t,null,Rt,c,{})}}function Zt(t){let e,a,i,r=(t[1]||Wt)+"";return{c(){e=$("div"),a=$("div"),i=g(r),v(a,"class","kaching-bundles__bar-most-popular__content"),v(e,"class","kaching-bundles__bar-most-popular kaching-bundles__bar-most-popular--simple")},m(t,n){h(t,e,n),d(e,a),d(a,i)},p(t,e){2&e&&r!==(r=(t[1]||Wt)+"")&&_(i,r)},i:n,o:n,d(t){t&&m(e)}}}function Jt(t){let e,a,i;return a=new Ut({}),{c(){e=$("div"),W(a.$$.fragment),v(e,"class","kaching-bundles__bar-most-popular kaching-bundles__bar-most-popular--fancy")},m(t,n){h(t,e,n),X(a,e,null),i=!0},p:n,i(t){i||(Z(a.$$.fragment,t),i=!0)},o(t){J(a.$$.fragment,t),i=!1},d(t){t&&m(e),Y(a)}}}function Kt(t){let e,n,a,i;const r=[Jt,Zt],s=[];function c(t,e){return"most-popular"===t[0]?0:1}return e=c(t),n=s[e]=r[e](t),{c(){n.c(),a=y()},m(t,n){s[e].m(t,n),h(t,a,n),i=!0},p(t,[i]){let o=e;e=c(t),e===o?s[e].p(t,i):(R(),J(s[o],1,1,(()=>{s[o]=null})),U(),n=s[e],n?n.p(t,i):(n=s[e]=r[e](t),n.c()),Z(n,1),n.m(a.parentNode,a))},i(t){i||(Z(n),i=!0)},o(t){J(n),i=!1},d(t){t&&m(a),s[e].d(t)}}}nt(Ut,{},[],[],!0);const Wt="MOST POPULAR";function Xt(t,e,n){let{style:a="simple"}=e,{text:i=Wt}=e;return t.$$set=t=>{"style"in t&&n(0,a=t.style),"text"in t&&n(1,i=t.text)},[a,i]}class Yt extends at{constructor(t){super(),tt(this,t,Xt,Kt,c,{style:0,text:1})}get style(){return this.$$.ctx[0]}set style(t){this.$$set({style:t}),A()}get text(){return this.$$.ctx[1]}set text(t){this.$$set({text:t}),A()}}function te(t,e){const n={amount:t=>t.toLocaleString("en-US",{minimumFractionDigits:2,maximumFractionDigits:2}),amount_no_decimal:t=>t.toLocaleString("en-US",{maximumFractionDigits:0}),amount_no_decimals:t=>t.toLocaleString("en-US",{maximumFractionDigits:0}),amount_with_comma_separator:t=>t.toLocaleString("de-DE",{minimumFractionDigits:2,maximumFractionDigits:2}),amount_no_decimals_with_comma_separator:t=>t.toLocaleString("de-DE",{maximumFractionDigits:0}),amount_with_apostrophe_separator:t=>t.toLocaleString("de-CH",{minimumFractionDigits:2,maximumFractionDigits:2}),amount_no_decimals_with_space_separator:t=>t.toLocaleString("fr-FR",{maximumFractionDigits:0}).replace(/\s/g," "),amount_with_space_separator:t=>t.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}).replace(/\s/g," "),amount_with_period_and_space_separator:t=>t.toLocaleString("fr-FR",{minimumFractionDigits:2,maximumFractionDigits:2}).replace(/\s/g," ").replace(",",".")},a=/{{\s*(\w+)\s*}}/,i=e.match(a),r=(n[i?i[1]:"amount"]||n.amount)(t/100);return e.replace(a,r)}async function ee(t,e,n){await(F(),O);const a=new CustomEvent(e,{detail:n,bubbles:!0,cancelable:!0,composed:!0});t.dispatchEvent(a)}function ne(t,e,n){return n.map((({variant:n,quantity:a})=>{let i=n.price;return n.compareAtPrice&&(t.useProductCompareAtPrice||"default"===e.discountType)&&(i=Math.max(i,n.compareAtPrice)),i*a})).reduce(((t,e)=>t+e),0)}function ae(t,e,n,a){const i=function(t,e,n){const{discountType:a,discountValue:i}=t,r=e.map((({variant:t,quantity:e})=>t.price*e)),s=r.reduce(((t,e)=>t+e),0),c=e.map((({quantity:t})=>t)),o=c.reduce(((t,e)=>t+e),0);if("specific"===a){let e=100*Number(i)*n;if(o>Number(t.quantity)){const n=e/Number(t.quantity);e=Math.ceil(n*o)}return et)).reduce(((t,e)=>t+e),0);if(a&&"default"!==t.discountType){let t;if(a.perItem){t=ie(i/r,a.precision)*r}else t=ie(i,a.precision);return tt.price*e)).reduce(((t,e)=>t+e),0)?t:i}return i}function ie(t,e=".00"){switch(e){case".99":return 100*Math.ceil(t/100)-1;case".95":return 100*Math.ceil(t/100)-5;case".90":return 100*Math.ceil(t/100)-10;case".x9":return 10*Math.ceil(t/10)-1;case".x0":return 10*Math.ceil(t/10);default:return 100*Math.ceil(t/100)}}nt(Yt,{style:{},text:{}},[],[],!0);const re={"product.title":({product:t})=>t.title,"deal_bar.discount_amount":({config:t,dealBlock:e,dealBar:n,variantQuantities:a})=>{if(!a)return;const i=ne(e,n,a),r=e.priceRounding?{perItem:e.showPricesPerItem,precision:e.priceRoundingPrecision}:void 0;return te(i-ae(n,a,t.currencyRate,r),t.moneyFormat)},"deal_bar.discount_percentage":({config:t,dealBlock:e,dealBar:n,variantQuantities:a})=>{if(!a)return;const i=ne(e,n,a),r=e.priceRounding?{perItem:e.showPricesPerItem,precision:e.priceRoundingPrecision}:void 0,s=(i-ae(n,a,t.currencyRate,r))/i*100;return`${Math.round(s)}%`}},se=({config:t,product:e,dealBlock:n,dealBar:a,variantQuantities:i})=>r=>{if(!r)return r;const s=(({config:t,product:e,dealBlock:n,dealBar:a,variantQuantities:i})=>r=>{if(r.match(/^product\.metafields/))return((t,e)=>{if(!e.metafields)return;const n=t.match(/^product\.metafields\.([a-zA-Z0-9_.]+)\.([a-zA-Z0-9_.]+)/);if(!n)return;const[a,i,r]=n;return i&&r&&"kaching_bundles"===i&&("text"===r||"text2"===r)&&e.metafields[i]&&e.metafields[i][r]||void 0})(r,e);const s=re[r];return s?s({config:t,product:e,dealBlock:n,dealBar:a,variantQuantities:i}):void 0})({config:t,product:e,dealBlock:n,dealBar:a,variantQuantities:i});return r.replace(/{{\s*([a-zA-Z0-9_.]+)\s*}}/g,((t,e)=>s(e)||""))};function ce(t){let e,n,a,i,r,s,c,o,l,p,f=t[1].text&&oe(t),g=t[6]&&!t[1].variantGID&&t[8].variants.length>1&&le(t);return{c(){e=$("div"),n=$("a"),a=$("img"),c=b(),o=$("div"),f&&f.c(),l=b(),g&&g.c(),u(a.src,i=t[12]||t[9].image||t[8].image)||v(a,"src",i),v(a,"alt",""),v(a,"height",r=t[1].imageSize||0),v(a,"class","kaching-bundles__free-gift__image"),v(n,"href",s=t[6]?t[10]:null),v(n,"target","_blank"),v(n,"class","kaching-bundles__free-gift__link"),v(o,"class","kaching-bundles__free-gift__content"),v(e,"class","kaching-bundles__free-gift"),v(e,"style",t[11])},m(t,i){h(t,e,i),d(e,n),d(n,a),d(e,c),d(e,o),f&&f.m(o,null),d(o,l),g&&g.m(o,null),p=!0},p(t,c){(!p||4864&c&&!u(a.src,i=t[12]||t[9].image||t[8].image))&&v(a,"src",i),(!p||2&c&&r!==(r=t[1].imageSize||0))&&v(a,"height",r),(!p||1088&c&&s!==(s=t[6]?t[10]:null))&&v(n,"href",s),t[1].text?f?f.p(t,c):(f=oe(t),f.c(),f.m(o,l)):f&&(f.d(1),f=null),t[6]&&!t[1].variantGID&&t[8].variants.length>1?g?(g.p(t,c),322&c&&Z(g,1)):(g=le(t),g.c(),Z(g,1),g.m(o,null)):g&&(R(),J(g,1,1,(()=>{g=null})),U()),(!p||2048&c)&&v(e,"style",t[11])},i(t){p||(Z(g),p=!0)},o(t){J(g),p=!1},d(t){t&&m(e),f&&f.d(),g&&g.d()}}}function oe(t){let e,n=t[1].text+"";return{c(){e=$("span")},m(t,a){h(t,e,a),e.innerHTML=n},p(t,a){2&a&&n!==(n=t[1].text+"")&&(e.innerHTML=n)},d(t){t&&m(e)}}}function le(t){let e,n;return e=new jt({props:{config:t[0],product:t[8],selectedVariantId:t[7],swatchOptions:t[3],swatchSize:t[4],swatchShape:t[5],mediaImages:t[2]}}),e.$on("change",t[13]),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};1&n&&(a.config=t[0]),256&n&&(a.product=t[8]),128&n&&(a.selectedVariantId=t[7]),8&n&&(a.swatchOptions=t[3]),16&n&&(a.swatchSize=t[4]),32&n&&(a.swatchShape=t[5]),4&n&&(a.mediaImages=t[2]),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function ue(t){let e,n,a=t[8]&&t[8].availableForSale&&t[7]&&t[9]&&ce(t);return{c(){a&&a.c(),e=y()},m(t,i){a&&a.m(t,i),h(t,e,i),n=!0},p(t,[n]){t[8]&&t[8].availableForSale&&t[7]&&t[9]?a?(a.p(t,n),896&n&&Z(a,1)):(a=ce(t),a.c(),Z(a,1),a.m(e.parentNode,e)):a&&(R(),J(a,1,1,(()=>{a=null})),U())},i(t){n||(Z(a),n=!0)},o(t){J(a),n=!1},d(t){t&&m(e),a&&a.d(t)}}}function de(t,e,n){let a,i,r,s,c,o,{config:l}=e,{freeGift:u}=e,{mediaImages:d=[]}=e,{freeGiftProducts:h=[]}=e,{swatchOptions:m=[]}=e,{swatchSize:p}=e,{swatchShape:$}=e,{dealBarSelected:f=!1}=e;const g=G();let b=!1;P((()=>{n(15,b=!0)}));return t.$$set=t=>{"config"in t&&n(0,l=t.config),"freeGift"in t&&n(1,u=t.freeGift),"mediaImages"in t&&n(2,d=t.mediaImages),"freeGiftProducts"in t&&n(14,h=t.freeGiftProducts),"swatchOptions"in t&&n(3,m=t.swatchOptions),"swatchSize"in t&&n(4,p=t.swatchSize),"swatchShape"in t&&n(5,$=t.swatchShape),"dealBarSelected"in t&&n(6,f=t.dealBarSelected)},t.$$.update=()=>{16386&t.$$.dirty&&n(8,a=u.productGID?h.find((t=>t.id===Number(u.productGID.split("/").pop()))):void 0),6&t.$$.dirty&&n(12,i=d&&u.mediaImageGID&&(t=>{if(!t)return;const e=d.find((e=>e.gid===t));return null==e?void 0:e.url})(u.mediaImageGID)),2&t.$$.dirty&&n(11,r=ct({"kaching-free-gift-image-height":u.imageSize+"px"})),258&t.$$.dirty&&n(7,s=u.variantGID?Number(u.variantGID.split("/").pop()):null==a?void 0:a.variants[0].id),384&t.$$.dirty&&n(9,c=a?a.variants.find((t=>t.id===s)):void 0),33536&t.$$.dirty&&c&&b&&(null==a?void 0:a.availableForSale)&&g("variantChanged",{variantId:c.id}),384&t.$$.dirty&&n(10,o=(null==a?void 0:a.url)?`${a.url}?variant=${s}`:void 0)},[l,u,d,m,p,$,f,s,a,c,o,r,i,function(t){const{variantId:e}=t.detail;n(7,s=e)},h,b]}class he extends at{constructor(t){super(),tt(this,t,de,ue,c,{config:0,freeGift:1,mediaImages:2,freeGiftProducts:14,swatchOptions:3,swatchSize:4,swatchShape:5,dealBarSelected:6})}get config(){return this.$$.ctx[0]}set config(t){this.$$set({config:t}),A()}get freeGift(){return this.$$.ctx[1]}set freeGift(t){this.$$set({freeGift:t}),A()}get mediaImages(){return this.$$.ctx[2]}set mediaImages(t){this.$$set({mediaImages:t}),A()}get freeGiftProducts(){return this.$$.ctx[14]}set freeGiftProducts(t){this.$$set({freeGiftProducts:t}),A()}get swatchOptions(){return this.$$.ctx[3]}set swatchOptions(t){this.$$set({swatchOptions:t}),A()}get swatchSize(){return this.$$.ctx[4]}set swatchSize(t){this.$$set({swatchSize:t}),A()}get swatchShape(){return this.$$.ctx[5]}set swatchShape(t){this.$$set({swatchShape:t}),A()}get dealBarSelected(){return this.$$.ctx[6]}set dealBarSelected(t){this.$$set({dealBarSelected:t}),A()}}function me(t,e,n){const a=t.slice();return a[43]=e[n],a[45]=n,a}function pe(t){let e,n;return e=new Yt({props:{style:t[2].badgeStyle,text:t[13]||void 0}}),{c(){W(e.$$.fragment)},m(t,a){X(e,t,a),n=!0},p(t,n){const a={};4&n[0]&&(a.style=t[2].badgeStyle),8192&n[0]&&(a.text=t[13]||void 0),e.$set(a)},i(t){n||(Z(e.$$.fragment,t),n=!0)},o(t){J(e.$$.fragment,t),n=!1},d(t){Y(e,t)}}}function $e(t){let e;return{c(){e=$("div"),v(e,"class","kaching-bundles__bar-radio")},m(t,n){h(t,e,n)},p:n,d(t){t&&m(e)}}}function fe(t){let e,n;return{c(){e=$("img"),v(e,"class","kaching-bundles__bar-image"),v(e,"alt",""),u(e.src,n=t[14])||v(e,"src",n)},m(t,n){h(t,e,n)},p(t,a){16384&a[0]&&!u(e.src,n=t[14])&&v(e,"src",n)},d(t){t&&m(e)}}}function ge(t){let e;return{c(){e=$("span"),v(e,"class","kaching-bundles__bar-label")},m(n,a){h(n,e,a),e.innerHTML=t[22]},p(t,n){4194304&n[0]&&(e.innerHTML=t[22])},d(t){t&&m(e)}}}function be(t){let e;return{c(){e=$("div"),v(e,"class","kaching-bundles__bar-subtitle")},m(n,a){h(n,e,a),e.innerHTML=t[23]},p(t,n){8388608&n[0]&&(e.innerHTML=t[23])},d(t){t&&m(e)}}}function ye(t){let e,n,a,i=te(t[1].showPricesPerItem?t[19]:t[9],t[0].moneyFormat)+"",r=t[18]&&_e(t);return{c(){e=$("div"),n=b(),r&&r.c(),a=y(),v(e,"class","kaching-bundles__bar-price")},m(t,s){h(t,e,s),e.innerHTML=i,h(t,n,s),r&&r.m(t,s),h(t,a,s)},p(t,n){524803&n[0]&&i!==(i=te(t[1].showPricesPerItem?t[19]:t[9],t[0].moneyFormat)+"")&&(e.innerHTML=i),t[18]?r?r.p(t,n):(r=_e(t),r.c(),r.m(a.parentNode,a)):r&&(r.d(1),r=null)},d(t){t&&(m(e),m(n),m(a)),r&&r.d(t)}}}function we(t){let e,n,a,i,r,s,c,o,l,u=te(t[1].showPricesPerItem?t[19]:t[9],t[0].moneyFormat)+"",p=te(t[15],t[0].moneyFormat)+"",f=t[18]&&ke(t);return{c(){e=$("div"),n=$("div"),a=b(),f&&f.c(),i=b(),r=$("div"),s=$("div"),c=new I(!1),o=g(" / "),l=g(t[10]),v(n,"class","kaching-bundles__bar-price"),v(e,"class","kaching-bundles__bar-pricing-row kaching-bundles__bar-pricing-row--primary"),c.a=o,v(s,"class","kaching-bundles__bar-unit-price"),v(r,"class","kaching-bundles__bar-pricing-row kaching-bundles__bar-pricing-row--secondary")},m(t,m){h(t,e,m),d(e,n),n.innerHTML=u,d(e,a),f&&f.m(e,null),h(t,i,m),h(t,r,m),d(r,s),c.m(p,s),d(s,o),d(s,l)},p(t,a){524803&a[0]&&u!==(u=te(t[1].showPricesPerItem?t[19]:t[9],t[0].moneyFormat)+"")&&(n.innerHTML=u),t[18]?f?f.p(t,a):(f=ke(t),f.c(),f.m(e,null)):f&&(f.d(1),f=null),32769&a[0]&&p!==(p=te(t[15],t[0].moneyFormat)+"")&&c.p(p),1024&a[0]&&_(l,t[10])},d(t){t&&(m(e),m(i),m(r)),f&&f.d()}}}function ve(t){let e,n,a,i,r,s=te(t[19],t[0].moneyFormat)+"",c=t[18]&&Se(t),o=t[11]>1&&xe(t);return{c(){e=$("div"),n=$("div"),a=b(),c&&c.c(),i=b(),o&&o.c(),r=y(),v(n,"class","kaching-bundles__bar-price"),v(e,"class","kaching-bundles__bar-pricing-row kaching-bundles__bar-pricing-row--main")},m(t,l){h(t,e,l),d(e,n),n.innerHTML=s,d(e,a),c&&c.m(e,null),h(t,i,l),o&&o.m(t,l),h(t,r,l)},p(t,a){524289&a[0]&&s!==(s=te(t[19],t[0].moneyFormat)+"")&&(n.innerHTML=s),t[18]?c?c.p(t,a):(c=Se(t),c.c(),c.m(e,null)):c&&(c.d(1),c=null),t[11]>1?o?o.p(t,a):(o=xe(t),o.c(),o.m(r.parentNode,r)):o&&(o.d(1),o=null)},d(t){t&&(m(e),m(i),m(r)),c&&c.d(),o&&o.d(t)}}}function _e(t){let e,n=te(t[1].showPricesPerItem?t[20]:t[12],t[0].moneyFormat)+"";return{c(){e=$("div"),v(e,"class","kaching-bundles__bar-full-price")},m(t,a){h(t,e,a),e.innerHTML=n},p(t,a){1052675&a[0]&&n!==(n=te(t[1].showPricesPerItem?t[20]:t[12],t[0].moneyFormat)+"")&&(e.innerHTML=n)},d(t){t&&m(e)}}}function ke(t){let e,n=te(t[1].showPricesPerItem?t[20]:t[12],t[0].moneyFormat)+"";return{c(){e=$("div"),v(e,"class","kaching-bundles__bar-full-price")},m(t,a){h(t,e,a),e.innerHTML=n},p(t,a){1052675&a[0]&&n!==(n=te(t[1].showPricesPerItem?t[20]:t[12],t[0].moneyFormat)+"")&&(e.innerHTML=n)},d(t){t&&m(e)}}}function Se(t){let e,n=te(t[20],t[0].moneyFormat)+"";return{c(){e=$("div"),v(e,"class","kaching-bundles__bar-full-price")},m(t,a){h(t,e,a),e.innerHTML=n},p(t,a){1048577&a[0]&&n!==(n=te(t[20],t[0].moneyFormat)+"")&&(e.innerHTML=n)},d(t){t&&m(e)}}}function xe(t){let e,n,a,i,r=te(t[9],t[0].moneyFormat)+"",s=te(t[12],t[0].moneyFormat)+"";return{c(){e=$("div"),n=$("div"),a=b(),i=$("div"),v(n,"class","kaching-bundles__bar-price"),v(i,"class","kaching-bundles__bar-full-price"),v(e,"class","kaching-bundles__bar-pricing-row kaching-bundles__bar-pricing-row--secondary")},m(t,c){h(t,e,c),d(e,n),n.innerHTML=r,d(e,a),d(e,i),i.innerHTML=s},p(t,e){513&e[0]&&r!==(r=te(t[9],t[0].moneyFormat)+"")&&(n.innerHTML=r),4097&e[0]&&s!==(s=te(t[12],t[0].moneyFormat)+"")&&(i.innerHTML=s)},d(t){t&&m(e)}}}function Ie(t){let e,n,a,i,r=K({length:t[11]}),s=[];for(let o=0;oJ(s[t],1,1,(()=>{s[t]=null}));return{c(){e=$("div"),n=$("div"),n.textContent=`${t[25]}`,a=b();for(let t=0;t{M=null})),U()),O===(O=L(t))&&E?E.p(t,r):(E.d(1),E=O(t),E&&(E.c(),E.m(l,u))),(!G||16777216&r[0])&&(y.innerHTML=t[24]),t[22]?F?F.p(t,r):(F=ge(t),F.c(),F.m(g,null)):F&&(F.d(1),F=null),t[23]?N?N.p(t,r):(N=be(t),N.c(),N.m(f,null)):N&&(N.d(1),N=null),D===(D=q(t))&&A?A.p(t,r):(A.d(1),A=D(t),A&&(A.c(),A.m(I,null))),t[17]?H?(H.p(t,r),131072&r[0]&&Z(H,1)):(H=Ie(t),H.c(),Z(H,1),H.m(o,null)):H&&(R(),J(H,1,1,(()=>{H=null})),U()),t[2].freeGift?Q?(Q.p(t,r),4&r[0]&&Z(Q,1)):(Q=Be(t),Q.c(),Z(Q,1),Q.m(s,null)):Q&&(R(),J(Q,1,1,(()=>{Q=null})),U()),(!G||65536&r[0])&&v(s,"for",t[16]),(!G||2097152&r[0])&&x(s,"kaching-bundles__bar-container--most-popular",t[21]),(!G||2097156&r[0])&&x(s,"kaching-bundles__bar-container--most-popular--simple",t[21]&&"simple"===t[2].badgeStyle),(!G||2097156&r[0])&&x(s,"kaching-bundles__bar-container--most-popular--fancy",t[21]&&"most-popular"===t[2].badgeStyle),(!G||4&r[0]&&P!==(P=t[2].id))&&v(e,"data-deal-bar-id",P),(!G||128&r[0])&&x(e,"kaching-bundles__bar--selected",t[7])},i(t){G||(Z(M),Z(H),Z(Q),G=!0)},o(t){J(M),J(H),J(Q),G=!1},d(t){t&&m(e),M&&M.d(),E.d(),F&&F.d(),N&&N.d(),A.d(),H&&H.d(),Q&&Q.d(),T=!1,V()}}}function Ge(t,e,n){let a,i,r,s,c,o,l,u,d,h,m,p,$,f,g,b,y,w,v,_,k,{config:S}=e,{dealBlock:x}=e,{dealBar:I}=e,{product:z}=e,{mediaImages:B=[]}=e,{freeGiftProducts:T=[]}=e,{customQuantity:V}=e,{currentVariantId:M}=e,{componentId:L}=e,{selected:O=!1}=e;const E=G();let F=!1,N=null;const q=z.options.map((t=>t.name)).join(", ");function D(t,e){const a=[...i];a[t]=e,n(8,i=a),O&&E("variantSelected",{variantId:e})}function A(t,e=!1){if(!F&&!e)return;const n=H(t),a=I.freeGift&&N?{variantId:N,quantity:I.freeGift.quantity}:null,i=te(ae(I,n,S.currencyRate,m),S.moneyFormat);E("variantsChanged",{variantQuantities:n,freeGift:a,formattedPrice:i,preselected:e})}function H(t){return t.reduce(((t,e)=>{const n=t.find((({variant:t})=>t.id===e));if(n)n.quantity+=1;else{const n=z.variants.find((t=>t.id===e));if(!n)return t;t.push({variant:n,quantity:1})}return t}),[])}P((()=>{O&&(E("dealBarSelected",{dealBarId:I.id}),A(i,!0)),F=!0}));return t.$$set=t=>{"config"in t&&n(0,S=t.config),"dealBlock"in t&&n(1,x=t.dealBlock),"dealBar"in t&&n(2,I=t.dealBar),"product"in t&&n(3,z=t.product),"mediaImages"in t&&n(4,B=t.mediaImages),"freeGiftProducts"in t&&n(5,T=t.freeGiftProducts),"customQuantity"in t&&n(29,V=t.customQuantity),"currentVariantId"in t&&n(30,M=t.currentVariantId),"componentId"in t&&n(6,L=t.componentId),"selected"in t&&n(7,O=t.selected)},t.$$.update=()=>{var e;536870916&t.$$.dirty[0]&&n(11,a=V||Number(I.quantity)),1073743872&t.$$.dirty[0]&&n(8,i=M?Array(a).fill(M):[]),384&t.$$.dirty[0]&&O&&i.length&&A(i),256&t.$$.dirty[0]&&n(31,r=H(i)),15&t.$$.dirty[0]|1&t.$$.dirty[1]&&n(34,s=se({config:S,product:z,dealBlock:x,dealBar:I,variantQuantities:r})),5&t.$$.dirty[0]&&n(33,c=I.translations.find((t=>t.locale===S.locale))),4&t.$$.dirty[0]|12&t.$$.dirty[1]&&n(24,o=s((c?c.title:null)||I.title)),4&t.$$.dirty[0]|12&t.$$.dirty[1]&&n(23,l=s((c?c.subtitle:null)||I.subtitle)),4&t.$$.dirty[0]|12&t.$$.dirty[1]&&n(22,u=s((c?c.label:null)||I.label)),4&t.$$.dirty[0]|12&t.$$.dirty[1]&&n(13,d=s((c?c.badgeText:null)||I.badgeText)),8198&t.$$.dirty[0]&&n(21,h=("most-popular"===I.badgeStyle||"simple"===I.badgeStyle&&d)&&"vertical"===x.blockLayout),2&t.$$.dirty[0]&&n(32,m=x.priceRounding?{perItem:x.showPricesPerItem,precision:x.priceRoundingPrecision}:void 0),6&t.$$.dirty[0]|1&t.$$.dirty[1]&&n(12,p=x&&ne(x,I,r)),6144&t.$$.dirty[0]&&n(20,$=Math.ceil(p/a)),7&t.$$.dirty[0]|3&t.$$.dirty[1]&&n(9,f=x&&ae(I,r,S.currencyRate,m)),2560&t.$$.dirty[0]&&n(19,g=Math.ceil(f/a)),4608&t.$$.dirty[0]&&n(18,b=p!==f),2050&t.$$.dirty[0]&&n(17,y=a&&!(!(e=x).differentVariantsEnabled||"horizontal"===e.blockLayout||1===z.variants.length||!e.hideVariantPicker&&1==a&&!e.showVariantsForSingleQuantity)),68&t.$$.dirty[0]&&n(16,w=`${I.id}_${L}`),1&t.$$.dirty[1]&&n(10,v=function(t){const e=t[0];if(!e)return null;const n=e.variant;if(!n.unitPriceReferenceValue)return null;const{unitPriceReferenceValue:a,unitPriceReferenceUnit:i}=n;return 1==a?i:`${a}${i}`}(r)),1536&t.$$.dirty[0]|1&t.$$.dirty[1]&&n(15,_=v&&function(t,e){const n=t.reduce(((t,{variant:e,quantity:n})=>{const{unitPriceQuantityValue:a,unitPriceQuantityUnit:i,unitPriceReferenceValue:r,unitPriceReferenceUnit:s}=e;if(!(a&&i&&r&&s))return t;const c=function(t,e,n){return e===n?t:"g"===e&&"kg"===n||"ml"===e&&"l"===n?t/1e3:void 0}(a,i,s);return c?t+c/r*n:t}),0);return n?e/n:null}(r,f)),20&t.$$.dirty[0]&&n(14,k=B&&(t=>{if(!t)return;const e=B.find((e=>e.gid===t));return null==e?void 0:e.url})(I.mediaImageGID))},[S,x,I,z,B,T,L,O,i,f,v,a,p,d,k,_,w,y,b,g,$,h,u,l,o,q,function(){E("dealBarSelected",{dealBarId:I.id,dealBarQuantity:I.quantity})},D,function(t){const{variantId:e}=t.detail;N=e,O&&A(i)},V,M,r,m,c,s,(t,e)=>D(t,e.detail.variantId)]}nt(he,{config:{},freeGift:{},mediaImages:{},freeGiftProducts:{},swatchOptions:{},swatchSize:{},swatchShape:{},dealBarSelected:{type:"Boolean"}},[],[],!0);class Te extends at{constructor(t){super(),tt(this,t,Ge,Pe,c,{config:0,dealBlock:1,dealBar:2,product:3,mediaImages:4,freeGiftProducts:5,customQuantity:29,currentVariantId:30,componentId:6,selected:7},null,[-1,-1])}get config(){return this.$$.ctx[0]}set config(t){this.$$set({config:t}),A()}get dealBlock(){return this.$$.ctx[1]}set dealBlock(t){this.$$set({dealBlock:t}),A()}get dealBar(){return this.$$.ctx[2]}set dealBar(t){this.$$set({dealBar:t}),A()}get product(){return this.$$.ctx[3]}set product(t){this.$$set({product:t}),A()}get mediaImages(){return this.$$.ctx[4]}set mediaImages(t){this.$$set({mediaImages:t}),A()}get freeGiftProducts(){return this.$$.ctx[5]}set freeGiftProducts(t){this.$$set({freeGiftProducts:t}),A()}get customQuantity(){return this.$$.ctx[29]}set customQuantity(t){this.$$set({customQuantity:t}),A()}get currentVariantId(){return this.$$.ctx[30]}set currentVariantId(t){this.$$set({currentVariantId:t}),A()}get componentId(){return this.$$.ctx[6]}set componentId(t){this.$$set({componentId:t}),A()}get selected(){return this.$$.ctx[7]}set selected(t){this.$$set({selected:t}),A()}}function Ve(t,e,n){const a=t.slice();return a[21]=e[n],a}function Me(t){let e,n,a,i,r,s,c=t[9]&&Le(t),o=K(t[2].dealBars),l=[];for(let d=0;dJ(l[t],1,1,(()=>{l[t]=null}));let f=t[7]&&Ee(t);return{c(){e=$("div"),c&&c.c(),n=b(),a=$("div");for(let t=0;t{a=null})),U())},i(t){n||(Z(a),n=!0)},o(t){J(a),n=!1},d(t){t&&m(e),a&&a.d(t)}}}function Ne(t,e,n){let a,i,r,{component:s}=e,{config:c}=e,{dealBlock:o}=e,{product:l}=e,{currentVariantId:u}=e,{quantity:d}=e,{mediaImages:h=[]}=e,{freeGiftProducts:m=[]}=e;let p,$=Math.random().toString(16).slice(2),f=[],g=!1,b=null;return t.$$set=t=>{"component"in t&&n(15,s=t.component),"config"in t&&n(1,c=t.config),"dealBlock"in t&&n(2,o=t.dealBlock),"product"in t&&n(3,l=t.product),"currentVariantId"in t&&n(4,u=t.currentVariantId),"quantity"in t&&n(0,d=t.quantity),"mediaImages"in t&&n(5,h=t.mediaImages),"freeGiftProducts"in t&&n(6,m=t.freeGiftProducts)},t.$$.update=()=>{4&t.$$.dirty&&n(10,a=o&&ot(o)),6&t.$$.dirty&&n(17,i=o&&(o.blockTitleTranslations||[]).find((t=>t.locale===c.locale))),131076&t.$$.dirty&&n(9,r=o&&((i?i.blockTitle:null)||o.blockTitle)),260&t.$$.dirty&&n(8,p||(p=o.preselectedDealBarId||o.dealBars[0].id)),5&t.$$.dirty&&d&&o&&function(t,e){const a=t.dealBars.slice().sort(((t,e)=>Number(t.quantity)-Number(e.quantity)));let i=a[0];for(const n of a)Number(n.quantity)<=Number(e)&&(i=n);n(8,p=i.id)}(o,d)},[d,c,o,l,u,h,m,g,p,r,a,$,function(t){const{dealBarId:e,dealBarQuantity:a}=t.detail;n(8,p=e),c.keepQuantityInput&&n(0,d=a),ee(s,"deal-bar-selected",{dealBarId:e})},function(t){const{variantId:e}=t.detail;ee(s,"variant-selected",{variantId:e})},function(t){const{variantQuantities:e,freeGift:a,formattedPrice:i,preselected:r}=t.detail,c=e.map((({variant:t,quantity:e})=>({variantId:t.id,quantity:e})));f=c,b=a;const o=c.reduce(((t,e)=>t+e.quantity),0);var u;r&&o<=1&&!a||(d&&n(0,d=o),n(7,(u=l,g=f.some((({variantId:t,quantity:e})=>{const n=u.variants.find((e=>e.id==t));return!!n&&"shopify"===n.inventoryManagement&&"deny"===n.inventoryPolicy&&null!==n.inventoryQuantity&&e>n.inventoryQuantity})))),ee(s,"variants-changed",{variantIdQuantities:c,freeGift:a,formattedPrice:i,preselected:r}))},s,function(){const t=[...f].map((({variantId:t,quantity:e})=>({variantId:t,quantity:e,properties:{}})));return b&&t.push({...b,properties:{__kachingFreeGiftDealBlockId:o.id}}),t},i]}nt(Te,{config:{},dealBlock:{},dealBar:{},product:{},mediaImages:{},freeGiftProducts:{},customQuantity:{},currentVariantId:{},componentId:{},selected:{type:"Boolean"}},[],[],!0);class qe extends at{constructor(t){super(),tt(this,t,Ne,Fe,c,{component:15,config:1,dealBlock:2,product:3,currentVariantId:4,quantity:0,mediaImages:5,freeGiftProducts:6,selectedVariants:16})}get component(){return this.$$.ctx[15]}set component(t){this.$$set({component:t}),A()}get config(){return this.$$.ctx[1]}set config(t){this.$$set({config:t}),A()}get dealBlock(){return this.$$.ctx[2]}set dealBlock(t){this.$$set({dealBlock:t}),A()}get product(){return this.$$.ctx[3]}set product(t){this.$$set({product:t}),A()}get currentVariantId(){return this.$$.ctx[4]}set currentVariantId(t){this.$$set({currentVariantId:t}),A()}get quantity(){return this.$$.ctx[0]}set quantity(t){this.$$set({quantity:t}),A()}get mediaImages(){return this.$$.ctx[5]}set mediaImages(t){this.$$set({mediaImages:t}),A()}get freeGiftProducts(){return this.$$.ctx[6]}set freeGiftProducts(t){this.$$set({freeGiftProducts:t}),A()}get selectedVariants(){return this.$$.ctx[16]}}function De(t){let e,n,a;return n=new Te({props:{config:t[0],dealBlock:t[1],dealBar:t[2],product:t[3],mediaImages:t[4],currentVariantId:t[5],componentId:t[7],selected:!0}}),{c(){e=$("div"),W(n.$$.fragment),v(e,"class","kaching-bundles"),v(e,"style",t[6])},m(t,i){h(t,e,i),X(n,e,null),a=!0},p(t,[i]){const r={};1&i&&(r.config=t[0]),2&i&&(r.dealBlock=t[1]),4&i&&(r.dealBar=t[2]),8&i&&(r.product=t[3]),16&i&&(r.mediaImages=t[4]),32&i&&(r.currentVariantId=t[5]),n.$set(r),(!a||64&i)&&v(e,"style",t[6])},i(t){a||(Z(n.$$.fragment,t),a=!0)},o(t){J(n.$$.fragment,t),a=!1},d(t){t&&m(e),Y(n)}}}function Ae(t,e,n){let a,{config:i}=e,{dealBlock:r}=e,{dealBar:s}=e,{product:c}=e,{mediaImages:o=[]}=e,{currentVariantId:l}=e;const u=Math.random().toString(16).slice(2);return t.$$set=t=>{"config"in t&&n(0,i=t.config),"dealBlock"in t&&n(1,r=t.dealBlock),"dealBar"in t&&n(2,s=t.dealBar),"product"in t&&n(3,c=t.product),"mediaImages"in t&&n(4,o=t.mediaImages),"currentVariantId"in t&&n(5,l=t.currentVariantId)},t.$$.update=()=>{2&t.$$.dirty&&n(6,a=r&&ot(r))},[i,r,s,c,o,l,a,u]}nt(qe,{component:{},config:{type:"Object",attribute:"config"},dealBlock:{type:"Object",attribute:"deal-block"},product:{type:"Object",attribute:"product"},currentVariantId:{type:"Number",attribute:"current-variant-id"},quantity:{type:"Number",attribute:"quantity"},mediaImages:{type:"Array",attribute:"media-images"},freeGiftProducts:{type:"Array",attribute:"free-gift-products"}},[],["selectedVariants"],!1,(t=>class extends t{constructor(){super(),this.component=this}}));class He extends at{constructor(t){super(),tt(this,t,Ae,De,c,{config:0,dealBlock:1,dealBar:2,product:3,mediaImages:4,currentVariantId:5})}get config(){return this.$$.ctx[0]}set config(t){this.$$set({config:t}),A()}get dealBlock(){return this.$$.ctx[1]}set dealBlock(t){this.$$set({dealBlock:t}),A()}get dealBar(){return this.$$.ctx[2]}set dealBar(t){this.$$set({dealBar:t}),A()}get product(){return this.$$.ctx[3]}set product(t){this.$$set({product:t}),A()}get mediaImages(){return this.$$.ctx[4]}set mediaImages(t){this.$$set({mediaImages:t}),A()}get currentVariantId(){return this.$$.ctx[5]}set currentVariantId(t){this.$$set({currentVariantId:t}),A()}}nt(He,{config:{type:"Object",attribute:"config"},dealBlock:{type:"Object",attribute:"deal-block"},dealBar:{type:"Object",attribute:"deal-bar"},product:{type:"Object",attribute:"product"},mediaImages:{type:"Array",attribute:"media-images"},currentVariantId:{type:"Number",attribute:"current-variant-id"}},[],[],!1,(t=>class extends t{constructor(){super(),this.component=this}}));const Qe="kaching-bundles-block",Ce="kaching-bundles-bar",je=qe;window.customElements&&!window.customElements.get(Qe)&&window.customElements.define(Qe,je.element);const Re=He;window.customElements&&!window.customElements.get(Ce)&&window.customElements.define(Ce,Re.element);return je.element}();