const isValidURL=n=>{let o;try{o=new URL(n)}catch(n){return!1}return"http:"===o.protocol||"https:"===o.protocol},getValueFromUrl=n=>{const o=window.location.search;return new URLSearchParams(o).get(n)},sortByArray=(n,o,t)=>(n||[]).sort(((n,a)=>-1===t.indexOf(null==n?void 0:n[o])?1:-1===t.indexOf(null==a?void 0:a[o])?-1:t.indexOf(null==n?void 0:n[o])-t.indexOf(null==a?void 0:a[o]))),getVariantFromValues=({variants:n,values:o})=>{const t=Object.keys(o);for(const a of n){const n=["option_1","option_2","option_3"].map((n=>a[n])).filter((n=>null!=n));if((null==n?void 0:n.length)===(null==t?void 0:t.length)&&t.every((t=>n.includes(o[t]))))return a}return null},isInRange=(n,o)=>{const t=parseInt(n);return!(o&&((null==o?void 0:o.ad_hoc_max_amount)||(null==o?void 0:o.ad_hoc_min_amount))&&((null==o?void 0:o.ad_hoc_max_amount)&&t>(null==o?void 0:o.ad_hoc_max_amount)||(null==o?void 0:o.ad_hoc_min_amount)&&t<(null==o?void 0:o.ad_hoc_min_amount)))};export{isValidURL as a,getValueFromUrl as b,getVariantFromValues as g,isInRange as i,sortByArray as s};