import"node:path";import"node:url";import{stringifyQuery as e}from"ufo";const t=e=>{let t=e.split(`/`).filter(Boolean);return t.length>0?t[0]:null},n=e=>{let t=e.url.match(/^https?:\/\/[^/]+(\/[^?]*)/);return t?t[1]:``},r=e=>{let[t,n]=[`,`,`.`];return e.map(e=>e.replaceAll(/(\d)(?=(\d{3})+(?!\d))/g,`$1`+t)).join(n)},i=e=>{let t=Date.now()-e;return r([t<1e3?t+`ms`:Math.round(t/1e3)+`s`])};function a(e){return Object.prototype.toString.call(e)===`[object Object]`}function o(t){return(a(t)?e(t):null)??new URLSearchParams(t).toString()}function s(e){if(e)return e.trim().replaceAll(/[^\d:]/g,``).split(`:`).toReversed().reduce((e,t,n)=>{let r=Number(t);if(Number.isNaN(r))throw TypeError(`Invalid segment: ${t}`);return e+r*60**n},0)}export{i as a,s as i,t as n,o as r,n as t};