var f=r=>typeof ArrayBuffer=="function"&&r instanceof ArrayBuffer||Object.prototype.toString.call(r)==="[object ArrayBuffer]";import{Buffer as t}from"buffer";var o=(r,e=0,n=r.byteLength-e)=>{if(!f(r))throw new TypeError(`The "input" argument must be ArrayBuffer. Received type ${typeof r} (${r})`);return t.from(r,e,n)},y=(r,e)=>{if(typeof r!="string")throw new TypeError(`The "input" argument must be of type string. Received type ${typeof r} (${r})`);return e?t.from(r,e):t.from(r)};var a=r=>{let e=y(r,"utf8");return new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT)};var p=r=>{if(typeof r=="string")return r;if(typeof r!="object"||typeof r.byteOffset!="number"||typeof r.byteLength!="number")throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");return o(r.buffer,r.byteOffset,r.byteLength).toString("utf8")};export{f as a,o as b,y as c,a as d,p as e};
