"use strict";const isValidURL=t=>{let o;try{o=new URL(t)}catch(t){return!1}return"http:"===o.protocol||"https:"===o.protocol},getValueFromUrl=t=>{const o=window.location.search;return new URLSearchParams(o).get(t)},sortByArray=(t,o,n)=>(t||[]).sort(((t,e)=>-1===n.indexOf(null==t?void 0:t[o])?1:-1===n.indexOf(null==e?void 0:e[o])?-1:n.indexOf(null==t?void 0:t[o])-n.indexOf(null==e?void 0:e[o]))),getVariantFromValues=({variants:t,values:o})=>{const n=Object.keys(o);for(const e of t){const t=["option_1","option_2","option_3"].map((t=>e[t])).filter((t=>null!=t));if((null==t?void 0:t.length)===(null==n?void 0:n.length)&&n.every((n=>t.includes(o[n]))))return e}return null},isRateLimited=t=>{var o;return 429===(null===(o=null==t?void 0:t.data)||void 0===o?void 0:o.status)},isInRange=(t,o)=>{const n=parseInt(t);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)&&n>(null==o?void 0:o.ad_hoc_max_amount)||(null==o?void 0:o.ad_hoc_min_amount)&&n<(null==o?void 0:o.ad_hoc_min_amount)))};exports.getValueFromUrl=getValueFromUrl,exports.getVariantFromValues=getVariantFromValues,exports.isInRange=isInRange,exports.isRateLimited=isRateLimited,exports.isValidURL=isValidURL,exports.sortByArray=sortByArray;