"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[35],{307:(e,t,n)=>{n.d(t,{a:()=>h,b:()=>a,c:()=>d,d:()=>u});var o=n(93);function c(e){return e.charAt(0).toUpperCase()+e.slice(1)}function i(e){return e.split(/(?=[A-Z])/)}const a=e=>{if("size"===e)return"pf_opt_".concat(e);const t=i(e).join("_").toLowerCase();return"pf_t_".concat(`${t}`)},s=/(se_|b_)/g,l=(e,t)=>{if("colour"===t){const t=((e,t)=>e.replace(s,""))(e);return c(t)}const n=e.toLowerCase();return"hotmilk"===n?n:c(e)},r=e=>i(c(e)).join(" ");function d({filters:e,toClearCollections:t,pageIndex:n,sortOrderValue:c}){if(e&&"undefined"!=typeof window&&"URLSearchParams"in window){const i=new URLSearchParams(window.location.search);t.forEach((e=>{i.delete(a(e))})),i.delete("_"),1===n?i.delete("page"):i.set("page",n.toString()),c&&i.set("sort",c);let s="";Object.entries(e).length&&Object.entries(e).forEach((([e,t])=>{const n=a(e);if(i.delete(n),t&&t.length>0)if("size"!==e)for(const{id:o}of t){const t=r(e);s=`${s}&${n}=${encodeURIComponent(`${t}: ${l(o,e)}`)}`}else{const e=t.map((e=>e.id)),c=(0,o.d)(e),i=(0,o.b)(e,c);for(const e of i)s=`${s}&${n}=${encodeURIComponent(e)}`}}));const d=s,h="?"+(d.length?"_=pf"+d+`${i.toString().length?"&":""}${i}`:""+i);let u=window.location.pathname;(window.location.pathname.includes("collections")||window.location.pathname.includes("search-results"))&&h.length>1&&(u+=h),history.pushState(null,"",u)}}function h(e){if("undefined"!=typeof window&&"URLSearchParams"in window){const t=new URLSearchParams(window.location.search);e.forEach((e=>{t.delete(a(e))})),t.delete("_"),t.delete("page");const n="?"+t;let o=window.location.pathname;(window.location.pathname.includes("collections")||window.location.pathname.includes("search-results"))&&("?"!==n&&(o+=n),history.pushState(null,"",o))}}const u=(e,t,n=1)=>{d({filters:e,toClearCollections:t,pageIndex:n})}}}]);