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},isRateLimited=n=>{var o;return 429===(null===(o=null==n?void 0:n.data)||void 0===o?void 0:o.status)},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{getValueFromUrl as a,isRateLimited as b,isValidURL as c,getVariantFromValues as g,isInRange as i,sortByArray as s};