"use strict";(self.webpackChunkui=self.webpackChunkui||[]).push([[5],{5:function(t,e){var n=this&&this.__awaiter||function(t,e,n,r){return new(n||(n=Promise))((function(o,a){function i(t){try{u(r.next(t))}catch(t){a(t)}}function c(t){try{u(r.throw(t))}catch(t){a(t)}}function u(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(i,c)}u((r=r.apply(t,e||[])).next())}))};function r(t){const{r:e,g:n,b:r}=function(t){let e=0,n=0,r=0;return 4==t.length?(e=parseInt("0x"+t[1]+t[1],16),n=parseInt("0x"+t[2]+t[2],16),r=parseInt("0x"+t[3]+t[3],16)):7==t.length&&(e=parseInt("0x"+t[1]+t[2],16),n=parseInt("0x"+t[3]+t[4],16),r=parseInt("0x"+t[5]+t[6],16)),{r:e,g:n,b:r}}(t);return(299*e+587*n+114*r)/1e3>=128?"black":"white"}Object.defineProperty(e,"__esModule",{value:!0}),e.safeParseInt=e.safeParseFloat=void 0,e.checkAuth=function(t){return n(this,void 0,void 0,(function*(){const e=t.cookies.get("outsmartly_token");return!!e&&200===(yield fetch("https://console.outsmartly.com/api/check-auth-state",{headers:{cookie:`outsmartly_token=${e}`}})).status}))},e.isDefined=function(t){return Boolean(t)},e.updateQueryParam=function(t,e){if("undefined"==typeof window)return;const n=new URL(window.location.href),r=new URLSearchParams(n.search);r.set(t,e),n.search=r.toString(),window.history.replaceState({path:n.toString()},"",n.toString())},e.urlToHandle=function(t){var e,n,r;const o=new URL(t);return{productHandle:null!==(n=null===(e=o.pathname.match(/\/products\/([^/?]+)/))||void 0===e?void 0:e[1])&&void 0!==n?n:"",collectionHandle:null===(r=o.pathname.match(/\/collections\/([^/?]+)/))||void 0===r?void 0:r[1]}},e.reviewPageKey=function(t,e){return`reviews_${t}_page_${e}`},e.getPageImage=function(t,e){if((null==t?void 0:t.startsWith("http"))||!e||!t)return t;const n=new URL(`https://${e}`);return n.pathname=t,n.toString()},e.getThemeColors=function({selectedVariant:t,getHexForOptionColor:e}){var n;const o=null===(n=null==t?void 0:t.selectedOptions.find((t=>"color"===t.name.toLowerCase())))||void 0===n?void 0:n.value,a=o?null==e?void 0:e(o).hexColor:"#000",i=r(a);return(null==t?void 0:t.availableForSale)?{hexColor:a,color:i,hexColorPdp:a,colorPdp:i}:{hexColor:"#666",color:"#999",hexColorPdp:a,colorPdp:i}},e.getContrastYIQ=r,e.typedFromEntries=function(t){return Object.fromEntries(t)},e.safePromise=function(t){return n(this,void 0,void 0,(function*(){try{return yield t}catch(t){return}}))},e.removeTrailingZeros=function(t){return t.replace(/(\.[0-9]*?)0*$/,"$1").replace(/\.$/,"")},e.getPriceRange=function(t){return{minPrice:Math.round(100*Math.min(...t))/100,maxPrice:Math.round(100*Math.max(...t))/100}},e.safeParseFloat=(...t)=>{try{return parseFloat(...t)}catch(t){return}},e.safeParseInt=(...t)=>{try{return parseInt(...t)}catch(t){return}}}}]);