@stacksjs/slug 0.70.113 → 0.70.115
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -2
- package/package.json +10 -7
package/dist/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{randomBytes as gt}from"crypto";import{db as _r}from"@stacksjs/database";var{defineProperty:Y,getOwnPropertyNames:Sr,getOwnPropertyDescriptor:Or}=Object,xr=Object.prototype.hasOwnProperty;function Mr(r){return this[r]}var Lr=(r)=>{var t=(Z??=new WeakMap).get(r),e;if(t)return t;if(t=Y({},"__esModule",{value:!0}),r&&typeof r==="object"||typeof r==="function"){for(var i of Sr(r))if(!xr.call(t,i))Y(t,i,{get:Mr.bind(r,i),enumerable:!(e=Or(r,i))||e.enumerable})}return Z.set(r,t),t},Z,jr=(r)=>r;function $r(r,t){this[r]=jr.bind(null,t)}var Pr=(r,t)=>{for(var e in t)Y(r,e,{get:t[e],enumerable:!0,configurable:!0,set:$r.bind(t,e)})},Dr=(r,t)=>()=>(r&&(t=r(r=0)),t),ir={};Pr(ir,{transcode:()=>Tr,resolveObjectURL:()=>Ur,kStringMaxLength:()=>fr,kMaxLength:()=>N,isUtf8:()=>br,isAscii:()=>st,default:()=>Rr,constants:()=>wr,btoa:()=>yr,atob:()=>mr,INSPECT_MAX_BYTES:()=>sr,File:()=>gr,Buffer:()=>h,Blob:()=>dr});function Yr(r){var t=r.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");if(e===-1)e=t;var i=e===t?0:4-e%4;return[e,i]}function Fr(r,t){return(r+t)*3/4-t}function Gr(r){var t,e=Yr(r),i=e[0],n=e[1],o=new Uint8Array(Fr(i,n)),u=0,a=n>0?i-4:i,p;for(p=0;p<a;p+=4)t=d[r.charCodeAt(p)]<<18|d[r.charCodeAt(p+1)]<<12|d[r.charCodeAt(p+2)]<<6|d[r.charCodeAt(p+3)],o[u++]=t>>16&255,o[u++]=t>>8&255,o[u++]=t&255;if(n===2)t=d[r.charCodeAt(p)]<<2|d[r.charCodeAt(p+1)]>>4,o[u++]=t&255;if(n===1)t=d[r.charCodeAt(p)]<<10|d[r.charCodeAt(p+1)]<<4|d[r.charCodeAt(p+2)]>>2,o[u++]=t>>8&255,o[u++]=t&255;return o}function zr(r){return w[r>>18&63]+w[r>>12&63]+w[r>>6&63]+w[r&63]}function Hr(r,t,e){var i,n=[];for(var o=t;o<e;o+=3)i=(r[o]<<16&16711680)+(r[o+1]<<8&65280)+(r[o+2]&255),n.push(zr(i));return n.join("")}function J(r){var t,e=r.length,i=e%3,n=[],o=16383;for(var u=0,a=e-i;u<a;u+=o)n.push(Hr(r,u,u+o>a?a:u+o));if(i===1)t=r[e-1],n.push(w[t>>2]+w[t<<4&63]+"==");else if(i===2)t=(r[e-2]<<8)+r[e-1],n.push(w[t>>10]+w[t>>4&63]+w[t<<2&63]+"=");return n.join("")}function _(r,t,e,i,n){var o,u,a=n*8-i-1,p=(1<<a)-1,c=p>>1,l=-7,s=e?n-1:0,E=e?-1:1,m=r[t+s];s+=E,o=m&(1<<-l)-1,m>>=-l,l+=a;for(;l>0;o=o*256+r[t+s],s+=E,l-=8);u=o&(1<<-l)-1,o>>=-l,l+=i;for(;l>0;u=u*256+r[t+s],s+=E,l-=8);if(o===0)o=1-c;else if(o===p)return u?NaN:(m?-1:1)*(1/0);else u=u+Math.pow(2,i),o=o-c;return(m?-1:1)*u*Math.pow(2,o-i)}function nr(r,t,e,i,n,o){var u,a,p,c=o*8-n-1,l=(1<<c)-1,s=l>>1,E=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=i?0:o-1,T=i?1:-1,k=t<0||t===0&&1/t<0?1:0;if(t=Math.abs(t),isNaN(t)||t===1/0)a=isNaN(t)?1:0,u=l;else{if(u=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-u))<1)u--,p*=2;if(u+s>=1)t+=E/p;else t+=E*Math.pow(2,1-s);if(t*p>=2)u++,p/=2;if(u+s>=l)a=0,u=l;else if(u+s>=1)a=(t*p-1)*Math.pow(2,n),u=u+s;else a=t*Math.pow(2,s-1)*Math.pow(2,n),u=0}for(;n>=8;r[e+m]=a&255,m+=T,a/=256,n-=8);u=u<<n|a,c+=n;for(;c>0;r[e+m]=u&255,m+=T,u/=256,c-=8);r[e+m-T]|=k*128}function A(r){if(r>N)throw RangeError('The value "'+r+'" is invalid for option "size"');let t=new Uint8Array(r);return Object.setPrototypeOf(t,h.prototype),t}function j(r,t,e){return class extends e{constructor(){super();Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}function h(r,t,e){if(typeof r==="number"){if(typeof t==="string")throw TypeError('The "string" argument must be of type string. Received type number');return F(r)}return or(r,t,e)}function or(r,t,e){if(typeof r==="string")return Zr(r,t);if(ArrayBuffer.isView(r))return Jr(r);if(r==null)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(B(r,ArrayBuffer)||r&&B(r.buffer,ArrayBuffer))return z(r,t,e);if(typeof SharedArrayBuffer<"u"&&(B(r,SharedArrayBuffer)||r&&B(r.buffer,SharedArrayBuffer)))return z(r,t,e);if(typeof r==="number")throw TypeError('The "value" argument must not be of type number. Received type number');let i=r.valueOf&&r.valueOf();if(i!=null&&i!==r)return h.from(i,t,e);let n=Kr(r);if(n)return n;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]==="function")return h.from(r[Symbol.toPrimitive]("string"),t,e);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}function ur(r){if(typeof r!=="number")throw TypeError('"size" argument must be of type number');else if(r<0)throw RangeError('The value "'+r+'" is invalid for option "size"')}function Wr(r,t,e){if(ur(r),r<=0)return A(r);if(t!==void 0)return typeof e==="string"?A(r).fill(t,e):A(r).fill(t);return A(r)}function F(r){return ur(r),A(r<0?0:W(r)|0)}function Zr(r,t){if(typeof t!=="string"||t==="")t="utf8";if(!h.isEncoding(t))throw TypeError("Unknown encoding: "+t);let e=hr(r,t)|0,i=A(e),n=i.write(r,t);if(n!==e)i=i.slice(0,n);return i}function G(r){let t=r.length<0?0:W(r.length)|0,e=A(t);for(let i=0;i<t;i+=1)e[i]=r[i]&255;return e}function Jr(r){if(B(r,Uint8Array)){let t=new Uint8Array(r);return z(t.buffer,t.byteOffset,t.byteLength)}return G(r)}function z(r,t,e){if(t<0||r.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(r.byteLength<t+(e||0))throw RangeError('"length" is outside of buffer bounds');let i;if(t===void 0&&e===void 0)i=new Uint8Array(r);else if(e===void 0)i=new Uint8Array(r,t);else i=new Uint8Array(r,t,e);return Object.setPrototypeOf(i,h.prototype),i}function Kr(r){if(h.isBuffer(r)){let t=W(r.length)|0,e=A(t);if(e.length===0)return e;return r.copy(e,0,0,t),e}if(r.length!==void 0){if(typeof r.length!=="number"||Number.isNaN(r.length))return A(0);return G(r)}if(r.type==="Buffer"&&Array.isArray(r.data))return G(r.data)}function W(r){if(r>=N)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+N.toString(16)+" bytes");return r|0}function hr(r,t){if(h.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||B(r,ArrayBuffer))return r.byteLength;if(typeof r!=="string")throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let e=r.length,i=arguments.length>2&&arguments[2]===!0;if(!i&&e===0)return 0;let n=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":return H(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e*2;case"hex":return e>>>1;case"base64":return pr(r).length;default:if(n)return i?-1:H(r).length;t=(""+t).toLowerCase(),n=!0}}function Vr(r,t,e){let i=!1;if(t===void 0||t<0)t=0;if(t>this.length)return"";if(e===void 0||e>this.length)e=this.length;if(e<=0)return"";if(e>>>=0,t>>>=0,e<=t)return"";if(!r)r="utf8";while(!0)switch(r){case"hex":return ot(this,t,e);case"utf8":case"utf-8":return ar(this,t,e);case"ascii":return it(this,t,e);case"latin1":case"binary":return nt(this,t,e);case"base64":return tt(this,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ut(this,t,e);default:if(i)throw TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),i=!0}}function U(r,t,e){let i=r[t];r[t]=r[e],r[e]=i}function K(r,t,e,i,n){if(r.length===0)return-1;if(typeof e==="string")i=e,e=0;else if(e>2147483647)e=2147483647;else if(e<-2147483648)e=-2147483648;if(e=+e,Number.isNaN(e))e=n?0:r.length-1;if(e<0)e=r.length+e;if(e>=r.length)if(n)return-1;else e=r.length-1;else if(e<0)if(n)e=0;else return-1;if(typeof t==="string")t=h.from(t,i);if(h.isBuffer(t)){if(t.length===0)return-1;return V(r,t,e,i,n)}else if(typeof t==="number"){if(t=t&255,typeof Uint8Array.prototype.indexOf==="function")if(n)return Uint8Array.prototype.indexOf.call(r,t,e);else return Uint8Array.prototype.lastIndexOf.call(r,t,e);return V(r,[t],e,i,n)}throw TypeError("val must be string, number or Buffer")}function V(r,t,e,i,n){let o=1,u=r.length,a=t.length;if(i!==void 0){if(i=String(i).toLowerCase(),i==="ucs2"||i==="ucs-2"||i==="utf16le"||i==="utf-16le"){if(r.length<2||t.length<2)return-1;o=2,u/=2,a/=2,e/=2}}function p(l,s){if(o===1)return l[s];else return l.readUInt16BE(s*o)}let c;if(n){let l=-1;for(c=e;c<u;c++)if(p(r,c)===p(t,l===-1?0:c-l)){if(l===-1)l=c;if(c-l+1===a)return l*o}else{if(l!==-1)c-=c-l;l=-1}}else{if(e+a>u)e=u-a;for(c=e;c>=0;c--){let l=!0;for(let s=0;s<a;s++)if(p(r,c+s)!==p(t,s)){l=!1;break}if(l)return c}}return-1}function Xr(r,t,e,i){e=Number(e)||0;let n=r.length-e;if(!i)i=n;else if(i=Number(i),i>n)i=n;let o=t.length;if(i>o/2)i=o/2;let u;for(u=0;u<i;++u){let a=parseInt(t.substr(u*2,2),16);if(Number.isNaN(a))return u;r[e+u]=a}return u}function qr(r,t,e,i){return L(H(t,r.length-e),r,e,i)}function Qr(r,t,e,i){return L(ct(t),r,e,i)}function vr(r,t,e,i){return L(pr(t),r,e,i)}function rt(r,t,e,i){return L(lt(t,r.length-e),r,e,i)}function tt(r,t,e){if(t===0&&e===r.length)return J(r);else return J(r.slice(t,e))}function ar(r,t,e){e=Math.min(r.length,e);let i=[],n=t;while(n<e){let o=r[n],u=null,a=o>239?4:o>223?3:o>191?2:1;if(n+a<=e){let p,c,l,s;switch(a){case 1:if(o<128)u=o;break;case 2:if(p=r[n+1],(p&192)===128){if(s=(o&31)<<6|p&63,s>127)u=s}break;case 3:if(p=r[n+1],c=r[n+2],(p&192)===128&&(c&192)===128){if(s=(o&15)<<12|(p&63)<<6|c&63,s>2047&&(s<55296||s>57343))u=s}break;case 4:if(p=r[n+1],c=r[n+2],l=r[n+3],(p&192)===128&&(c&192)===128&&(l&192)===128){if(s=(o&15)<<18|(p&63)<<12|(c&63)<<6|l&63,s>65535&&s<1114112)u=s}}}if(u===null)u=65533,a=1;else if(u>65535)u-=65536,i.push(u>>>10&1023|55296),u=56320|u&1023;i.push(u),n+=a}return et(i)}function et(r){let t=r.length;if(t<=er)return String.fromCharCode.apply(String,r);let e="",i=0;while(i<t)e+=String.fromCharCode.apply(String,r.slice(i,i+=er));return e}function it(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]&127);return i}function nt(r,t,e){let i="";e=Math.min(r.length,e);for(let n=t;n<e;++n)i+=String.fromCharCode(r[n]);return i}function ot(r,t,e){let i=r.length;if(!t||t<0)t=0;if(!e||e<0||e>i)e=i;let n="";for(let o=t;o<e;++o)n+=Ir[r[o]];return n}function ut(r,t,e){let i=r.slice(t,e),n="";for(let o=0;o<i.length-1;o+=2)n+=String.fromCharCode(i[o]+i[o+1]*256);return n}function y(r,t,e){if(r%1!==0||r<0)throw RangeError("offset is not uint");if(r+t>e)throw RangeError("Trying to access beyond buffer length")}function g(r,t,e,i,n,o){if(!h.isBuffer(r))throw TypeError('"buffer" argument must be a Buffer instance');if(t>n||t<o)throw RangeError('"value" argument is out of bounds');if(e+i>r.length)throw RangeError("Index out of range")}function X(r,t,e,i,n){lr(t,i,n,r,e,7);let o=Number(t&BigInt(4294967295));r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o,o=o>>8,r[e++]=o;let u=Number(t>>BigInt(32)&BigInt(4294967295));return r[e++]=u,u=u>>8,r[e++]=u,u=u>>8,r[e++]=u,u=u>>8,r[e++]=u,e}function q(r,t,e,i,n){lr(t,i,n,r,e,7);let o=Number(t&BigInt(4294967295));r[e+7]=o,o=o>>8,r[e+6]=o,o=o>>8,r[e+5]=o,o=o>>8,r[e+4]=o;let u=Number(t>>BigInt(32)&BigInt(4294967295));return r[e+3]=u,u=u>>8,r[e+2]=u,u=u>>8,r[e+1]=u,u=u>>8,r[e]=u,e+8}function cr(r,t,e,i,n,o){if(e+i>r.length)throw RangeError("Index out of range");if(e<0)throw RangeError("Index out of range")}function Q(r,t,e,i,n){if(t=+t,e=e>>>0,!n)cr(r,t,e,4,340282346638528860000000000000000000000,-340282346638528860000000000000000000000);return nr(r,t,e,i,23,4),e+4}function v(r,t,e,i,n){if(t=+t,e=e>>>0,!n)cr(r,t,e,8,179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000,-179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000);return nr(r,t,e,i,52,8),e+8}function rr(r){let t="",e=r.length,i=r[0]==="-"?1:0;for(;e>=i+4;e-=3)t=`_${r.slice(e-3,e)}${t}`;return`${r.slice(0,e)}${t}`}function ht(r,t,e){if(R(t,"offset"),r[t]===void 0||r[t+e]===void 0)C(t,r.length-(e+1))}function lr(r,t,e,i,n,o){if(r>e||r<t){let u=typeof t==="bigint"?"n":"",a;if(o>3)if(t===0||t===BigInt(0))a=`>= 0${u} and < 2${u} ** ${(o+1)*8}${u}`;else a=`>= -(2${u} ** ${(o+1)*8-1}${u}) and < 2 ** ${(o+1)*8-1}${u}`;else a=`>= ${t}${u} and <= ${e}${u}`;throw new O("value",a,r)}ht(i,n,o)}function R(r,t){if(typeof r!=="number")throw new Er(t,"number",r)}function C(r,t,e){if(Math.floor(r)!==r)throw R(r,e),new O(e||"offset","an integer",r);if(t<0)throw new Br;throw new O(e||"offset",`>= ${e?1:0} and <= ${t}`,r)}function at(r){if(r=r.split("=")[0],r=r.trim().replace(Ar,""),r.length<2)return"";while(r.length%4!==0)r=r+"=";return r}function H(r,t){t=t||1/0;let e,i=r.length,n=null,o=[];for(let u=0;u<i;++u){if(e=r.charCodeAt(u),e>55295&&e<57344){if(!n){if(e>56319){if((t-=3)>-1)o.push(239,191,189);continue}else if(u+1===i){if((t-=3)>-1)o.push(239,191,189);continue}n=e;continue}if(e<56320){if((t-=3)>-1)o.push(239,191,189);n=e;continue}e=(n-55296<<10|e-56320)+65536}else if(n){if((t-=3)>-1)o.push(239,191,189)}if(n=null,e<128){if((t-=1)<0)break;o.push(e)}else if(e<2048){if((t-=2)<0)break;o.push(e>>6|192,e&63|128)}else if(e<65536){if((t-=3)<0)break;o.push(e>>12|224,e>>6&63|128,e&63|128)}else if(e<1114112){if((t-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,e&63|128)}else throw Error("Invalid code point")}return o}function ct(r){let t=[];for(let e=0;e<r.length;++e)t.push(r.charCodeAt(e)&255);return t}function lt(r,t){let e,i,n,o=[];for(let u=0;u<r.length;++u){if((t-=2)<0)break;e=r.charCodeAt(u),i=e>>8,n=e%256,o.push(n),o.push(i)}return o}function pr(r){return Gr(at(r))}function L(r,t,e,i){let n;for(n=0;n<i;++n){if(n+e>=t.length||n>=r.length)break;t[n+e]=r[n]}return n}function B(r,t){return r instanceof t||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===t.name}function I(r){return typeof BigInt>"u"?pt:r}function pt(){throw Error("BigInt not supported")}function $(r){return()=>{throw Error(r+" is not implemented for node:buffer browser polyfill")}}var w,d,P="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",b,tr,D,sr=50,N=2147483647,fr=536870888,yr,mr,gr,dr,wr,Br,Er,O,er=4096,Ar,Ir,Ur,br,st=(r)=>{for(let t of r)if(t.charCodeAt(0)>127)return!1;return!0},Tr,Rr,ft=Dr(()=>{w=[],d=[];for(b=0,tr=P.length;b<tr;++b)w[b]=P[b],d[P.charCodeAt(b)]=b;if(d[45]=62,d[95]=63,D=typeof Symbol==="function"&&typeof Symbol.for==="function"?Symbol.for("nodejs.util.inspect.custom"):null,yr=globalThis.btoa,mr=globalThis.atob,gr=globalThis.File,dr=globalThis.Blob,wr={MAX_LENGTH:N,MAX_STRING_LENGTH:fr},Br=j("ERR_BUFFER_OUT_OF_BOUNDS",function(r){if(r)return`${r} is outside of buffer bounds`;return"Attempt to access memory outside buffer bounds"},RangeError),Er=j("ERR_INVALID_ARG_TYPE",function(r,t){return`The "${r}" argument must be of type number. Received type ${typeof t}`},TypeError),O=j("ERR_OUT_OF_RANGE",function(r,t,e){let i=`The value of "${r}" is out of range.`,n=e;if(Number.isInteger(e)&&Math.abs(e)>4294967296)n=rr(String(e));else if(typeof e==="bigint"){if(n=String(e),e>BigInt(2)**BigInt(32)||e<-(BigInt(2)**BigInt(32)))n=rr(n);n+="n"}return i+=` It must be ${t}. Received ${n}`,i},RangeError),Object.defineProperty(h.prototype,"parent",{enumerable:!0,get:function(){if(!h.isBuffer(this))return;return this.buffer}}),Object.defineProperty(h.prototype,"offset",{enumerable:!0,get:function(){if(!h.isBuffer(this))return;return this.byteOffset}}),h.poolSize=8192,h.from=function(r,t,e){return or(r,t,e)},Object.setPrototypeOf(h.prototype,Uint8Array.prototype),Object.setPrototypeOf(h,Uint8Array),h.alloc=function(r,t,e){return Wr(r,t,e)},h.allocUnsafe=function(r){return F(r)},h.allocUnsafeSlow=function(r){return F(r)},h.isBuffer=function(r){return r!=null&&r._isBuffer===!0&&r!==h.prototype},h.compare=function(r,t){if(B(r,Uint8Array))r=h.from(r,r.offset,r.byteLength);if(B(t,Uint8Array))t=h.from(t,t.offset,t.byteLength);if(!h.isBuffer(r)||!h.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(r===t)return 0;let e=r.length,i=t.length;for(let n=0,o=Math.min(e,i);n<o;++n)if(r[n]!==t[n]){e=r[n],i=t[n];break}if(e<i)return-1;if(i<e)return 1;return 0},h.isEncoding=function(r){switch(String(r).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},h.concat=function(r,t){if(!Array.isArray(r))throw TypeError('"list" argument must be an Array of Buffers');if(r.length===0)return h.alloc(0);let e;if(t===void 0){t=0;for(e=0;e<r.length;++e)t+=r[e].length}let i=h.allocUnsafe(t),n=0;for(e=0;e<r.length;++e){let o=r[e];if(B(o,Uint8Array))if(n+o.length>i.length){if(!h.isBuffer(o))o=h.from(o);o.copy(i,n)}else Uint8Array.prototype.set.call(i,o,n);else if(!h.isBuffer(o))throw TypeError('"list" argument must be an Array of Buffers');else o.copy(i,n);n+=o.length}return i},h.byteLength=hr,h.prototype._isBuffer=!0,h.prototype.swap16=function(){let r=this.length;if(r%2!==0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<r;t+=2)U(this,t,t+1);return this},h.prototype.swap32=function(){let r=this.length;if(r%4!==0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<r;t+=4)U(this,t,t+3),U(this,t+1,t+2);return this},h.prototype.swap64=function(){let r=this.length;if(r%8!==0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<r;t+=8)U(this,t,t+7),U(this,t+1,t+6),U(this,t+2,t+5),U(this,t+3,t+4);return this},h.prototype.toString=function(){let r=this.length;if(r===0)return"";if(arguments.length===0)return ar(this,0,r);return Vr.apply(this,arguments)},h.prototype.toLocaleString=h.prototype.toString,h.prototype.equals=function(r){if(!h.isBuffer(r))throw TypeError("Argument must be a Buffer");if(this===r)return!0;return h.compare(this,r)===0},h.prototype.inspect=function(){let r="",t=sr;if(r=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t)r+=" ... ";return"<Buffer "+r+">"},D)h.prototype[D]=h.prototype.inspect;h.prototype.compare=function(r,t,e,i,n){if(B(r,Uint8Array))r=h.from(r,r.offset,r.byteLength);if(!h.isBuffer(r))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof r);if(t===void 0)t=0;if(e===void 0)e=r?r.length:0;if(i===void 0)i=0;if(n===void 0)n=this.length;if(t<0||e>r.length||i<0||n>this.length)throw RangeError("out of range index");if(i>=n&&t>=e)return 0;if(i>=n)return-1;if(t>=e)return 1;if(t>>>=0,e>>>=0,i>>>=0,n>>>=0,this===r)return 0;let o=n-i,u=e-t,a=Math.min(o,u),p=this.slice(i,n),c=r.slice(t,e);for(let l=0;l<a;++l)if(p[l]!==c[l]){o=p[l],u=c[l];break}if(o<u)return-1;if(u<o)return 1;return 0},h.prototype.includes=function(r,t,e){return this.indexOf(r,t,e)!==-1},h.prototype.indexOf=function(r,t,e){return K(this,r,t,e,!0)},h.prototype.lastIndexOf=function(r,t,e){return K(this,r,t,e,!1)},h.prototype.write=function(r,t,e,i){if(t===void 0)i="utf8",e=this.length,t=0;else if(e===void 0&&typeof t==="string")i=t,e=this.length,t=0;else if(isFinite(t))if(t=t>>>0,isFinite(e)){if(e=e>>>0,i===void 0)i="utf8"}else i=e,e=void 0;else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let n=this.length-t;if(e===void 0||e>n)e=n;if(r.length>0&&(e<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");if(!i)i="utf8";let o=!1;for(;;)switch(i){case"hex":return Xr(this,r,t,e);case"utf8":case"utf-8":return qr(this,r,t,e);case"ascii":case"latin1":case"binary":return Qr(this,r,t,e);case"base64":return vr(this,r,t,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rt(this,r,t,e);default:if(o)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},h.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},h.prototype.slice=function(r,t){let e=this.length;if(r=~~r,t=t===void 0?e:~~t,r<0){if(r+=e,r<0)r=0}else if(r>e)r=e;if(t<0){if(t+=e,t<0)t=0}else if(t>e)t=e;if(t<r)t=r;let i=this.subarray(r,t);return Object.setPrototypeOf(i,h.prototype),i},h.prototype.readUintLE=h.prototype.readUIntLE=function(r,t,e){if(r=r>>>0,t=t>>>0,!e)y(r,t,this.length);let i=this[r],n=1,o=0;while(++o<t&&(n*=256))i+=this[r+o]*n;return i},h.prototype.readUintBE=h.prototype.readUIntBE=function(r,t,e){if(r=r>>>0,t=t>>>0,!e)y(r,t,this.length);let i=this[r+--t],n=1;while(t>0&&(n*=256))i+=this[r+--t]*n;return i},h.prototype.readUint8=h.prototype.readUInt8=function(r,t){if(r=r>>>0,!t)y(r,1,this.length);return this[r]},h.prototype.readUint16LE=h.prototype.readUInt16LE=function(r,t){if(r=r>>>0,!t)y(r,2,this.length);return this[r]|this[r+1]<<8},h.prototype.readUint16BE=h.prototype.readUInt16BE=function(r,t){if(r=r>>>0,!t)y(r,2,this.length);return this[r]<<8|this[r+1]},h.prototype.readUint32LE=h.prototype.readUInt32LE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return(this[r]|this[r+1]<<8|this[r+2]<<16)+this[r+3]*16777216},h.prototype.readUint32BE=h.prototype.readUInt32BE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return this[r]*16777216+(this[r+1]<<16|this[r+2]<<8|this[r+3])},h.prototype.readBigUInt64LE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],e=this[r+7];if(t===void 0||e===void 0)C(r,this.length-8);let i=t+this[++r]*256+this[++r]*65536+this[++r]*16777216,n=this[++r]+this[++r]*256+this[++r]*65536+e*16777216;return BigInt(i)+(BigInt(n)<<BigInt(32))}),h.prototype.readBigUInt64BE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],e=this[r+7];if(t===void 0||e===void 0)C(r,this.length-8);let i=t*16777216+this[++r]*65536+this[++r]*256+this[++r],n=this[++r]*16777216+this[++r]*65536+this[++r]*256+e;return(BigInt(i)<<BigInt(32))+BigInt(n)}),h.prototype.readIntLE=function(r,t,e){if(r=r>>>0,t=t>>>0,!e)y(r,t,this.length);let i=this[r],n=1,o=0;while(++o<t&&(n*=256))i+=this[r+o]*n;if(n*=128,i>=n)i-=Math.pow(2,8*t);return i},h.prototype.readIntBE=function(r,t,e){if(r=r>>>0,t=t>>>0,!e)y(r,t,this.length);let i=t,n=1,o=this[r+--i];while(i>0&&(n*=256))o+=this[r+--i]*n;if(n*=128,o>=n)o-=Math.pow(2,8*t);return o},h.prototype.readInt8=function(r,t){if(r=r>>>0,!t)y(r,1,this.length);if(!(this[r]&128))return this[r];return(255-this[r]+1)*-1},h.prototype.readInt16LE=function(r,t){if(r=r>>>0,!t)y(r,2,this.length);let e=this[r]|this[r+1]<<8;return e&32768?e|4294901760:e},h.prototype.readInt16BE=function(r,t){if(r=r>>>0,!t)y(r,2,this.length);let e=this[r+1]|this[r]<<8;return e&32768?e|4294901760:e},h.prototype.readInt32LE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return this[r]|this[r+1]<<8|this[r+2]<<16|this[r+3]<<24},h.prototype.readInt32BE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return this[r]<<24|this[r+1]<<16|this[r+2]<<8|this[r+3]},h.prototype.readBigInt64LE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],e=this[r+7];if(t===void 0||e===void 0)C(r,this.length-8);let i=this[r+4]+this[r+5]*256+this[r+6]*65536+(e<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++r]*256+this[++r]*65536+this[++r]*16777216)}),h.prototype.readBigInt64BE=I(function(r){r=r>>>0,R(r,"offset");let t=this[r],e=this[r+7];if(t===void 0||e===void 0)C(r,this.length-8);let i=(t<<24)+this[++r]*65536+this[++r]*256+this[++r];return(BigInt(i)<<BigInt(32))+BigInt(this[++r]*16777216+this[++r]*65536+this[++r]*256+e)}),h.prototype.readFloatLE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return _(this,r,!0,23,4)},h.prototype.readFloatBE=function(r,t){if(r=r>>>0,!t)y(r,4,this.length);return _(this,r,!1,23,4)},h.prototype.readDoubleLE=function(r,t){if(r=r>>>0,!t)y(r,8,this.length);return _(this,r,!0,52,8)},h.prototype.readDoubleBE=function(r,t){if(r=r>>>0,!t)y(r,8,this.length);return _(this,r,!1,52,8)},h.prototype.writeUintLE=h.prototype.writeUIntLE=function(r,t,e,i){if(r=+r,t=t>>>0,e=e>>>0,!i){let u=Math.pow(2,8*e)-1;g(this,r,t,e,u,0)}let n=1,o=0;this[t]=r&255;while(++o<e&&(n*=256))this[t+o]=r/n&255;return t+e},h.prototype.writeUintBE=h.prototype.writeUIntBE=function(r,t,e,i){if(r=+r,t=t>>>0,e=e>>>0,!i){let u=Math.pow(2,8*e)-1;g(this,r,t,e,u,0)}let n=e-1,o=1;this[t+n]=r&255;while(--n>=0&&(o*=256))this[t+n]=r/o&255;return t+e},h.prototype.writeUint8=h.prototype.writeUInt8=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,1,255,0);return this[t]=r&255,t+1},h.prototype.writeUint16LE=h.prototype.writeUInt16LE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,2,65535,0);return this[t]=r&255,this[t+1]=r>>>8,t+2},h.prototype.writeUint16BE=h.prototype.writeUInt16BE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,2,65535,0);return this[t]=r>>>8,this[t+1]=r&255,t+2},h.prototype.writeUint32LE=h.prototype.writeUInt32LE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,4,4294967295,0);return this[t+3]=r>>>24,this[t+2]=r>>>16,this[t+1]=r>>>8,this[t]=r&255,t+4},h.prototype.writeUint32BE=h.prototype.writeUInt32BE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,4,4294967295,0);return this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},h.prototype.writeBigUInt64LE=I(function(r,t=0){return X(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeBigUInt64BE=I(function(r,t=0){return q(this,r,t,BigInt(0),BigInt("0xffffffffffffffff"))}),h.prototype.writeIntLE=function(r,t,e,i){if(r=+r,t=t>>>0,!i){let a=Math.pow(2,8*e-1);g(this,r,t,e,a-1,-a)}let n=0,o=1,u=0;this[t]=r&255;while(++n<e&&(o*=256)){if(r<0&&u===0&&this[t+n-1]!==0)u=1;this[t+n]=(r/o>>0)-u&255}return t+e},h.prototype.writeIntBE=function(r,t,e,i){if(r=+r,t=t>>>0,!i){let a=Math.pow(2,8*e-1);g(this,r,t,e,a-1,-a)}let n=e-1,o=1,u=0;this[t+n]=r&255;while(--n>=0&&(o*=256)){if(r<0&&u===0&&this[t+n+1]!==0)u=1;this[t+n]=(r/o>>0)-u&255}return t+e},h.prototype.writeInt8=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,1,127,-128);if(r<0)r=255+r+1;return this[t]=r&255,t+1},h.prototype.writeInt16LE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,2,32767,-32768);return this[t]=r&255,this[t+1]=r>>>8,t+2},h.prototype.writeInt16BE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,2,32767,-32768);return this[t]=r>>>8,this[t+1]=r&255,t+2},h.prototype.writeInt32LE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,4,2147483647,-2147483648);return this[t]=r&255,this[t+1]=r>>>8,this[t+2]=r>>>16,this[t+3]=r>>>24,t+4},h.prototype.writeInt32BE=function(r,t,e){if(r=+r,t=t>>>0,!e)g(this,r,t,4,2147483647,-2147483648);if(r<0)r=4294967295+r+1;return this[t]=r>>>24,this[t+1]=r>>>16,this[t+2]=r>>>8,this[t+3]=r&255,t+4},h.prototype.writeBigInt64LE=I(function(r,t=0){return X(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeBigInt64BE=I(function(r,t=0){return q(this,r,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),h.prototype.writeFloatLE=function(r,t,e){return Q(this,r,t,!0,e)},h.prototype.writeFloatBE=function(r,t,e){return Q(this,r,t,!1,e)},h.prototype.writeDoubleLE=function(r,t,e){return v(this,r,t,!0,e)},h.prototype.writeDoubleBE=function(r,t,e){return v(this,r,t,!1,e)},h.prototype.copy=function(r,t,e,i){if(!h.isBuffer(r))throw TypeError("argument should be a Buffer");if(!e)e=0;if(!i&&i!==0)i=this.length;if(t>=r.length)t=r.length;if(!t)t=0;if(i>0&&i<e)i=e;if(i===e)return 0;if(r.length===0||this.length===0)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");if(i>this.length)i=this.length;if(r.length-t<i-e)i=r.length-t+e;let n=i-e;if(this===r&&typeof Uint8Array.prototype.copyWithin==="function")this.copyWithin(t,e,i);else Uint8Array.prototype.set.call(r,this.subarray(e,i),t);return n},h.prototype.fill=function(r,t,e,i){if(typeof r==="string"){if(typeof t==="string")i=t,t=0,e=this.length;else if(typeof e==="string")i=e,e=this.length;if(i!==void 0&&typeof i!=="string")throw TypeError("encoding must be a string");if(typeof i==="string"&&!h.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(r.length===1){let o=r.charCodeAt(0);if(i==="utf8"&&o<128||i==="latin1")r=o}}else if(typeof r==="number")r=r&255;else if(typeof r==="boolean")r=Number(r);if(t<0||this.length<t||this.length<e)throw RangeError("Out of range index");if(e<=t)return this;if(t=t>>>0,e=e===void 0?this.length:e>>>0,!r)r=0;let n;if(typeof r==="number")for(n=t;n<e;++n)this[n]=r;else{let o=h.isBuffer(r)?r:h.from(r,i),u=o.length;if(u===0)throw TypeError('The value "'+r+'" is invalid for argument "value"');for(n=0;n<e-t;++n)this[n+t]=o[n%u]}return this},Ar=/[^+/0-9A-Za-z-_]/g,Ir=function(){let r=Array(256);for(let t=0;t<16;++t){let e=t*16;for(let i=0;i<16;++i)r[e+i]="0123456789abcdef"[t]+"0123456789abcdef"[i]}return r}(),Ur=$("resolveObjectURL"),br=$("isUtf8"),Tr=$("transcode"),Rr=h});function yt(r,t){let e=r.charCodeAt(t);if(Number.isNaN(e))throw RangeError(`Index ${t} out of range for string "${r}"; please open an issue at https://github.com/Trott/slug/issues/new`);if(e<55296||e>57343)return[r.charAt(t),t];if(e>=55296&&e<=56319){if(r.length<=t+1)return[" ",t];let n=r.charCodeAt(t+1);if(n<56320||n>57343)return[" ",t];return[r.charAt(t)+r.charAt(t+1),t+1]}if(t===0)return[" ",t];let i=r.charCodeAt(t-1);if(i<55296||i>56319)return[" ",t];throw Error(`String "${r}" reaches code believed to be unreachable; please open an issue at https://github.com/Trott/slug/issues/new`)}var S;if(typeof window<"u")if(window.btoa)S=function(r){return btoa(unescape(encodeURIComponent(r)))};else S=function(r){let t=unescape(encodeURIComponent(`${r}`)),e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i="";for(let n=0;n<t.length;n+=3){let o=t.charCodeAt(n),u=n+1<t.length?t.charCodeAt(n+1):-1,a=n+2<t.length?t.charCodeAt(n+2):-1;if(o>255||u!==-1&&u>255||a!==-1&&a>255)throw Error("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range.");i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[o>>2],i+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(o&3)<<4|(u<0?0:u>>4)],i+=u<0?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[(u&15)<<2|(a<0?0:a>>6)],i+=a<0?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"[a&63]}return i};else S=function(r){return(ft(),Lr(ir)).Buffer.from(r).toString("base64")};var f=mt;function mt(r,t){if(t&&typeof t==="object"&&t.debug===!0){let o=r.split(" ").map((u)=>{return Array.from(u).map((a)=>a.codePointAt(0))});return`STRING: ${r}
|
|
3
|
-
CODEPOINTS: ${JSON.stringify(o)}`}let e=M(r,t);if((t&&typeof t==="object"&&t.fallback!==void 0?t.fallback:f.defaults.fallback)===!0&&e===""){let n="";for(let u=0;u<r.length;u++){let a=yt(r,u);u=a[1],n+=a[0]}let o=S(n);if(typeof o==="string")e=M(o,t)}return e}var Cr={bg:{\u{419}:"Y",\u{439}:"y",X:"H",x:"h",\u{426}:"Ts",\u{446}:"ts",\u{429}:"Sht",\u{449}:"sht",\u{42a}:"A",\u{44a}:"a",\u{42c}:"Y",\u{44c}:"y"},de:{\u{c4}:"AE",\u{e4}:"ae",\u{d6}:"OE",\u{f6}:"oe",\u{dc}:"UE",\u{fc}:"ue"},sr:{\u{111}:"dj",\u{110}:"DJ"},uk:{\u{418}:"Y",\u{438}:"y",\u{419}:"Y",\u{439}:"y",\u{426}:"Ts",\u{446}:"ts",\u{425}:"Kh",\u{445}:"kh",\u{429}:"Shch",\u{449}:"shch",\u{413}:"H",\u{433}:"h"}},x={};function M(r,t){if(typeof r!=="string")throw TypeError(`slug() requires a string argument, received ${typeof r}`);let e;if(typeof t==="string")e={replacement:t};else e=t?Object.assign({},t):{};e.mode=e.mode||f.defaults.mode;let i=f.defaults.modes[e.mode],n=["replacement","multicharmap","charmap","remove","lower","trim"];for(let c,l=0,s=n.length;l<s;l++)c=n[l],e[c]=c in e?e[c]:i[c];let o=e.locale?Cr[e.locale]||x:x,u=[];if(e.multicharmap)for(let c in e.multicharmap){if(!Object.prototype.hasOwnProperty.call(e.multicharmap,c))continue;let l=c.length;if(!u.includes(l))u.push(l)}u=u.sort((c,l)=>l-c);let a=e.mode==="rfc3986"?/[^\w\s\-.~]/:/[^A-Z0-9\s]/i,p="";for(let c,l=0,s=r.length;l<s;l++){c=r[l];let E=!1;for(let m=0;m<u.length;m++){let T=u[m],k=r.substr(l,T);if(e.multicharmap&&e.multicharmap[k]){l+=T-1,c=e.multicharmap[k],E=!0;break}}if(!E)if(o[c])c=o[c];else if(e.charmap&&e.charmap[c])c=e.charmap[c].replace(e.replacement," ");else if(e.replacement&&c.includes(e.replacement))c=c.replace(e.replacement," ");else c=c.replace(a,"");p+=c}if(e.remove)p=p.replace(e.remove,"");if(e.trim)p=p.trim();if(p=p.replace(/\s+/g,e.replacement),e.lower)p=p.toLowerCase();return p}var Nr={\u{92b}\u{93c}:"Fi",\u{917}\u{93c}:"Ghi",\u{916}\u{93c}:"Khi",\u{915}\u{93c}:"Qi",\u{921}\u{93c}:"ugDha",\u{922}\u{93c}:"ugDhha",\u{92f}\u{93c}:"Yi",\u{91c}\u{93c}:"Za",\u{5d1}\u{5b4}\u{5d9}:"i",\u{5d1}\u{5b5}:"e",\u{5d1}\u{5b5}\u{5d9}:"e",\u{5d1}\u{5b6}:"e",\u{5d1}\u{5b7}:"a",\u{5d1}\u{5b8}:"a",\u{5d1}\u{5b9}:"o",\u{5d5}\u{5b9}:"o",\u{5d1}\u{5bb}:"u",\u{5d5}\u{5bc}:"u",\u{5d1}\u{5bc}:"b",\u{5db}\u{5bc}:"k",\u{5da}\u{5bc}:"k",\u{5e4}\u{5bc}:"p",\u{5e9}\u{5c1}:"sh",\u{5e9}\u{5c2}:"s",\u{5d1}\u{5b0}:"e",\u{5d7}\u{5b1}:"e",\u{5d7}\u{5b2}:"a",\u{5d7}\u{5b3}:"o",\u{5d1}\u{5b4}:"i"},kr={\u{c0}:"A",\u{c1}:"A",\u{c2}:"A",\u{c3}:"A",\u{c4}:"A",\u{c5}:"A",\u{c6}:"AE",\u{c7}:"C",\u{c8}:"E",\u{c9}:"E",\u{ca}:"E",\u{cb}:"E",\u{cc}:"I",\u{cd}:"I",\u{ce}:"I",\u{cf}:"I",\u{d0}:"D",\u{d1}:"N",\u{d2}:"O",\u{d3}:"O",\u{d4}:"O",\u{d5}:"O",\u{d6}:"O",\u{150}:"O",\u{d8}:"O",\u{14c}:"O",\u{d9}:"U",\u{da}:"U",\u{db}:"U",\u{dc}:"U",\u{170}:"U",\u{dd}:"Y",\u{de}:"TH",\u{df}:"ss",\u{e0}:"a",\u{e1}:"a",\u{e2}:"a",\u{e3}:"a",\u{e4}:"a",\u{e5}:"a",\u{e6}:"ae",\u{e7}:"c",\u{e8}:"e",\u{e9}:"e",\u{ea}:"e",\u{eb}:"e",\u{ec}:"i",\u{ed}:"i",\u{ee}:"i",\u{ef}:"i",\u{f0}:"d",\u{f1}:"n",\u{f2}:"o",\u{f3}:"o",\u{f4}:"o",\u{f5}:"o",\u{f6}:"o",\u{151}:"o",\u{f8}:"o",\u{14d}:"o",\u{152}:"OE",\u{153}:"oe",\u{f9}:"u",\u{fa}:"u",\u{fb}:"u",\u{fc}:"u",\u{171}:"u",\u{fd}:"y",\u{fe}:"th",\u{ff}:"y",\u{1e9e}:"SS",\u{3b1}:"a",\u{3b2}:"b",\u{3b3}:"g",\u{3b4}:"d",\u{3b5}:"e",\u{3b6}:"z",\u{3b7}:"h",\u{3b8}:"th",\u{3b9}:"i",\u{3ba}:"k",\u{3bb}:"l",\u{3bc}:"m",\u{3bd}:"n",\u{3be}:"3",\u{3bf}:"o",\u{3c0}:"p",\u{3c1}:"r",\u{3c3}:"s",\u{3c4}:"t",\u{3c5}:"y",\u{3c6}:"f",\u{3c7}:"x",\u{3c8}:"ps",\u{3c9}:"w",\u{3ac}:"a",\u{3ad}:"e",\u{3af}:"i",\u{3cc}:"o",\u{3cd}:"y",\u{3ae}:"h",\u{3ce}:"w",\u{3c2}:"s",\u{3ca}:"i",\u{3b0}:"y",\u{3cb}:"y",\u{390}:"i",\u{391}:"A",\u{392}:"B",\u{393}:"G",\u{394}:"D",\u{395}:"E",\u{396}:"Z",\u{397}:"H",\u{398}:"Th",\u{399}:"I",\u{39a}:"K",\u{39b}:"L",\u{39c}:"M",\u{39d}:"N",\u{39e}:"3",\u{39f}:"O",\u{3a0}:"P",\u{3a1}:"R",\u{3a3}:"S",\u{3a4}:"T",\u{3a5}:"Y",\u{3a6}:"F",\u{3a7}:"X",\u{3a8}:"PS",\u{3a9}:"W",\u{386}:"A",\u{388}:"E",\u{38a}:"I",\u{38c}:"O",\u{38e}:"Y",\u{389}:"H",\u{38f}:"W",\u{3aa}:"I",\u{3ab}:"Y",\u{15f}:"s",\u{15e}:"S",\u{131}:"i",\u{130}:"I",\u{11f}:"g",\u{11e}:"G",\u{430}:"a",\u{431}:"b",\u{432}:"v",\u{433}:"g",\u{434}:"d",\u{435}:"e",\u{451}:"yo",\u{436}:"zh",\u{437}:"z",\u{438}:"i",\u{439}:"j",\u{43a}:"k",\u{43b}:"l",\u{43c}:"m",\u{43d}:"n",\u{43e}:"o",\u{43f}:"p",\u{440}:"r",\u{441}:"s",\u{442}:"t",\u{443}:"u",\u{444}:"f",\u{445}:"h",\u{446}:"c",\u{447}:"ch",\u{448}:"sh",\u{449}:"sh",\u{44a}:"u",\u{44b}:"y",\u{44c}:"",\u{44d}:"e",\u{44e}:"yu",\u{44f}:"ya",\u{410}:"A",\u{411}:"B",\u{412}:"V",\u{413}:"G",\u{414}:"D",\u{415}:"E",\u{401}:"Yo",\u{416}:"Zh",\u{417}:"Z",\u{418}:"I",\u{419}:"J",\u{41a}:"K",\u{41b}:"L",\u{41c}:"M",\u{41d}:"N",\u{41e}:"O",\u{41f}:"P",\u{420}:"R",\u{421}:"S",\u{422}:"T",\u{423}:"U",\u{424}:"F",\u{425}:"H",\u{426}:"C",\u{427}:"Ch",\u{428}:"Sh",\u{429}:"Sh",\u{42a}:"U",\u{42b}:"Y",\u{42c}:"",\u{42d}:"E",\u{42e}:"Yu",\u{42f}:"Ya",\u{404}:"Ye",\u{406}:"I",\u{407}:"Yi",\u{490}:"G",\u{454}:"ye",\u{456}:"i",\u{457}:"yi",\u{491}:"g",\u{10d}:"c",\u{10f}:"d",\u{11b}:"e",\u{148}:"n",\u{159}:"r",\u{161}:"s",\u{165}:"t",\u{16f}:"u",\u{17e}:"z",\u{10c}:"C",\u{10e}:"D",\u{11a}:"E",\u{147}:"N",\u{158}:"R",\u{160}:"S",\u{164}:"T",\u{16e}:"U",\u{17d}:"Z",\u{13e}:"l",\u{13a}:"l",\u{155}:"r",\u{13d}:"L",\u{139}:"L",\u{154}:"R",\u{105}:"a",\u{107}:"c",\u{119}:"e",\u{142}:"l",\u{144}:"n",\u{15b}:"s",\u{17a}:"z",\u{17c}:"z",\u{104}:"A",\u{106}:"C",\u{118}:"E",\u{141}:"L",\u{143}:"N",\u{15a}:"S",\u{179}:"Z",\u{17b}:"Z",\u{101}:"a",\u{113}:"e",\u{123}:"g",\u{12b}:"i",\u{137}:"k",\u{13c}:"l",\u{146}:"n",\u{16b}:"u",\u{100}:"A",\u{112}:"E",\u{122}:"G",\u{12a}:"I",\u{136}:"K",\u{13b}:"L",\u{145}:"N",\u{16a}:"U",\u{623}:"a",\u{625}:"i",\u{628}:"b",\u{62a}:"t",\u{62b}:"th",\u{62c}:"g",\u{62d}:"h",\u{62e}:"kh",\u{62f}:"d",\u{630}:"th",\u{631}:"r",\u{632}:"z",\u{633}:"s",\u{634}:"sh",\u{635}:"s",\u{636}:"d",\u{637}:"t",\u{638}:"th",\u{639}:"aa",\u{63a}:"gh",\u{641}:"f",\u{642}:"k",\u{643}:"k",\u{644}:"l",\u{645}:"m",\u{646}:"n",\u{647}:"h",\u{648}:"o",\u{64a}:"y",\u{621}:"aa",\u{629}:"a",\u{622}:"a",\u{627}:"a",\u{67e}:"p",\u{698}:"zh",\u{6af}:"g",\u{686}:"ch",\u{6a9}:"k",\u{6cc}:"i",\u{117}:"e",\u{12f}:"i",\u{173}:"u",\u{116}:"E",\u{12e}:"I",\u{172}:"U",\u{21b}:"t",\u{21a}:"T",\u{163}:"t",\u{162}:"T",\u{219}:"s",\u{218}:"S",\u{103}:"a",\u{102}:"A",\u{1ea0}:"A",\u{1ea2}:"A",\u{1ea6}:"A",\u{1ea4}:"A",\u{1eac}:"A",\u{1ea8}:"A",\u{1eaa}:"A",\u{1eb0}:"A",\u{1eae}:"A",\u{1eb6}:"A",\u{1eb2}:"A",\u{1eb4}:"A",\u{1eb8}:"E",\u{1eba}:"E",\u{1ebc}:"E",\u{1ec0}:"E",\u{1ebe}:"E",\u{1ec6}:"E",\u{1ec2}:"E",\u{1ec4}:"E",\u{1eca}:"I",\u{1ec8}:"I",\u{128}:"I",\u{1ecc}:"O",\u{1ece}:"O",\u{1ed2}:"O",\u{1ed0}:"O",\u{1ed8}:"O",\u{1ed4}:"O",\u{1ed6}:"O",\u{1a0}:"O",\u{1edc}:"O",\u{1eda}:"O",\u{1ee2}:"O",\u{1ede}:"O",\u{1ee0}:"O",\u{1ee4}:"U",\u{1ee6}:"U",\u{168}:"U",\u{1af}:"U",\u{1eea}:"U",\u{1ee8}:"U",\u{1ef0}:"U",\u{1eec}:"U",\u{1eee}:"U",\u{1ef2}:"Y",\u{1ef4}:"Y",\u{1ef6}:"Y",\u{1ef8}:"Y",\u{110}:"D",\u{1ea1}:"a",\u{1ea3}:"a",\u{1ea7}:"a",\u{1ea5}:"a",\u{1ead}:"a",\u{1ea9}:"a",\u{1eab}:"a",\u{1eb1}:"a",\u{1eaf}:"a",\u{1eb7}:"a",\u{1eb3}:"a",\u{1eb5}:"a",\u{1eb9}:"e",\u{1ebb}:"e",\u{1ebd}:"e",\u{1ec1}:"e",\u{1ebf}:"e",\u{1ec7}:"e",\u{1ec3}:"e",\u{1ec5}:"e",\u{1ecb}:"i",\u{1ec9}:"i",\u{129}:"i",\u{1ecd}:"o",\u{1ecf}:"o",\u{1ed3}:"o",\u{1ed1}:"o",\u{1ed9}:"o",\u{1ed5}:"o",\u{1ed7}:"o",\u{1a1}:"o",\u{1edd}:"o",\u{1edb}:"o",\u{1ee3}:"o",\u{1edf}:"o",\u{1ee1}:"o",\u{1ee5}:"u",\u{1ee7}:"u",\u{169}:"u",\u{1b0}:"u",\u{1eeb}:"u",\u{1ee9}:"u",\u{1ef1}:"u",\u{1eed}:"u",\u{1eef}:"u",\u{1ef3}:"y",\u{1ef5}:"y",\u{1ef7}:"y",\u{1ef9}:"y",\u{111}:"d",\u{4d8}:"AE",\u{4d9}:"ae",\u{492}:"GH",\u{493}:"gh",\u{49a}:"KH",\u{49b}:"kh",\u{4a2}:"NG",\u{4a3}:"ng",\u{4ae}:"UE",\u{4af}:"ue",\u{4b0}:"U",\u{4b1}:"u",\u{4ba}:"H",\u{4bb}:"h",\u{4e8}:"OE",\u{4e9}:"oe",\u{452}:"dj",\u{458}:"j",\u{459}:"lj",\u{45a}:"nj",\u{45b}:"c",\u{45f}:"dz",\u{402}:"Dj",\u{408}:"j",\u{409}:"Lj",\u{40a}:"Nj",\u{40b}:"C",\u{40f}:"Dz",\u{1cc}:"nj",\u{1c9}:"lj",\u{1cb}:"NJ",\u{1c8}:"LJ",\u{905}:"a",\u{906}:"aa",\u{90f}:"e",\u{908}:"ii",\u{90d}:"ei",\u{90e}:"ae",\u{910}:"ai",\u{907}:"i",\u{913}:"o",\u{911}:"oi",\u{912}:"oii",\u{90a}:"uu",\u{914}:"ou",\u{909}:"u",\u{92c}:"B",\u{92d}:"Bha",\u{91a}:"Ca",\u{91b}:"Chha",\u{921}:"Da",\u{922}:"Dha",\u{92b}:"Fa",\u{917}:"Ga",\u{918}:"Gha",\u{917}\u{93c}:"Ghi",\u{939}:"Ha",\u{91c}:"Ja",\u{91d}:"Jha",\u{915}:"Ka",\u{916}:"Kha",\u{916}\u{93c}:"Khi",\u{932}:"L",\u{933}:"Li",\u{90c}:"Li",\u{934}:"Lii",\u{961}:"Lii",\u{92e}:"Ma",\u{928}:"Na",\u{919}:"Na",\u{91e}:"Nia",\u{923}:"Nae",\u{929}:"Ni",\u{950}:"oms",\u{92a}:"Pa",\u{915}\u{93c}:"Qi",\u{930}:"Ra",\u{90b}:"Ri",\u{960}:"Ri",\u{931}:"Ri",\u{938}:"Sa",\u{936}:"Sha",\u{937}:"Shha",\u{91f}:"Ta",\u{924}:"Ta",\u{920}:"Tha",\u{926}:"Tha",\u{925}:"Tha",\u{927}:"Thha",\u{921}\u{93c}:"ugDha",\u{922}\u{93c}:"ugDhha",\u{935}:"Va",\u{92f}:"Ya",\u{92f}\u{93c}:"Yi",\u{91c}\u{93c}:"Za",\u{259}:"e",\u{18f}:"E",\u{10d0}:"a",\u{10d1}:"b",\u{10d2}:"g",\u{10d3}:"d",\u{10d4}:"e",\u{10d5}:"v",\u{10d6}:"z",\u{10d7}:"t",\u{10d8}:"i",\u{10d9}:"k",\u{10da}:"l",\u{10db}:"m",\u{10dc}:"n",\u{10dd}:"o",\u{10de}:"p",\u{10df}:"zh",\u{10e0}:"r",\u{10e1}:"s",\u{10e2}:"t",\u{10e3}:"u",\u{10e4}:"p",\u{10e5}:"k",\u{10e6}:"gh",\u{10e7}:"q",\u{10e8}:"sh",\u{10e9}:"ch",\u{10ea}:"ts",\u{10eb}:"dz",\u{10ec}:"ts",\u{10ed}:"ch",\u{10ee}:"kh",\u{10ef}:"j",\u{10f0}:"h",\u{5d1}:"v",\u{5d2}\u{5bc}:"g",\u{5d2}:"g",\u{5d3}:"d",\u{5d3}\u{5bc}:"d",\u{5d4}:"h",\u{5d5}:"v",\u{5d6}:"z",\u{5d7}:"h",\u{5d8}:"t",\u{5d9}:"y",\u{5db}:"kh",\u{5da}:"kh",\u{5dc}:"l",\u{5de}:"m",\u{5dd}:"m",\u{5e0}:"n",\u{5df}:"n",\u{5e1}:"s",\u{5e4}:"f",\u{5e3}:"f",\u{5e5}:"ts",\u{5e6}:"ts",\u{5e7}:"k",\u{5e8}:"r",\u{5ea}\u{5bc}:"t",\u{5ea}:"t"};f.charmap=Object.assign({},kr);f.multicharmap=Object.assign({},Nr);f.defaults={charmap:f.charmap,mode:"pretty",modes:{rfc3986:{replacement:"-",remove:null,lower:!0,charmap:f.charmap,multicharmap:f.multicharmap,trim:!0},pretty:{replacement:"-",remove:null,lower:!0,charmap:f.charmap,multicharmap:f.multicharmap,trim:!0}},multicharmap:f.multicharmap,fallback:!0};f.reset=function(){f.defaults.modes.rfc3986.charmap=f.defaults.modes.pretty.charmap=f.charmap=f.defaults.charmap=Object.assign({},kr),f.defaults.modes.rfc3986.multicharmap=f.defaults.modes.pretty.multicharmap=f.multicharmap=f.defaults.multicharmap=Object.assign({},Nr),x={}};f.extend=function(r){let t=Object.keys(r),e={},i={};for(let n=0;n<t.length;n++)if(t[n].length>1)e[t[n]]=r[t[n]];else i[t[n]]=r[t[n]];Object.assign(f.charmap,i),Object.assign(f.multicharmap,e)};f.setLocale=function(r){x=Cr[r]||{}};async function It(r,t){let e=M(r);if(!t?.table||!t?.column)return e;let i=e,n=1,o=1000;while(n<=o){if(!await _r.selectFrom(t.table).select(["id"]).where(t.column,"=",i).executeTakeFirst())return i;n++,i=`${e}-${n}`}let u=gt(6).toString("base64url").toLowerCase().replace(/[^a-z0-9]/g,"").slice(0,8);return`${e}-${u}`}export{It as uniqueSlug,M as slugify};
|
|
2
|
+
import{randomBytes as H}from"crypto";import{db as C}from"@stacksjs/database";import{slugify as I}from"ts-slug";async function O(D,m){let q=I(D);if(!m?.table||!m?.column)return q;let w=q,z=1,F=1000;while(z<=F){if(!await C.selectFrom(m.table).select(["id"]).where(m.column,"=",w).executeTakeFirst())return w;z++,w=`${q}-${z}`}let G=H(6).toString("base64url").toLowerCase().replace(/[^a-z0-9]/g,"").slice(0,8);return`${q}-${G}`}export{O as uniqueSlug,I as slugify};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stacksjs/slug",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.70.
|
|
4
|
+
"version": "0.70.115",
|
|
5
5
|
"description": "The Stacks slug functionality.",
|
|
6
6
|
"author": "Chris Breuer",
|
|
7
7
|
"contributors": [
|
|
@@ -50,13 +50,16 @@
|
|
|
50
50
|
"typecheck": "bun tsc --noEmit",
|
|
51
51
|
"prepublishOnly": "bun run build"
|
|
52
52
|
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"ts-slug": "^0.1.0"
|
|
55
|
+
},
|
|
53
56
|
"devDependencies": {
|
|
54
|
-
"@stacksjs/cli": "0.70.
|
|
55
|
-
"@stacksjs/database": "0.70.
|
|
56
|
-
"better-dx": "
|
|
57
|
-
"@stacksjs/path": "0.70.
|
|
58
|
-
"@stacksjs/strings": "0.70.
|
|
59
|
-
"@stacksjs/utils": "0.70.
|
|
57
|
+
"@stacksjs/cli": "0.70.115",
|
|
58
|
+
"@stacksjs/database": "0.70.115",
|
|
59
|
+
"better-dx": "catalog:",
|
|
60
|
+
"@stacksjs/path": "0.70.115",
|
|
61
|
+
"@stacksjs/strings": "0.70.115",
|
|
62
|
+
"@stacksjs/utils": "0.70.115"
|
|
60
63
|
},
|
|
61
64
|
"sideEffects": false
|
|
62
65
|
}
|