const x=/([\p{Ll}\d])(\p{Lu})/gu,_=/(\p{Lu})([\p{Lu}][\p{Ll}])/gu,d=/(\d)\p{Ll}|(\p{L})\d/u,P=/[^\p{L}\d]+/giu,o="$1\0$2",f="";function u(r){let e=r.trim();e=e.replace(x,o).replace(_,o),e=e.replace(P,"\0");let t=0,c=e.length;for(;e.charAt(t)==="\0";)t++;if(t===c)return[];for(;e.charAt(c-1)==="\0";)c--;return e.slice(t,c).split(/\0/g)}function C(r){const e=u(r);for(let t=0;t<e.length;t++){const c=e[t],n=d.exec(c);if(n){const s=n.index+(n[1]??n[2]).length;e.splice(t,1,c.slice(0,s),c.slice(s))}}return e}function p(r,e){const[t,c,n]=h(r,e);return t+c.map(L(e?.locale)).join(e?.delimiter??" ")+n}function m(r,e){return p(r,{delimiter:"-",...e})}function w(r,e){const[t,c,n]=h(r,e),s=L(e?.locale),a=R(e?.locale),l=A(s,a);return t+c.map((i,E)=>E===0?l(i):s(i)).join(" ")+n}function S(r,e){return p(r,{delimiter:"_",...e})}function L(r){return r===!1?e=>e.toLowerCase():e=>e.toLocaleLowerCase(r)}function R(r){return e=>e.toLocaleUpperCase(r)}function A(r,e){return t=>`${e(t[0])}${r(t.slice(1))}`}function h(r,e={}){const t=e.split??(e.separateNumbers?C:u),c=e.prefixCharacters??f,n=e.suffixCharacters??f;let s=0,a=r.length;for(;s<r.length;){const l=r.charAt(s);if(!c.includes(l))break;s++}for(;a>s;){const l=a-1,i=r.charAt(l);if(!n.includes(i))break;a=l}return[r.slice(0,s),t(r.slice(s,a)),r.slice(a)]}export{S as a,m as k,w as s};
