PageSourceSearch

https://www.waterdrop.com/cdn/shop/t/30/assets/combined-flavour-list-Dusa1AmX.js

js waterdrop.com collected 2026-09-24 08:58:11 UTC 5,222 bytes, 1 lines download raw bytes

1import{d as p,j as _,c as m,b as y,s as k}from"./bundle-builder-state-BCf6-qbM.js";import T from"./custom-html-element-Cddc4xm8.js";import{g as d,B as v}from"./customer-portal-R96TstYq.js";import{s as S}from"./scroll-YV9qyVFg.js";import{g as C}from"./theme-C25wr5Yb.js";import"./logger-pamvzmAu.js";import"./exports-NHIMKJG4.js";import"./event-zU-Y6ZHH.js";function M(){if(typeof window=="undefined")return!1;const{breakpoints:u}=C()||{};return u?!window.matchMedia(u.md).matches:!1}class j extends T{constructor(){super(),this._effectDisposers=[],this._hasRenderedProgress=!1,this._onCartUpdated=this._onCartUpdated.bind(this),this._onAddToBundleClick=this._onAddToBundleClick.bind(this),this._handleScrollForMoreClick=this._handleScrollForMoreClick.bind(this),this._handleScrollForMoreVisibility=this._handleScrollForMoreVisibility.bind(this),this._scrollToFlavourList=this._scrollToFlavourList.bind(this)}connectedCallback(){this.delegate.on("click",".js-add-to-bundle",this._onAddToBundleClick),this.delegate.on("click",".js-scroll-for-more",this._handleScrollForMoreClick),this.delegate.on("scroll",".js-items-container",this._handleScrollForMoreVisibility),this.delegate.on("click",".js-bundle-tier",this._scrollToFlavourList),this.rootDelegate.on("cart:updated",this._onCartUpdated),p.value=parseInt(this.dataset.cartBundleQuantity,10)||0,this._handleScrollForMoreVisibility(),this._disposeEffects(),this._effectDisposers.push(_(()=>{this._renderProgress(this._hasRenderedProgress),this._hasRenderedProgress=!0}))}disconnectedCallback(){super.disconnectedCallback(),this._disposeEffects()}_disposeEffects(){this._effectDisposers.forEach(e=>e()),this._effectDisposers=[]}get thresholds(){return(this.dataset.thresholds||"").split(",").reduce((e,t)=>{const r=t.trim().split(":"),s=parseInt(r[1],10),o=parseInt(r[0],10)+s;return!Number.isNaN(o)&&!Number.isNaN(s)&&e.push({threshold:o,freePacks:s}),e},[])}get _progressPercent(){const{thresholds:e}=this;if(!e.length)return 0;const t=m.value;if(t>=e[e.length-1].threshold)return 100;const r=100/e.length;let s=0;for(let o=0;o<e.length;o++){const i=o===0?0:e[o-1].threshold,n=e[o].threshold;if(t>=n)s+=r;else if(t>i){s+=(t-i)/(n-i)*r;break}else break}return Math.min(100,Math.max(0,s))}_renderProgress(e){const t=this.querySelector(".js-bundle-offering");if(!t)return;const{thresholds:r}=this,s=m.value;this._updateProgressBar(t,this._progressPercent),this._updateProgressText(t,r,s),this._updateTiers(t,r,s,e)}_updateProgressBar(e,t){const r=e.querySelector(".js-bundle-progress-bar");if(!r)return;r.setAttribute("aria-valuenow",Math.round(t));const s=r.querySelector(".js-progress-bar-fill");s&&(s.style.width=`${t}%`)}_updateProgressText(e,t,r){const s=e.querySelector(".js-bundle-progress-text");if(!s)return;if(r===0){s.innerHTML=d("bundler.startText");return}const o=t.find(n=>n.threshold>r);if(!o){const n=t.sort((l,a)=>a.threshold-l.threshold)[0];s.innerHTML=d("bundler.allTiersAchieved").replace("@count@",n.freePacks);return}const i=d("bundler.progressContent");s.innerHTML=i.replace("@remaining@",o.threshold-r).replace("@free_packs@",o.freePacks)}_updateTiers(e,t,r,s){const o=e.querySelectorAll(".js-bundle-tier");let i=!1,n=-1;o.forEach((l,a)=>{const h=parseInt(t[a].threshold,10);r>=h&&(n=a)}),o.forEach((l,a)=>{const h=parseInt(t[a].threshold,10),g=parseInt(t[a].freePacks,10),c=r>=h,f=c&&a===n,b=l.classList.contains("js-is-unlocked");l.classList.toggle("js-is-unlocked",c),l.classList.toggle("border-success-600",f),l.classList.toggle("border-transparent",!f),c||i?l.setAttribute("aria-current","false"):(l.setAttribute("aria-current","step"),i=!0),s&&c&&!b&&this._announce(e,a===t.length-1,g)})}_announce(e,t,r){const s=e.querySelector(".js-bundle-announcer");if(!s)return;const o=d(t?"bundler.allTiersAchieved":"bundler.tierAchieved");if(!o)return;const i=v(o.replace("@count@",String(r)));s.textContent="",requestAnimationFrame(()=>{s.textContent=i})}_onAddToBundleClick(e){var i;const{id:t}=e.target.dataset,r=e.target.closest("modal-element");if(!t)return;const s=y.value.find(n=>n.variantId===t);k(t,((i=s==null?void 0:s.quantity)!=null?i:0)+1),r&&(r.open=!1);
1const o=this.querySelector(`bundle-builder-item[data-variant-id="${t}"] .js-qty-selector [data-increase]`);o&&setTimeout(()=>{o.focus()},0)}_onCartUpdated(e){var o,i;const t=(i=(o=e.detail)==null?void 0:o.cart)==null?void 0:i.items;if(!t)return;const r=new Set(Array.from(this.querySelectorAll("bundle-builder-item[data-variant-id]")).map(n=>parseInt(n.dataset.variantId,10)));let s=0;t.forEach(n=>{r.has(n.variant_id)&&(s+=n.quantity)}),p.value=s}_handleScrollForMoreVisibility(){const e=this.querySelector(".js-items-container"),t=this.querySelector(".js-scroll-for-more");if(!t||!e)return;const r=e.scrollHeight>e.clientHeight,s=e.scrollTop+e.clientHeight>=e.scrollHeight-1;t.classList.toggle("!hidden",!r||s)}_handleScrollForMoreClick(e){const t=this.querySelector(".js-items-container");if(!t)return;const{target:r}=e,s=t.clientHeight-r.clientHeight;t.scrollBy({top:s,behavior:"smooth"}),r.blur()}_scrollToFlavourList(){const e=this.querySelector(".js-items-container");!e||!M()||S(e)}}customElements.get("combined-flavour-list")||customElements.define("combined-flavour-list",j);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.