import{a as n}from"./chunk-CP4WO7MM.mjs";import{a as x}from"./chunk-IHX4EDUF.mjs";function R({domain:r,key:o,pretty:e,searchParams:f}){if(!r)return"";let p=`https://${x(r)}${o&&o!=="_root"?`/${x(o)}`:""}`;if(f){let t=new URLSearchParams;for(let[m,s]of Object.entries(f))t.set(m,s);p+=`?${t.toString()}`}return e?p.replace(/^https?:\/\//,""):p}function y({domain:r,key:o}){return`https://${r}${o==="_root"?"":`/${o}`}`}async function C(r,o){var f,p;let e=await fetch(r,{...o,...(o==null?void 0:o.headers)&&{headers:o.headers}});if(!e.ok){let t="An error occurred while fetching the data.";try{t=((p=(f=await e.json())==null?void 0:f.error)==null?void 0:p.message)||t}catch{}let m=new Error(t);throw m.info=t,m.status=e.status,m}return e.text()}var hr=r=>!r.periodStart||!r.periodEnd?"-":`${n(r.periodStart,{month:"short",year:new Date(r.periodStart).getUTCFullYear()===new Date(r.periodEnd).getUTCFullYear()?void 0:"numeric",timeZone:"utc"})}-${n(r.periodEnd,{month:"short",timeZone:"utc"})}`;export{hr as a,R as b,y as c,C as d};
